Merge lp:~vjsamuel/drizzle/refactor-drizzleslap into lp:~drizzle-trunk/drizzle/development

Proposed by Monty Taylor
Status: Merged
Merged at revision: 1581
Proposed branch: lp:~vjsamuel/drizzle/refactor-drizzleslap
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 1208 lines (+380/-411)
4 files modified
client/drizzleslap.cc (+363/-406)
client/include.am (+12/-2)
m4/pandora_warnings.m4 (+4/-2)
tests/t/drizzleslap.test (+1/-1)
To merge this branch: bzr merge lp:~vjsamuel/drizzle/refactor-drizzleslap
Reviewer Review Type Date Requested Status
Monty Taylor Pending
Brian Aker Pending
Review via email: mp+26641@code.launchpad.net

This proposal supersedes a proposal from 2010-06-02.

To post a comment you must log in.
Revision history for this message
Brian Aker (brianaker) wrote : Posted in a previous version of this proposal

Quick note, please remove the commented out code.

Thanks!

review: Needs Fixing
Revision history for this message
Monty Taylor (mordred) wrote : Posted in a previous version of this proposal

Re-merge this with trunk now - the code you need for modern boost and forcing gcc44 where possible is in trunk now. (Find us if you need help with doing the merge)

review: Needs Fixing
Revision history for this message
Brian Aker (brianaker) wrote : Posted in a previous version of this proposal

- ifstream system_slap_ifs(system_config_dir_slap);
+ ifstream system_slap_ifs(system_config_dir_slap.c_str());
   store(parse_config_file(system_slap_ifs, slap_options), vm);

   ifstream user_client_ifs("~/.drizzle/client.cnf");
   po::store(parse_config_file(user_client_ifs, client_options), vm);

- ifstream system_client_ifs(system_config_dir_client);
+ ifstream system_client_ifs(system_config_dir_client.c_str());

ifstream() takes a C-style string, not std::string.

