2
* Drizzle Client & Protocol Library
4
* Copyright (C) 2008 Eric Day (eday@oddments.org)
7
* Use and distribution licensed under the BSD license. See
8
* the COPYING file in this directory for full text.
14
#include <libdrizzle/drizzle_client.h>
16
#define SIMPLE_MULTI_COUNT 10
18
int main(int argc, char *argv[])
20
const char *query= "SELECT table_schema,table_name FROM tables";
22
drizzle_con_st con[SIMPLE_MULTI_COUNT];
23
drizzle_result_st result[SIMPLE_MULTI_COUNT];
24
drizzle_query_st ql[SIMPLE_MULTI_COUNT];
29
if (drizzle_create(&drizzle) == NULL)
31
printf("drizzle_create:NULL\n");
35
/* Create SIMPLE_MULTI_COUNT connections and initialize query list. */
36
for (x= 0; x < SIMPLE_MULTI_COUNT; x++)
40
if (drizzle_con_create(&drizzle, &(con[0])) == NULL)
42
printf("drizzle_con_create:%s\n", drizzle_error(&drizzle));
46
if (argc == 2 && !strcmp(argv[1], "-m"))
47
drizzle_con_add_options(&(con[0]), DRIZZLE_CON_MYSQL);
50
printf("usage: %s [-m]\n", argv[0]);
54
drizzle_con_set_db(&(con[0]), "information_schema");
58
if (drizzle_con_clone(&drizzle, &(con[x]), &(con[0])) == NULL)
60
printf("drizzle_con_clone:%s\n", drizzle_error(&drizzle));
65
if (drizzle_query_add(&drizzle, &(ql[x]), &(con[x]), &(result[x]), query,
66
strlen(query), 0, NULL) == NULL)
68
printf("drizzle_query_add:%s\n", drizzle_error(&drizzle));
73
ret= drizzle_query_run_all(&drizzle);
74
if (ret != DRIZZLE_RETURN_OK)
76
printf("drizzle_query_run_all:%s\n", drizzle_error(&drizzle));
80
for (x= 0; x < SIMPLE_MULTI_COUNT; x++)
82
if (drizzle_result_error_code(&(result[x])) != 0)
84
printf("%d:%s\n", drizzle_result_error_code(&(result[x])),
85
drizzle_result_error(&(result[x])));
89
while ((row= drizzle_row_next(&(result[x]))) != NULL)
90
printf("%d %s:%s\n", x, row[0], row[1]);
93
drizzle_free(&drizzle);