#include #include #include #pragma comment(lib, "Ws2_32.lib") #include "mysql.h" #include static my_bool opt_help=0; static char *opt_user="root"; char *opt_password=""; char *opt_socket="MYSQL"; static unsigned long opt_num_connections=1000; static struct my_option my_long_options[]= { {"help", '?', "Display this help and exit", (uchar **) &opt_help, (uchar **) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"user", 'u', "Username for login", &opt_user, &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p',"Password to use when connecting to server", &opt_password, &opt_password, 0, GET_STR, REQUIRED_ARG,0, 0, 0, 0, 0, 0}, {"shared-memory-base-name", 'S',"Shared memory base name", &opt_socket, &opt_socket, 0, GET_STR, REQUIRED_ARG,0, 0, 0, 0, 0, 0}, {"num-connections", 'n', "Number of consecutive connections to open/close", &opt_num_connections,&opt_num_connections, 0, GET_UINT, REQUIRED_ARG, 1000, 1,4294967295, 0, 0, 0}, {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; int main(int argc,char* argv[]) { MYSQL *dbc=NULL; MYSQL_RES *r; unsigned int err=0,i=0; err= handle_options(&argc, &argv, my_long_options, NULL); if (err) { printf("handle_options returned error\n"); return err; } if (opt_help) { my_print_help(my_long_options); return 1; } if(mysql_library_init(0,NULL,NULL)) { printf("mysql_library_init() failed\n"); return 1; } printf("about to make %lu connections using shared memory, watch for errors!\n\n",opt_num_connections); for(i=0;i