Cheers,
   -Brian

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client/drizzleslap.cc'
2--- client/drizzleslap.cc 2010-04-07 14:15:05 +0000
3+++ client/drizzleslap.cc 2010-06-02 21:23:22 +0000
4@@ -70,11 +70,7 @@
5
6 */
7
8-#define SLAP_VERSION "1.5"
9-
10-#define HUGE_STRING_LENGTH 8196
11-#define RAND_STRING_SIZE 126
12-#define DEFAULT_BLOB_SIZE 1024
13+#include "config.h"
14
15 #include "client_priv.h"
16 #include <signal.h>
17@@ -86,18 +82,26 @@
18 #endif
19 #include <fcntl.h>
20 #include <math.h>
21-#include <ctype.h>
22 #include <cassert>
23 #include <cstdlib>
24 #include <string>
25-
26+#include <iostream>
27+#include <fstream>
28 #include <pthread.h>
29-
30+#include <drizzled/configmake.h>
31 /* Added this for string translation. */
32 #include <drizzled/gettext.h>
33+#include <boost/program_options.hpp>
34+
35+#define SLAP_VERSION "1.5"
36+
37+#define HUGE_STRING_LENGTH 8196
38+#define RAND_STRING_SIZE 126
39+#define DEFAULT_BLOB_SIZE 1024
40
41 using namespace std;
42 using namespace drizzled;
43+namespace po= boost::program_options;
44
45 #ifdef HAVE_SMEM
46 static char *shared_memory_base_name=0;
47@@ -116,48 +120,51 @@
48 pthread_mutex_t timer_alarm_mutex;
49 pthread_cond_t timer_alarm_threshold;
50
51-static char **defaults_argv;
52-
53 char **primary_keys;
54 /* This gets passed to malloc, so lets set it to an arch-dependant size */
55 size_t primary_keys_number_of;
56
57-static char *host= NULL, *opt_password= NULL, *user= NULL,
58- *user_supplied_query= NULL,
59- *user_supplied_pre_statements= NULL,
60- *user_supplied_post_statements= NULL,
61- *default_engine= NULL,
62- *pre_system= NULL,
63- *post_system= NULL;
64-
65-const char *delimiter= "\n";
66-
67-const char *create_schema_string= "drizzleslap";
68-
69-static bool opt_mysql= false;
70+static string host,
71+ opt_password,
72+ user,
73+ user_supplied_query,
74+ user_supplied_pre_statements,
75+ user_supplied_post_statements,
76+ default_engine,
77+ pre_system,
78+ post_system;
79+
80+static vector<string> user_supplied_queries;
81+static string opt_verbose;
82+string delimiter;
83+
84+string create_schema_string;
85+
86+static bool opt_mysql;
87 static bool opt_preserve= true;
88-static bool opt_only_print= false;
89-static bool opt_burnin= false;
90+static bool opt_only_print;
91+static bool opt_burnin;
92 static bool opt_ignore_sql_errors= false;
93 static bool tty_password= false,
94- opt_silent= false,
95- auto_generate_sql_autoincrement= false,
96- auto_generate_sql_guid_primary= false,
97- auto_generate_sql= false;
98-const char *opt_auto_generate_sql_type= "mixed";
99+ opt_silent,
100+ auto_generate_sql_autoincrement,
101+ auto_generate_sql_guid_primary,
102+ auto_generate_sql;
103+std::string opt_auto_generate_sql_type;
104
105-static int verbose, delimiter_length;
106+static int32_t verbose= 0;
107+static uint32_t delimiter_length;
108 static uint32_t commit_rate;
109 static uint32_t detach_rate;
110 static uint32_t opt_timer_length;
111 static uint32_t opt_delayed_start;
112-const char *num_int_cols_opt;
113-const char *num_char_cols_opt;
114-const char *num_blob_cols_opt;
115-const char *opt_label;
116+string num_blob_cols_opt,
117+ num_char_cols_opt,
118+ num_int_cols_opt;
119+string opt_label;
120 static unsigned int opt_set_random_seed;
121
122-const char *auto_generate_selected_columns_opt;
123+string auto_generate_selected_columns_opt;
124
125 /* Yes, we do set defaults here */
126 static unsigned int num_int_cols= 1;
127@@ -167,26 +174,25 @@
128 static unsigned int num_blob_cols_size_min;
129 static unsigned int num_int_cols_index= 0;
130 static unsigned int num_char_cols_index= 0;
131-static unsigned int iterations;
132+static uint32_t iterations;
133 static uint64_t actual_queries= 0;
134 static uint64_t auto_actual_queries;
135 static uint64_t auto_generate_sql_unique_write_number;
136 static uint64_t auto_generate_sql_unique_query_number;
137-static unsigned int auto_generate_sql_secondary_indexes;
138+static uint32_t auto_generate_sql_secondary_indexes;
139 static uint64_t num_of_query;
140 static uint64_t auto_generate_sql_number;
141-const char *concurrency_str= NULL;
142-static char *create_string;
143+string concurrency_str;
144+string create_string;
145 uint32_t *concurrency;
146
147 const char *default_dbug_option= "d:t:o,/tmp/drizzleslap.trace";
148-const char *opt_csv_str;
149+std::string opt_csv_str;
150 int csv_file;
151
152-static int get_options(int *argc,char ***argv);
153+static int process_options(void);
154 static uint32_t opt_drizzle_port= 0;
155
156-static const char *load_default_groups[]= { "drizzleslap","client",0 };
157
158 /* Types */
159 typedef enum {
160@@ -821,23 +827,248 @@
161 return s + us;
162 }
163
164+static void combine_queries(vector<string> queries)
165+{
166+ user_supplied_query.erase();
167+ for (vector<string>::iterator it= queries.begin();
168+ it != queries.end();
169+ ++it)
170+ {
171+ user_supplied_query.append(*it);
172+ user_supplied_query.append(delimiter);
173+ }
174+}
175+/**
176+ * commandline_options is the set of all options that can only be called via the command line.
177+
178+ * client_options is the set of all options that can be defined via both command line and via
179+ * the configuration file client.cnf
180+
181+ * slap_options is the set of all drizzleslap specific options which behave in a manner
182+ * similar to that of client_options. It's configuration file is drizzleslap.cnf
183+
184+ * long_options is the union of commandline_options, slap_options and client_options.
185+
186+ * There are two configuration files per set of options, one which is defined by the user and
187+ * which is found at ~/.drizzle directory and the other which is the system configuration
188+ * file which is found in the SYSCONFDIR/drizzle directory.
189+
190+ * The system configuration file is over ridden by the user's configuration file which
191+ * in turn is over ridden by the command line.
192+ */
193 int main(int argc, char **argv)
194 {
195+ char *password= NULL;
196+ try
197+ {
198+ po::options_description commandline_options("Options used only in command line");
199+ commandline_options.add_options()
200+ ("help,?","Display this help and exit")
201+ ("info,i","Gives information and exit")
202+ ("burnin",po::value<bool>(&opt_burnin)->default_value(false)->zero_tokens(),
203+ "Run full test case in infinite loop")
204+ ("ignore-sql-errors", po::value<bool>(&opt_ignore_sql_errors)->default_value(false)->zero_tokens(),
205+ "Ignore SQL errors in query run")
206+ ("create-schema",po::value<string>(&create_schema_string)->default_value("drizzleslap"),
207+ "Schema to run tests in")
208+ ("create",po::value<string>(&create_string)->default_value(""),
209+ "File or string to use to create tables")
210+ ("detach",po::value<uint32_t>(&detach_rate)->default_value(0),
211+ "Detach (close and re open) connections after X number of requests")
212+ ("iterations,i",po::value<uint32_t>(&iterations)->default_value(1),
213+ "Number of times to run the tests")
214+ ("label",po::value<string>(&opt_label)->default_value(""),
215+ "Label to use for print and csv")
216+ ("number-blob-cols",po::value<string>(&num_blob_cols_opt)->default_value(""),
217+ "Number of BLOB columns to create table with if specifying --auto-generate-sql. Example --number-blob-cols=3:1024/2048 would give you 3 blobs with a random size between 1024 and 2048. ")
218+ ("number-char-cols,x",po::value<string>(&num_char_cols_opt)->default_value(""),
219+ "Number of VARCHAR columns to create in table if specifying --auto-generate-sql.")
220+ ("number-int-cols,y",po::value<string>(&num_int_cols_opt)->default_value(""),
221+ "Number of INT columns to create in table if specifying --auto-generate-sql.")
222+ ("number-of-queries",
223+ po::value<uint64_t>(&num_of_query)->default_value(0),
224+ "Limit each client to this number of queries(this is not exact)")
225+ ("only-print",po::value<bool>(&opt_only_print)->default_value(false)->zero_tokens(),
226+ "This causes drizzleslap to not connect to the database instead print out what it would have done instead")
227+ ("post-query", po::value<string>(&user_supplied_post_statements)->default_value(""),
228+ "Query to run or file containing query to execute after tests have completed.")
229+ ("post-system",po::value<string>(&post_system)->default_value(""),
230+ "system() string to execute after tests have completed")
231+ ("pre-query",
232+ po::value<string>(&user_supplied_pre_statements)->default_value(""),
233+ "Query to run or file containing query to execute before running tests.")
234+ ("pre-system",po::value<string>(&pre_system)->default_value(""),
235+ "system() string to execute before running tests.")
236+ ("query,q",po::value<vector<string> >(&user_supplied_queries)->composing()->notifier(&combine_queries),
237+ "Query to run or file containing query")
238+ ("verbose,v", po::value<string>(&opt_verbose)->default_value("v"), "Increase verbosity level by one.")
239+ ("version,V","Output version information and exit")
240+ ;
241+
242+ po::options_description slap_options("Options specific to drizzleslap");
243+ slap_options.add_options()
244+ ("auto-generate-sql-select-columns",
245+ po::value<string>(&auto_generate_selected_columns_opt)->default_value(""),
246+ "Provide a string to use for the select fields used in auto tests")
247+ ("auto-generate-sql,a",po::value<bool>(&auto_generate_sql)->default_value(false)->zero_tokens(),
248+ "Generate SQL where not supplied by file or command line")
249+ ("auto-generate-sql-add-autoincrement",
250+ po::value<bool>(&auto_generate_sql_autoincrement)->default_value(false)->zero_tokens(),
251+ "Add an AUTO_INCREMENT column to auto-generated tables")
252+ ("auto-generate-sql-execute-number",
253+ po::value<uint64_t>(&auto_actual_queries)->default_value(0),
254+ "See this number and generate a set of queries to run")
255+ ("auto-generate-sql-guid-primary",
256+ po::value<bool>(&auto_generate_sql_guid_primary)->default_value(false)->zero_tokens(),
257+ "Add GUID based primary keys to auto-generated tables")
258+ ("auto-generate-sql-load-type",
259+ po::value<string>(&opt_auto_generate_sql_type)->default_value("mixed"),
260+ "Specify test load type: mixed, update, write, key or read; default is mixed")
261+ ("auto-generate-sql-secondary-indexes",
262+ po::value<uint32_t>(&auto_generate_sql_secondary_indexes)->default_value(0),
263+ "Number of secondary indexes to add to auto-generated tables")
264+ ("auto-generated-sql-unique-query-number",
265+ po::value<uint64_t>(&auto_generate_sql_unique_query_number)->default_value(10),
266+ "Number of unique queries to generate for automatic tests")
267+ ("auto-generate-sql-unique-write-number",
268+ po::value<uint64_t>(&auto_generate_sql_unique_write_number)->default_value(10),
269+ "Number of unique queries to generate for auto-generate-sql-write-number")
270+ ("auto-generate-sql-write-number",
271+ po::value<uint64_t>(&auto_generate_sql_number)->default_value(100),
272+ "Number of row inserts to perform for each thread (default is 100).")
273+ ("commit",po::value<uint32_t>(&commit_rate)->default_value(0),
274+ "Commit records every X number of statements")
275+ ("concurrency,c",po::value<string>(&concurrency_str)->default_value(""),
276+ "Number of clients to simulate for query to run")
277+ ("csv",po::value<std::string>(&opt_csv_str)->default_value(""),
278+ "Generate CSV output to named file or to stdout if no file is name.")
279+ ("delayed-start",po::value<uint32_t>(&opt_delayed_start)->default_value(0),
280+ "Delay the startup of threads by a random number of microsends (the maximum of the delay")
281+ ("delimiter,F",po::value<string>(&delimiter)->default_value("\n"),
282+ "Delimiter to use in SQL statements supplied in file or command line")
283+ ("engine ,e",po::value<string>(&default_engine)->default_value(""),
284+ "Storage engien to use for creating the table")
285+ ("set-random-seed",
286+ po::value<uint32_t>(&opt_set_random_seed)->default_value(0),
287+ "Seed for random number generator (srandom(3)) ")
288+ ("silent,s",po::value<bool>(&opt_silent)->default_value(false)->zero_tokens(),
289+ "Run program in silent mode - no output. ")
290+ ("timer-length",po::value<uint32_t>(&opt_timer_length)->default_value(0),
291+ "Require drizzleslap to run each specific test a certain amount of time in seconds")
292+ ;
293+
294+ po::options_description client_options("Options specific to the client");
295+ client_options.add_options()
296+ ("mysql,m", po::value<bool>(&opt_mysql)->default_value(true)->zero_tokens(),
297+ N_("Use MySQL Protocol."))
298+ ("host,h",po::value<string>(&host)->default_value("localhost"),"Connect to the host")
299+ ("password,P",po::value<char *>(&password),
300+ "Password to use when connecting to server. If password is not given it's asked from the tty")
301+ ("port,p",po::value<uint32_t>(), "Port number to use for connection")
302+ ("protocol",po::value<string>(),
303+ "The protocol of connection (tcp,socket,pipe,memory).")
304+ ("user,u",po::value<string>(&user)->default_value(""),
305+ "User for login if not current user")
306+ ;
307+
308+ po::options_description long_options("Allowed Options");
309+ long_options.add(commandline_options).add(slap_options).add(client_options);
310+
311+ std::string system_config_dir_slap(SYSCONFDIR);
312+ system_config_dir_slap.append("/drizzle/drizzleslap.cnf");
313+
314+ std::string system_config_dir_client(SYSCONFDIR);
315+ system_config_dir_client.append("/drizzle/client.cnf");
316+
317+ uint64_t temp_drizzle_port= 0;
318 drizzle_con_st con;
319 OptionString *eptr;
320- unsigned int x;
321-
322- internal::my_init();
323-
324- MY_INIT(argv[0]);
325-
326- internal::load_defaults("drizzle",load_default_groups,&argc,&argv);
327- defaults_argv=argv;
328- if (get_options(&argc,&argv))
329- {
330- internal::free_defaults(defaults_argv);
331- internal::my_end();
332+ uint32_t x;
333+
334+
335+ po::variables_map vm;
336+ po::store(po::parse_command_line(argc,argv,long_options),vm);
337+
338+ ifstream user_slap_ifs("~/.drizzle/drizzleslap.cnf");
339+ po::store(parse_config_file(user_slap_ifs, slap_options), vm);
340+
341+ ifstream system_slap_ifs(system_config_dir_slap.c_str());
342+ store(parse_config_file(system_slap_ifs, slap_options), vm);
343+
344+ ifstream user_client_ifs("~/.drizzle/client.cnf");
345+ po::store(parse_config_file(user_client_ifs, client_options), vm);
346+
347+ ifstream system_client_ifs(system_config_dir_client.c_str());
348+ store(parse_config_file(system_client_ifs, client_options), vm);
349+
350+ po::notify(vm);
351+
352+ if (process_options())
353 exit(1);
354+
355+ if( vm.count("help") || vm.count("info"))
356+ {
357+ printf("%s Ver %s Distrib %s, for %s-%s (%s)\n",internal::my_progname, SLAP_VERSION,
358+ drizzle_version(),HOST_VENDOR,HOST_OS,HOST_CPU);
359+ puts("Copyright (C) 2008 Sun Microsystems");
360+ puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\
361+ \nand you are welcome to modify and redistribute it under the GPL \
362+ license\n");
363+ puts("Run a query multiple times against the server\n");
364+ cout<<long_options<<endl;
365+ exit(0);
366+ }
367+
368+ if(vm.count("port"))
369+ {
370+ temp_drizzle_port= vm["port"].as<uint32_t>();
371+
372+ if ((temp_drizzle_port == 0) || (temp_drizzle_port > 65535))
373+ {
374+ fprintf(stderr, _("Value supplied for port is not valid.\n"));
375+ exit(1);
376+ }
377+ else
378+ {
379+ opt_drizzle_port= (uint32_t) temp_drizzle_port;
380+ }
381+ }
382+
383+ if( vm.count("password") )
384+ {
385+ char *start= vm["password"].as<char *>();
386+ if (!opt_password.empty())
387+ opt_password.erase();
388+ opt_password = strdup(vm["password"].as<char *>());
389+ if (opt_password.c_str() == NULL)
390+ {
391+ fprintf(stderr, "Memory allocation error while copying password. "
392+ "Aborting.\n");
393+ exit(ENOMEM);
394+ }
395+
396+ while (*password)
397+ {
398+ /* Overwriting password with 'x' */
399+ *password++= 'x';
400+ }
401+
402+ if (*start)
403+ {
404+ /* Cut length of argument */
405+ start[1]= 0;
406+ }
407+ tty_password= 0;
408+ }
409+ else
410+ tty_password= 1;
411+
412+
413+ if( vm.count("version") )
414+ {
415+ printf("%s Ver %s Distrib %s, for %s-%s (%s)\n",internal::my_progname, SLAP_VERSION,
416+ drizzle_version(),HOST_VENDOR,HOST_OS,HOST_CPU);
417+ exit(0);
418 }
419
420 /* Seed the random number generator if we will be using it. */
421@@ -849,15 +1080,7 @@
422 }
423
424 /* globals? Yes, so we only have to run strlen once */
425- delimiter_length= strlen(delimiter);
426-
427- if (argc > 2)
428- {
429- fprintf(stderr,"%s: Too many arguments\n",internal::my_progname);
430- internal::free_defaults(defaults_argv);
431- internal::my_end();
432- exit(1);
433- }
434+ delimiter_length= delimiter.length();
435
436 slap_connect(&con, false);
437
438@@ -895,7 +1118,7 @@
439 }
440
441 if (!opt_preserve)
442- drop_schema(&con, create_schema_string);
443+ drop_schema(&con, create_schema_string.c_str());
444
445 } while (eptr ? (eptr= eptr->getNext()) : 0);
446
447@@ -912,8 +1135,8 @@
448 slap_close(&con);
449
450 /* now free all the strings we created */
451- if (opt_password)
452- free(opt_password);
453+ if (!opt_password.empty())
454+ opt_password.erase();
455
456 free(concurrency);
457
458@@ -930,9 +1153,13 @@
459 if (shared_memory_base_name)
460 free(shared_memory_base_name);
461 #endif
462- internal::free_defaults(defaults_argv);
463- internal::my_end();
464-
465+
466+ }
467+
468+ catch(exception &err)
469+ {
470+ cerr<<"Error:"<<err.what()<<endl;
471+ }
472 return 0;
473 }
474
475@@ -969,11 +1196,11 @@
476 data in the table.
477 */
478 if (opt_preserve == false)
479- drop_schema(con, create_schema_string);
480+ drop_schema(con, create_schema_string.c_str());
481
482 /* First we create */
483 if (create_statements)
484- create_schema(con, create_schema_string, create_statements, eptr, sptr);
485+ create_schema(con, create_schema_string.c_str(), create_statements, eptr, sptr);
486
487 /*
488 If we generated GUID we need to build a list of them from creation that
489@@ -987,9 +1214,9 @@
490 if (commit_rate)
491 run_query(con, NULL, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
492
493- if (pre_system)
494+ if (!pre_system.empty())
495 {
496- int ret= system(pre_system);
497+ int ret= system(pre_system.c_str());
498 assert(ret != -1);
499 }
500
501@@ -1006,9 +1233,9 @@
502 if (post_statements)
503 run_statements(con, post_statements);
504
505- if (post_system)
506+ if (!post_system.empty())
507 {
508- int ret= system(post_system);
509+ int ret= system(post_system.c_str());
510 assert(ret !=-1);
511 }
512
513@@ -1024,7 +1251,7 @@
514
515 if (!opt_silent)
516 print_conclusions(&conclusion);
517- if (opt_csv_str)
518+ if (!opt_csv_str.empty())
519 print_conclusions_csv(&conclusion);
520
521 free(head_sptr);
522@@ -1032,274 +1259,6 @@
523 }
524
525
526-static struct option my_long_options[] =
527-{
528- {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
529- 0, 0, 0, 0, 0, 0},
530- {"auto-generate-sql-select-columns", OPT_SLAP_AUTO_GENERATE_SELECT_COLUMNS,
531- "Provide a string to use for the select fields used in auto tests.",
532- (char**) &auto_generate_selected_columns_opt,
533- (char**) &auto_generate_selected_columns_opt,
534- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
535- {"auto-generate-sql", 'a',
536- "Generate SQL where not supplied by file or command line.",
537- (char**) &auto_generate_sql, (char**) &auto_generate_sql,
538- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
539- {"auto-generate-sql-add-autoincrement", OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
540- "Add an AUTO_INCREMENT column to auto-generated tables.",
541- (char**) &auto_generate_sql_autoincrement,
542- (char**) &auto_generate_sql_autoincrement,
543- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
544- {"auto-generate-sql-execute-number", OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES,
545- "Set this number to generate a set number of queries to run.",
546- (char**) &auto_actual_queries, (char**) &auto_actual_queries,
547- 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
548- {"auto-generate-sql-guid-primary", OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY,
549- "Add GUID based primary keys to auto-generated tables.",
550- (char**) &auto_generate_sql_guid_primary,
551- (char**) &auto_generate_sql_guid_primary,
552- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
553- {"auto-generate-sql-load-type", OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE,
554- "Specify test load type: mixed, update, write, key, or read; default is mixed.",
555- (char**) &opt_auto_generate_sql_type, (char**) &opt_auto_generate_sql_type,
556- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
557- {"auto-generate-sql-secondary-indexes",
558- OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES,
559- "Number of secondary indexes to add to auto-generated tables.",
560- (char**) &auto_generate_sql_secondary_indexes,
561- (char**) &auto_generate_sql_secondary_indexes, 0,
562- GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
563- {"auto-generate-sql-unique-query-number",
564- OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM,
565- "Number of unique queries to generate for automatic tests.",
566- (char**) &auto_generate_sql_unique_query_number,
567- (char**) &auto_generate_sql_unique_query_number,
568- 0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
569- {"auto-generate-sql-unique-write-number",
570- OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM,
571- "Number of unique queries to generate for auto-generate-sql-write-number.",
572- (char**) &auto_generate_sql_unique_write_number,
573- (char**) &auto_generate_sql_unique_write_number,
574- 0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
575- {"auto-generate-sql-write-number", OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
576- "Number of row inserts to perform for each thread (default is 100).",
577- (char**) &auto_generate_sql_number, (char**) &auto_generate_sql_number,
578- 0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0},
579- {"burnin", OPT_SLAP_BURNIN, "Run full test case in infinite loop.",
580- (char**) &opt_burnin, (char**) &opt_burnin, 0, GET_BOOL, NO_ARG, 0, 0, 0,
581- 0, 0, 0},
582- {"ignore-sql-errors", OPT_SLAP_IGNORE_SQL_ERRORS,
583- "Ignore SQL erros in query run.",
584- (char**) &opt_ignore_sql_errors,
585- (char**) &opt_ignore_sql_errors,
586- 0, GET_BOOL, NO_ARG, 0, 0, 0,
587- 0, 0, 0},
588- {"commit", OPT_SLAP_COMMIT, "Commit records every X number of statements.",
589- (char**) &commit_rate, (char**) &commit_rate, 0, GET_UINT, REQUIRED_ARG,
590- 0, 0, 0, 0, 0, 0},
591- {"concurrency", 'c', "Number of clients to simulate for query to run.",
592- (char**) &concurrency_str, (char**) &concurrency_str, 0, GET_STR,
593- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
594- {"create", OPT_SLAP_CREATE_STRING, "File or string to use create tables.",
595- (char**) &create_string, (char**) &create_string, 0, GET_STR, REQUIRED_ARG,
596- 0, 0, 0, 0, 0, 0},
597- {"create-schema", OPT_CREATE_SLAP_SCHEMA, "Schema to run tests in.",
598- (char**) &create_schema_string, (char**) &create_schema_string, 0, GET_STR,
599- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
600- {"csv", OPT_SLAP_CSV,
601- "Generate CSV output to named file or to stdout if no file is named.",
602- (char**) &opt_csv_str, (char**) &opt_csv_str, 0, GET_STR,
603- OPT_ARG, 0, 0, 0, 0, 0, 0},
604- {"delayed-start", OPT_SLAP_DELAYED_START,
605- "Delay the startup of threads by a random number of microsends (the maximum of the delay)",
606- (char**) &opt_delayed_start, (char**) &opt_delayed_start, 0, GET_UINT,
607- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
608- {"delimiter", 'F',
609- "Delimiter to use in SQL statements supplied in file or command line.",
610- (char**) &delimiter, (char**) &delimiter, 0, GET_STR, REQUIRED_ARG,
611- 0, 0, 0, 0, 0, 0},
612- {"detach", OPT_SLAP_DETACH,
613- "Detach (close and reopen) connections after X number of requests.",
614- (char**) &detach_rate, (char**) &detach_rate, 0, GET_UINT, REQUIRED_ARG,
615- 0, 0, 0, 0, 0, 0},
616- {"engine", 'e', "Storage engine to use for creating the table.",
617- (char**) &default_engine, (char**) &default_engine, 0,
618- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
619- {"host", 'h', "Connect to host.", (char**) &host, (char**) &host, 0, GET_STR,
620- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
621- {"iterations", 'i', "Number of times to run the tests.", (char**) &iterations,
622- (char**) &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
623- {"label", OPT_SLAP_LABEL, "Label to use for print and csv output.",
624- (char**) &opt_label, (char**) &opt_label, 0,
625- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
626- {"mysql", 'm', N_("Use MySQL Protocol."),
627- (char**) &opt_mysql, (char**) &opt_mysql, 0, GET_BOOL, NO_ARG, 1, 0, 0,
628- 0, 0, 0},
629- {"number-blob-cols", OPT_SLAP_BLOB_COL,
630- "Number of BLOB columns to create table with if specifying --auto-generate-sql. Example --number-blob-cols=3:1024/2048 would give you 3 blobs with a random size between 1024 and 2048. ",
631- (char**) &num_blob_cols_opt, (char**) &num_blob_cols_opt, 0, GET_STR, REQUIRED_ARG,
632- 0, 0, 0, 0, 0, 0},
633- {"number-char-cols", 'x',
634- "Number of VARCHAR columns to create in table if specifying --auto-generate-sql.",
635- (char**) &num_char_cols_opt, (char**) &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG,
636- 0, 0, 0, 0, 0, 0},
637- {"number-int-cols", 'y',
638- "Number of INT columns to create in table if specifying --auto-generate-sql.",
639- (char**) &num_int_cols_opt, (char**) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG,
640- 0, 0, 0, 0, 0, 0},
641- {"number-of-queries", OPT_DRIZZLE_NUMBER_OF_QUERY,
642- "Limit each client to this number of queries (this is not exact).",
643- (char**) &num_of_query, (char**) &num_of_query, 0,
644- GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
645- {"only-print", OPT_DRIZZLE_ONLY_PRINT,
646- "This causes drizzleslap to not connect to the databases, but instead print "
647- "out what it would have done instead.",
648- (char**) &opt_only_print, (char**) &opt_only_print, 0, GET_BOOL, NO_ARG,
649- 0, 0, 0, 0, 0, 0},
650- {"password", 'P',
651- "Password to use when connecting to server. If password is not given it's "
652- "asked from the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
653- {"port", 'p', "Port number to use for connection.",
654- 0, 0, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
655- {"post-query", OPT_SLAP_POST_QUERY,
656- "Query to run or file containing query to execute after tests have completed.",
657- (char**) &user_supplied_post_statements,
658- (char**) &user_supplied_post_statements,
659- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
660- {"post-system", OPT_SLAP_POST_SYSTEM,
661- "system() string to execute after tests have completed.",
662- (char**) &post_system,
663- (char**) &post_system,
664- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
665- {"pre-query", OPT_SLAP_PRE_QUERY,
666- "Query to run or file containing query to execute before running tests.",
667- (char**) &user_supplied_pre_statements,
668- (char**) &user_supplied_pre_statements,
669- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
670- {"pre-system", OPT_SLAP_PRE_SYSTEM,
671- "system() string to execute before running tests.",
672- (char**) &pre_system,
673- (char**) &pre_system,
674- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
675- {"protocol", OPT_DRIZZLE_PROTOCOL,
676- "The protocol of connection (tcp,socket,pipe,memory).",
677- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
678- {"query", 'q', "Query to run or file containing query to run.",
679- (char**) &user_supplied_query, (char**) &user_supplied_query,
680- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
681- {"set-random-seed", OPT_SLAP_SET_RANDOM_SEED,
682- "Seed for random number generator (srandom(3))",
683- (char**)&opt_set_random_seed,
684- (char**)&opt_set_random_seed,0,
685- GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
686- {"silent", 's', "Run program in silent mode - no output.",
687- (char**) &opt_silent, (char**) &opt_silent, 0, GET_BOOL, NO_ARG,
688- 0, 0, 0, 0, 0, 0},
689- {"timer-length", OPT_SLAP_TIMER_LENGTH,
690- "Require drizzleslap to run each specific test a certain amount of time in seconds.",
691- (char**) &opt_timer_length, (char**) &opt_timer_length, 0, GET_UINT,
692- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
693- {"user", 'u', "User for login if not current user.", (char**) &user,
694- (char**) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
695- {"verbose", 'v',
696- "More verbose output; you can use this multiple times to get even more "
697- "verbose output.", (char**) &verbose, (char**) &verbose, 0,
698- GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
699- {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
700- NO_ARG, 0, 0, 0, 0, 0, 0},
701- {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
702-};
703-
704-
705-static void print_version(void)
706-{
707- printf("%s Ver %s Distrib %s, for %s-%s (%s)\n",internal::my_progname, SLAP_VERSION,
708- drizzle_version(),HOST_VENDOR,HOST_OS,HOST_CPU);
709-}
710-
711-
712-static void usage(void)
713-{
714- print_version();
715- puts("Copyright (C) 2008 Sun Microsystems");
716- puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\
717- \nand you are welcome to modify and redistribute it under the GPL \
718- license\n");
719- puts("Run a query multiple times against the server\n");
720- printf("Usage: %s [OPTIONS]\n",internal::my_progname);
721- internal::print_defaults("drizzle",load_default_groups);
722- my_print_help(my_long_options);
723-}
724-
725-static int get_one_option(int optid, const struct option *, char *argument)
726-{
727- char *endchar= NULL;
728- uint64_t temp_drizzle_port= 0;
729-
730- switch(optid) {
731- case 'v':
732- verbose++;
733- break;
734- case 'p':
735- temp_drizzle_port= (uint64_t) strtoul(argument, &endchar, 10);
736- /* if there is an alpha character this is not a valid port */
737- if (strlen(endchar) != 0)
738- {
739- fprintf(stderr, _("Non-integer value supplied for port. If you are trying to enter a password please use --password instead.\n"));
740- exit(1);
741- }
742- /* If the port number is > 65535 it is not a valid port
743- This also helps with potential data loss casting unsigned long to a
744- uint32_t. */
745- if ((temp_drizzle_port == 0) || (temp_drizzle_port > 65535))
746- {
747- fprintf(stderr, _("Value supplied for port is not valid.\n"));
748- exit(1);
749- }
750- else
751- {
752- opt_drizzle_port= (uint32_t) temp_drizzle_port;
753- }
754- break;
755- case 'P':
756- if (argument)
757- {
758- char *start= argument;
759- if (opt_password)
760- free(opt_password);
761- opt_password = strdup(argument);
762- if (opt_password == NULL)
763- {
764- fprintf(stderr, "Memory allocation error while copying password. "
765- "Aborting.\n");
766- exit(ENOMEM);
767- }
768- while (*argument)
769- {
770- /* Overwriting password with 'x' */
771- *argument++= 'x';
772- }
773- if (*start)
774- {
775- /* Cut length of argument */
776- start[1]= 0;
777- }
778- tty_password= 0;
779- }
780- else
781- tty_password= 1;
782- break;
783- case 'V':
784- print_version();
785- exit(0);
786- case '?':
787- case 'I': /* Info */
788- usage();
789- exit(0);
790- }
791- return(0);
792-}
793-
794
795 uint
796 get_random_string(char *buf, size_t size)
797@@ -1698,9 +1657,9 @@
798 query_string.reserve(HUGE_STRING_LENGTH);
799
800 query_string.append("SELECT ", 7);
801- if (auto_generate_selected_columns_opt)
802+ if (!auto_generate_selected_columns_opt.empty())
803 {
804- query_string.append(auto_generate_selected_columns_opt);
805+ query_string.append(auto_generate_selected_columns_opt.c_str());
806 }
807 else
808 {
809@@ -1777,27 +1736,24 @@
810 }
811
812 static int
813-get_options(int *argc,char ***argv)
814+process_options(void)
815 {
816- int ho_error;
817 char *tmp_string;
818 struct stat sbuf;
819 OptionString *sql_type;
820 unsigned int sql_type_count= 0;
821 ssize_t bytes_read= 0;
822-
823-
824- if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
825- exit(ho_error);
826-
827- if (!user)
828- user= (char *)"root";
829+
830+ if (user.empty())
831+ user= "root";
832+
833+ verbose= opt_verbose.length();
834
835 /* If something is created we clean it up, otherwise we leave schemas alone */
836- if (create_string || auto_generate_sql)
837+ if ( (!create_string.empty()) || auto_generate_sql)
838 opt_preserve= false;
839
840- if (auto_generate_sql && (create_string || user_supplied_query))
841+ if (auto_generate_sql && (!create_string.empty() || !user_supplied_query.empty()))
842 {
843 fprintf(stderr,
844 "%s: Can't use --auto-generate-sql when create and query strings are specified!\n",
845@@ -1822,9 +1778,9 @@
846 exit(1);
847 }
848
849- parse_comma(concurrency_str ? concurrency_str : "1", &concurrency);
850+ parse_comma(!concurrency_str.empty() ? concurrency_str.c_str() : "1", &concurrency);
851
852- if (opt_csv_str)
853+ if (!opt_csv_str.empty())
854 {
855 opt_silent= true;
856
857@@ -1834,11 +1790,11 @@
858 }
859 else
860 {
861- if ((csv_file= open(opt_csv_str, O_CREAT|O_WRONLY|O_APPEND,
862+ if ((csv_file= open(opt_csv_str.c_str(), O_CREAT|O_WRONLY|O_APPEND,
863 S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) == -1)
864 {
865 fprintf(stderr,"%s: Could not open csv file: %sn\n",
866- internal::my_progname, opt_csv_str);
867+ internal::my_progname, opt_csv_str.c_str());
868 exit(1);
869 }
870 }
871@@ -1847,20 +1803,20 @@
872 if (opt_only_print)
873 opt_silent= true;
874
875- if (num_int_cols_opt)
876+ if (!num_int_cols_opt.empty())
877 {
878 OptionString *str;
879- parse_option(num_int_cols_opt, &str, ',');
880+ parse_option(num_int_cols_opt.c_str(), &str, ',');
881 num_int_cols= atoi(str->getString());
882 if (str->getOption())
883 num_int_cols_index= atoi(str->getOption());
884 option_cleanup(str);
885 }
886
887- if (num_char_cols_opt)
888+ if (!num_char_cols_opt.empty())
889 {
890 OptionString *str;
891- parse_option(num_char_cols_opt, &str, ',');
892+ parse_option(num_char_cols_opt.c_str(), &str, ',');
893 num_char_cols= atoi(str->getString());
894 if (str->getOption())
895 num_char_cols_index= atoi(str->getOption());
896@@ -1869,10 +1825,10 @@
897 option_cleanup(str);
898 }
899
900- if (num_blob_cols_opt)
901+ if (!num_blob_cols_opt.empty())
902 {
903 OptionString *str;
904- parse_option(num_blob_cols_opt, &str, ',');
905+ parse_option(num_blob_cols_opt.c_str(), &str, ',');
906 num_blob_cols= atoi(str->getString());
907 if (str->getOption())
908 {
909@@ -1919,11 +1875,11 @@
910 if (verbose >= 2)
911 printf("Building Query Statements for Auto\n");
912
913- if (!opt_auto_generate_sql_type)
914+ if (opt_auto_generate_sql_type.empty())
915 opt_auto_generate_sql_type= "mixed";
916
917 query_statements_count=
918- parse_option(opt_auto_generate_sql_type, &query_options, ',');
919+ parse_option(opt_auto_generate_sql_type.c_str(), &query_options, ',');
920
921 query_statements= (Statement **)malloc(sizeof(Statement *) * query_statements_count);
922 if (query_statements == NULL)
923@@ -2037,7 +1993,7 @@
924 }
925 else
926 {
927- if (create_string && !stat(create_string, &sbuf))
928+ if (!create_string.empty() && !stat(create_string.c_str(), &sbuf))
929 {
930 int data_file;
931 if (!S_ISREG(sbuf.st_mode))
932@@ -2046,7 +2002,7 @@
933 internal::my_progname);
934 exit(1);
935 }
936- if ((data_file= open(create_string, O_RDWR)) == -1)
937+ if ((data_file= open(create_string.c_str(), O_RDWR)) == -1)
938 {
939 fprintf(stderr,"%s: Could not open create file\n", internal::my_progname);
940 exit(1);
941@@ -2074,13 +2030,13 @@
942 parse_delimiter(tmp_string, &create_statements, delimiter[0]);
943 free(tmp_string);
944 }
945- else if (create_string)
946+ else if (!create_string.empty())
947 {
948- parse_delimiter(create_string, &create_statements, delimiter[0]);
949+ parse_delimiter(create_string.c_str(), &create_statements, delimiter[0]);
950 }
951
952 /* Set this up till we fully support options on user generated queries */
953- if (user_supplied_query)
954+ if (!user_supplied_query.empty())
955 {
956 query_statements_count=
957 parse_option("default", &query_options, ',');
958@@ -2094,7 +2050,7 @@
959 memset(query_statements, 0, sizeof(Statement *) * query_statements_count);
960 }
961
962- if (user_supplied_query && !stat(user_supplied_query, &sbuf))
963+ if (!user_supplied_query.empty() && !stat(user_supplied_query.c_str(), &sbuf))
964 {
965 int data_file;
966 if (!S_ISREG(sbuf.st_mode))
967@@ -2103,7 +2059,7 @@
968 internal::my_progname);
969 exit(1);
970 }
971- if ((data_file= open(user_supplied_query, O_RDWR)) == -1)
972+ if ((data_file= open(user_supplied_query.c_str(), O_RDWR)) == -1)
973 {
974 fprintf(stderr,"%s: Could not open query supplied file\n", internal::my_progname);
975 exit(1);
976@@ -2128,20 +2084,20 @@
977 {
978 fprintf(stderr, "Problem reading file: read less bytes than requested\n");
979 }
980- if (user_supplied_query)
981+ if (!user_supplied_query.empty())
982 actual_queries= parse_delimiter(tmp_string, &query_statements[0],
983 delimiter[0]);
984 free(tmp_string);
985 }
986- else if (user_supplied_query)
987+ else if (!user_supplied_query.empty())
988 {
989- actual_queries= parse_delimiter(user_supplied_query, &query_statements[0],
990+ actual_queries= parse_delimiter(user_supplied_query.c_str(), &query_statements[0],
991 delimiter[0]);
992 }
993 }
994
995- if (user_supplied_pre_statements
996- && !stat(user_supplied_pre_statements, &sbuf))
997+ if (!user_supplied_pre_statements.empty()
998+ && !stat(user_supplied_pre_statements.c_str(), &sbuf))
999 {
1000 int data_file;
1001 if (!S_ISREG(sbuf.st_mode))
1002@@ -2150,7 +2106,7 @@
1003 internal::my_progname);
1004 exit(1);
1005 }
1006- if ((data_file= open(user_supplied_pre_statements, O_RDWR)) == -1)
1007+ if ((data_file= open(user_supplied_pre_statements.c_str(), O_RDWR)) == -1)
1008 {
1009 fprintf(stderr,"%s: Could not open query supplied file\n", internal::my_progname);
1010 exit(1);
1011@@ -2175,20 +2131,20 @@
1012 {
1013 fprintf(stderr, "Problem reading file: read less bytes than requested\n");
1014 }
1015- if (user_supplied_pre_statements)
1016+ if (!user_supplied_pre_statements.empty())
1017 (void)parse_delimiter(tmp_string, &pre_statements,
1018 delimiter[0]);
1019 free(tmp_string);
1020 }
1021- else if (user_supplied_pre_statements)
1022+ else if (!user_supplied_pre_statements.empty())
1023 {
1024- (void)parse_delimiter(user_supplied_pre_statements,
1025+ (void)parse_delimiter(user_supplied_pre_statements.c_str(),
1026 &pre_statements,
1027 delimiter[0]);
1028 }
1029
1030- if (user_supplied_post_statements
1031- && !stat(user_supplied_post_statements, &sbuf))
1032+ if (!user_supplied_post_statements.empty()
1033+ && !stat(user_supplied_post_statements.c_str(), &sbuf))
1034 {
1035 int data_file;
1036 if (!S_ISREG(sbuf.st_mode))
1037@@ -2197,7 +2153,7 @@
1038 internal::my_progname);
1039 exit(1);
1040 }
1041- if ((data_file= open(user_supplied_post_statements, O_RDWR)) == -1)
1042+ if ((data_file= open(user_supplied_post_statements.c_str(), O_RDWR)) == -1)
1043 {
1044 fprintf(stderr,"%s: Could not open query supplied file\n", internal::my_progname);
1045 exit(1);
1046@@ -2224,22 +2180,22 @@
1047 {
1048 fprintf(stderr, "Problem reading file: read less bytes than requested\n");
1049 }
1050- if (user_supplied_post_statements)
1051+ if (!user_supplied_post_statements.empty())
1052 (void)parse_delimiter(tmp_string, &post_statements,
1053 delimiter[0]);
1054 free(tmp_string);
1055 }
1056- else if (user_supplied_post_statements)
1057+ else if (!user_supplied_post_statements.empty())
1058 {
1059- (void)parse_delimiter(user_supplied_post_statements, &post_statements,
1060+ (void)parse_delimiter(user_supplied_post_statements.c_str(), &post_statements,
1061 delimiter[0]);
1062 }
1063
1064 if (verbose >= 2)
1065 printf("Parsing engines to use.\n");
1066
1067- if (default_engine)
1068- parse_option(default_engine, &engine_options, ',');
1069+ if (!default_engine.empty())
1070+ parse_option(default_engine.c_str(), &engine_options, ',');
1071
1072 if (tty_password)
1073 opt_password= client_get_tty_password(NULL);
1074@@ -3004,10 +2960,10 @@
1075 printf("Benchmark\n");
1076 if (con->getEngine())
1077 printf("\tRunning for engine %s\n", con->getEngine());
1078- if (opt_label || opt_auto_generate_sql_type)
1079+ if (!opt_label.empty() || !opt_auto_generate_sql_type.empty())
1080 {
1081- const char *ptr= opt_auto_generate_sql_type ? opt_auto_generate_sql_type : "query";
1082- printf("\tLoad: %s\n", opt_label ? opt_label : ptr);
1083+ const char *ptr= opt_auto_generate_sql_type.c_str() ? opt_auto_generate_sql_type.c_str() : "query";
1084+ printf("\tLoad: %s\n", !opt_label.empty() ? opt_label.c_str() : ptr);
1085 }
1086 printf("\tAverage Time took to generate schema and initial data: %ld.%03ld seconds\n",
1087 con->getCreateAvgTiming() / 1000, con->getCreateAvgTiming() % 1000);
1088@@ -3035,24 +2991,25 @@
1089 char buffer[HUGE_STRING_LENGTH];
1090 char label_buffer[HUGE_STRING_LENGTH];
1091 size_t string_len;
1092+ const char *temp_label= opt_label.c_str();
1093
1094 memset(label_buffer, 0, HUGE_STRING_LENGTH);
1095
1096- if (opt_label)
1097+ if (!opt_label.empty())
1098 {
1099- string_len= strlen(opt_label);
1100+ string_len= opt_label.length();
1101
1102 for (x= 0; x < string_len; x++)
1103 {
1104- if (opt_label[x] == ',')
1105+ if (temp_label[x] == ',')
1106 label_buffer[x]= '-';
1107 else
1108- label_buffer[x]= opt_label[x] ;
1109+ label_buffer[x]= temp_label[x] ;
1110 }
1111 }
1112- else if (opt_auto_generate_sql_type)
1113+ else if (!opt_auto_generate_sql_type.empty())
1114 {
1115- string_len= strlen(opt_auto_generate_sql_type);
1116+ string_len= opt_auto_generate_sql_type.length();
1117
1118 for (x= 0; x < string_len; x++)
1119 {
1120@@ -3198,9 +3155,9 @@
1121 usleep(random()%opt_delayed_start);
1122
1123 if ((drizzle= drizzle_create(NULL)) == NULL ||
1124- drizzle_con_add_tcp(drizzle, con, host, opt_drizzle_port, user,
1125- opt_password,
1126- connect_to_schema ? create_schema_string : NULL,
1127+ drizzle_con_add_tcp(drizzle, con, host.c_str(), opt_drizzle_port, user.c_str(),
1128+ opt_password.c_str(),
1129+ connect_to_schema ? create_schema_string.c_str() : NULL,
1130 opt_mysql ? DRIZZLE_CON_MYSQL : DRIZZLE_CON_NONE) == NULL)
1131 {
1132 fprintf(stderr,"%s: Error creating drizzle object\n", internal::my_progname);
1133
1134=== modified file 'client/include.am'
1135--- client/include.am 2010-01-11 23:50:15 +0000
1136+++ client/include.am 2010-06-02 21:23:22 +0000
1137@@ -10,6 +10,10 @@
1138 gnulib/libgnu.la \
1139 client/libgetpassword.la
1140
1141+CLIENT_CXXFLAGS= \
1142+ ${AM_CXXFLAGS} \
1143+ ${BOOSTSKIP_WARNINGS}
1144+
1145 noinst_LTLIBRARIES+= \
1146 client/libgetpassword.la
1147
1148@@ -42,16 +46,22 @@
1149
1150 client_drizzle_SOURCES= client/drizzle.cc client/linebuffer.cc
1151 client_drizzle_LDADD= ${CLIENT_LDADD} ${READLINE_LIBS}
1152+client_drizzle_CXXFLAGS= ${CLIENT_CXXFLAGS}
1153
1154 client_drizzledump_SOURCES= client/drizzledump.cc
1155 client_drizzledump_LDADD= ${CLIENT_LDADD}
1156+client_drizzledump_CXXFLAGS= ${CLIENT_CXXFLAGS}
1157
1158 client_drizzleimport_SOURCES= client/drizzleimport.cc
1159-client_drizzleimport_LDADD= ${CLIENT_LDADD}
1160+client_drizzleimport_LDADD= ${CLIENT_LDADD}
1161+client_drizzleimport_CXXFLAGS= ${CLIENT_CXXFLAGS}
1162
1163 client_drizzleslap_SOURCES= client/drizzleslap.cc
1164-client_drizzleslap_LDADD= ${CLIENT_LDADD}
1165+client_drizzleslap_LDADD= ${CLIENT_LDADD} ${BOOST_LIBS}
1166+client_drizzleslap_CXXFLAGS= ${CLIENT_CXXFLAGS}
1167
1168 client_drizzletest_SOURCES= client/drizzletest.cc client/errname.cc
1169 client_drizzletest_LDADD= ${CLIENT_LDADD} ${LIBPCRE}
1170+client_drizzletest_CXXFLAGS= ${CLIENT_CXXFLAGS}
1171+
1172
1173
1174=== modified file 'm4/pandora_warnings.m4'
1175--- m4/pandora_warnings.m4 2010-06-01 20:26:16 +0000
1176+++ m4/pandora_warnings.m4 2010-06-02 21:23:22 +0000
1177@@ -293,7 +293,9 @@
1178 PROTOSKIP_WARNINGS="-Wno-effc++ -Wno-shadow -Wno-missing-braces ${NO_ATTRIBUTES}"
1179 NO_WERROR="-Wno-error"
1180 INNOBASE_SKIP_WARNINGS="-Wno-shadow -Wno-cast-align"
1181-
1182+ AS_IF([test "$host_vendor" = "apple"],[
1183+ BOOSTSKIP_WARNINGS="-Wno-uninitialized"
1184+ ])
1185 ])
1186 ])
1187
1188@@ -334,7 +336,7 @@
1189 CC_WARNINGS="-v -errtags=yes ${W_FAIL} ${CC_WARNINGS_FULL} ${CFLAG_VISIBILITY}"
1190 CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${CXX_WARNINGS_FULL} ${W_FAIL} ${CFLAG_VISIBILITY}"
1191 PROTOSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn,partinit,notused,badargtype2w,wbadinit"
1192- BOOSTSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint,hidef"
1193+ BOOSTSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint,hidef,wvarhidenmem"
1194 NO_UNREACHED="-erroff=E_STATEMENT_NOT_REACHED"
1195 NO_WERROR="-errwarn=%none"
1196
1197
1198=== modified file 'tests/t/drizzleslap.test'
1199--- tests/t/drizzleslap.test 2009-12-01 17:50:17 +0000
1200+++ tests/t/drizzleslap.test 2010-06-02 21:23:22 +0000
1201@@ -44,7 +44,7 @@
1202
1203 --exec $DRIZZLE_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=write --timer-length=1 --commit=100
1204
1205---exec $DRIZZLE_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=write --delayed_start=1234 --commit=100
1206+--exec $DRIZZLE_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=write --delayed-start=1234 --commit=100
1207
1208 --exec $DRIZZLE_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=write --number-blob-cols=2:1024/2048 --commit=100
1209