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

Proposed by Vijay Samuel
Status: Superseded
Proposed branch: lp:~vjsamuel/drizzle/refactor-drizzleslap
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 1213 lines (+369/-413)
7 files modified
client/drizzleslap.cc (+361/-406)
client/include.am (+3/-2)
plugin/archive/archive_performance.cc (+1/-1)
plugin/archive/archive_test.cc (+1/-1)
plugin/archive/concurrency_test.cc (+1/-1)
plugin/myisam/mi_check.cc (+1/-1)
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 Needs Fixing
Brian Aker Needs Fixing
Review via email: mp+25666@code.launchpad.net

This proposal has been superseded by a proposal from 2010-05-24.

To post a comment you must log in.
1544. By Vijay Samuel <vijay@vijay>

Refactored command line options for slap using boost::program_options

1545. By Vijay Samuel <vijay@vijay>

Refactored command line options for slap using boost::program_options

1546. By Vijay Samuel <vijay@vijay>

Refactored command line options for slap using boost::program_options

1547. By Vijay Samuel <vijay@vijay>

Refactored command line options for slap using boost::program_options

1548. By Vijay Samuel <vijay@vijay>

Refactored command line options for slap using boost::program_options

1549. By Vijay Samuel <vijay@vijay>

Refactored command line options for slap using boost::program_options

Revision history for this message
Brian Aker (brianaker) wrote :

Quick note, please remove the commented out code.

Thanks!

review: Needs Fixing
1550. By Vijay Samuel <vijay@vijay>

Refactored command line options for slap using boost::program_options

1551. By Vijay Samuel <vijay@vijay>

Refactored command line options for slap using boost::program_options

1552. By Vijay Samuel <vijay@vijay>

Completely refactored commandline options for drizzleslap

Revision history for this message
Monty Taylor (mordred) wrote :

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
1553. By Vijay Samuel <vijay@vijay>

Refactored command line options for slap using boost::program_options

1554. By Vijay Samuel <vijay@vijay>

Refactored command line options for slap using boost::program_options

1555. By Vijay Samuel <vijay@vijay>

Refactored command line options for slap using boost::program_options

1556. By Vijay Samuel <vijay@vijay>

Refactored command line options for slap using boost::program_options

1557. By Vijay Samuel <vijay@vijay>

Refactored command line for drizzleslap using boost::program_options

1558. By Vijay Samuel <vijay@vijay>

refactored command line for drizzleslap using boost::program_options.

1559. By Vijay Samuel <vijay@vijay>

Slap completely refactored with boost::program_options.

1560. By Vijay Samuel <vijay@vijay>

Slap completely refactored with boost::program_options.

1561. By Vijay Samuel <vijay@vijay>

Slap completely refactored using boost::program_options.

1562. By Vijay Samuel <vijay@vijay>

Slap completely refactored using boost::program_options.

1563. By Vijay Samuel <vijay@vijay>

slap completely refactored using boost::program_options.

1564. By Vijay Samuel <vijay@vijay>

Slap completely refactored using boost::program_options.

Unmerged revisions

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-05-24 21:40:58 +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,246 @@
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+ ("host,h",po::value<string>(&host)->default_value("localhost"),"Connect to the host")
297+ ("password,P",po::value<char *>(&password),
298+ "Password to use when connecting to server. If password is not given it's asked from the tty")
299+ ("port,p",po::value<uint32_t>(), "Port number to use for connection")
300+ ("protocol",po::value<string>(),
301+ "The protocol of connection (tcp,socket,pipe,memory).")
302+ ("user,u",po::value<string>(&user)->default_value(""),
303+ "User for login if not current user")
304+ ;
305+
306+ po::options_description long_options("Allowed Options");
307+ long_options.add(commandline_options).add(slap_options).add(client_options);
308+
309+ std::string system_config_dir_slap(SYSCONFDIR);
310+ system_config_dir_slap.append("/drizzle/drizzleslap.cnf");
311+
312+ std::string system_config_dir_client(SYSCONFDIR);
313+ system_config_dir_client.append("/drizzle/client.cnf");
314+
315+ uint64_t temp_drizzle_port= 0;
316 drizzle_con_st con;
317 OptionString *eptr;
318- unsigned int x;
319-
320- internal::my_init();
321-
322- MY_INIT(argv[0]);
323-
324- internal::load_defaults("drizzle",load_default_groups,&argc,&argv);
325- defaults_argv=argv;
326- if (get_options(&argc,&argv))
327- {
328- internal::free_defaults(defaults_argv);
329- internal::my_end();
330+ uint32_t x;
331+
332+
333+ po::variables_map vm;
334+ po::store(po::parse_command_line(argc,argv,long_options),vm);
335+
336+ ifstream user_slap_ifs("~/.drizzle/drizzleslap.cnf");
337+ po::store(parse_config_file(user_slap_ifs, slap_options), vm);
338+
339+ ifstream system_slap_ifs(system_config_dir_slap);
340+ store(parse_config_file(system_slap_ifs, slap_options), vm);
341+
342+ ifstream user_client_ifs("~/.drizzle/client.cnf");
343+ po::store(parse_config_file(user_client_ifs, client_options), vm);
344+
345+ ifstream system_client_ifs(system_config_dir_client);
346+ store(parse_config_file(system_client_ifs, client_options), vm);
347+
348+ po::notify(vm);
349+
350+ if (process_options())
351 exit(1);
352+
353+ if( vm.count("help") || vm.count("info"))
354+ {
355+ printf("%s Ver %s Distrib %s, for %s-%s (%s)\n",internal::my_progname, SLAP_VERSION,
356+ drizzle_version(),HOST_VENDOR,HOST_OS,HOST_CPU);
357+ puts("Copyright (C) 2008 Sun Microsystems");
358+ puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\
359+ \nand you are welcome to modify and redistribute it under the GPL \
360+ license\n");
361+ puts("Run a query multiple times against the server\n");
362+ cout<<long_options<<endl;
363+ exit(0);
364+ }
365+
366+ if(vm.count("port"))
367+ {
368+ temp_drizzle_port= vm["port"].as<uint32_t>();
369+
370+ if ((temp_drizzle_port == 0) || (temp_drizzle_port > 65535))
371+ {
372+ fprintf(stderr, _("Value supplied for port is not valid.\n"));
373+ exit(1);
374+ }
375+ else
376+ {
377+ opt_drizzle_port= (uint32_t) temp_drizzle_port;
378+ }
379+ }
380+
381+ if( vm.count("password") )
382+ {
383+ char *start= vm["password"].as<char *>();
384+ if (!opt_password.empty())
385+ opt_password.erase();
386+ opt_password = strdup(vm["password"].as<char *>());
387+ if (opt_password.c_str() == NULL)
388+ {
389+ fprintf(stderr, "Memory allocation error while copying password. "
390+ "Aborting.\n");
391+ exit(ENOMEM);
392+ }
393+
394+ while (*password)
395+ {
396+ /* Overwriting password with 'x' */
397+ *password++= 'x';
398+ }
399+
400+ if (*start)
401+ {
402+ /* Cut length of argument */
403+ start[1]= 0;
404+ }
405+ tty_password= 0;
406+ }
407+ else
408+ tty_password= 1;
409+
410+
411+ if( vm.count("version") )
412+ {
413+ printf("%s Ver %s Distrib %s, for %s-%s (%s)\n",internal::my_progname, SLAP_VERSION,
414+ drizzle_version(),HOST_VENDOR,HOST_OS,HOST_CPU);
415+ exit(0);
416 }
417
418 /* Seed the random number generator if we will be using it. */
419@@ -849,15 +1078,7 @@
420 }
421
422 /* globals? Yes, so we only have to run strlen once */
423- delimiter_length= strlen(delimiter);
424-
425- if (argc > 2)
426- {
427- fprintf(stderr,"%s: Too many arguments\n",internal::my_progname);
428- internal::free_defaults(defaults_argv);
429- internal::my_end();
430- exit(1);
431- }
432+ delimiter_length= delimiter.length();
433
434 slap_connect(&con, false);
435
436@@ -895,7 +1116,7 @@
437 }
438
439 if (!opt_preserve)
440- drop_schema(&con, create_schema_string);
441+ drop_schema(&con, create_schema_string.c_str());
442
443 } while (eptr ? (eptr= eptr->getNext()) : 0);
444
445@@ -912,8 +1133,8 @@
446 slap_close(&con);
447
448 /* now free all the strings we created */
449- if (opt_password)
450- free(opt_password);
451+ if (!opt_password.empty())
452+ opt_password.erase();
453
454 free(concurrency);
455
456@@ -930,9 +1151,13 @@
457 if (shared_memory_base_name)
458 free(shared_memory_base_name);
459 #endif
460- internal::free_defaults(defaults_argv);
461- internal::my_end();
462-
463+
464+ }
465+
466+ catch(exception &err)
467+ {
468+ cerr<<"Error:"<<err.what()<<endl;
469+ }
470 return 0;
471 }
472
473@@ -969,11 +1194,11 @@
474 data in the table.
475 */
476 if (opt_preserve == false)
477- drop_schema(con, create_schema_string);
478+ drop_schema(con, create_schema_string.c_str());
479
480 /* First we create */
481 if (create_statements)
482- create_schema(con, create_schema_string, create_statements, eptr, sptr);
483+ create_schema(con, create_schema_string.c_str(), create_statements, eptr, sptr);
484
485 /*
486 If we generated GUID we need to build a list of them from creation that
487@@ -987,9 +1212,9 @@
488 if (commit_rate)
489 run_query(con, NULL, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
490
491- if (pre_system)
492+ if (!pre_system.empty())
493 {
494- int ret= system(pre_system);
495+ int ret= system(pre_system.c_str());
496 assert(ret != -1);
497 }
498
499@@ -1006,9 +1231,9 @@
500 if (post_statements)
501 run_statements(con, post_statements);
502
503- if (post_system)
504+ if (!post_system.empty())
505 {
506- int ret= system(post_system);
507+ int ret= system(post_system.c_str());
508 assert(ret !=-1);
509 }
510
511@@ -1024,7 +1249,7 @@
512
513 if (!opt_silent)
514 print_conclusions(&conclusion);
515- if (opt_csv_str)
516+ if (!opt_csv_str.empty())
517 print_conclusions_csv(&conclusion);
518
519 free(head_sptr);
520@@ -1032,274 +1257,6 @@
521 }
522
523
524-static struct option my_long_options[] =
525-{
526- {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
527- 0, 0, 0, 0, 0, 0},
528- {"auto-generate-sql-select-columns", OPT_SLAP_AUTO_GENERATE_SELECT_COLUMNS,
529- "Provide a string to use for the select fields used in auto tests.",
530- (char**) &auto_generate_selected_columns_opt,
531- (char**) &auto_generate_selected_columns_opt,
532- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
533- {"auto-generate-sql", 'a',
534- "Generate SQL where not supplied by file or command line.",
535- (char**) &auto_generate_sql, (char**) &auto_generate_sql,
536- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
537- {"auto-generate-sql-add-autoincrement", OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
538- "Add an AUTO_INCREMENT column to auto-generated tables.",
539- (char**) &auto_generate_sql_autoincrement,
540- (char**) &auto_generate_sql_autoincrement,
541- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
542- {"auto-generate-sql-execute-number", OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES,
543- "Set this number to generate a set number of queries to run.",
544- (char**) &auto_actual_queries, (char**) &auto_actual_queries,
545- 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
546- {"auto-generate-sql-guid-primary", OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY,
547- "Add GUID based primary keys to auto-generated tables.",
548- (char**) &auto_generate_sql_guid_primary,
549- (char**) &auto_generate_sql_guid_primary,
550- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
551- {"auto-generate-sql-load-type", OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE,
552- "Specify test load type: mixed, update, write, key, or read; default is mixed.",
553- (char**) &opt_auto_generate_sql_type, (char**) &opt_auto_generate_sql_type,
554- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
555- {"auto-generate-sql-secondary-indexes",
556- OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES,
557- "Number of secondary indexes to add to auto-generated tables.",
558- (char**) &auto_generate_sql_secondary_indexes,
559- (char**) &auto_generate_sql_secondary_indexes, 0,
560- GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
561- {"auto-generate-sql-unique-query-number",
562- OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM,
563- "Number of unique queries to generate for automatic tests.",
564- (char**) &auto_generate_sql_unique_query_number,
565- (char**) &auto_generate_sql_unique_query_number,
566- 0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
567- {"auto-generate-sql-unique-write-number",
568- OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM,
569- "Number of unique queries to generate for auto-generate-sql-write-number.",
570- (char**) &auto_generate_sql_unique_write_number,
571- (char**) &auto_generate_sql_unique_write_number,
572- 0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
573- {"auto-generate-sql-write-number", OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
574- "Number of row inserts to perform for each thread (default is 100).",
575- (char**) &auto_generate_sql_number, (char**) &auto_generate_sql_number,
576- 0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0},
577- {"burnin", OPT_SLAP_BURNIN, "Run full test case in infinite loop.",
578- (char**) &opt_burnin, (char**) &opt_burnin, 0, GET_BOOL, NO_ARG, 0, 0, 0,
579- 0, 0, 0},
580- {"ignore-sql-errors", OPT_SLAP_IGNORE_SQL_ERRORS,
581- "Ignore SQL erros in query run.",
582- (char**) &opt_ignore_sql_errors,
583- (char**) &opt_ignore_sql_errors,
584- 0, GET_BOOL, NO_ARG, 0, 0, 0,
585- 0, 0, 0},
586- {"commit", OPT_SLAP_COMMIT, "Commit records every X number of statements.",
587- (char**) &commit_rate, (char**) &commit_rate, 0, GET_UINT, REQUIRED_ARG,
588- 0, 0, 0, 0, 0, 0},
589- {"concurrency", 'c', "Number of clients to simulate for query to run.",
590- (char**) &concurrency_str, (char**) &concurrency_str, 0, GET_STR,
591- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
592- {"create", OPT_SLAP_CREATE_STRING, "File or string to use create tables.",
593- (char**) &create_string, (char**) &create_string, 0, GET_STR, REQUIRED_ARG,
594- 0, 0, 0, 0, 0, 0},
595- {"create-schema", OPT_CREATE_SLAP_SCHEMA, "Schema to run tests in.",
596- (char**) &create_schema_string, (char**) &create_schema_string, 0, GET_STR,
597- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
598- {"csv", OPT_SLAP_CSV,
599- "Generate CSV output to named file or to stdout if no file is named.",
600- (char**) &opt_csv_str, (char**) &opt_csv_str, 0, GET_STR,
601- OPT_ARG, 0, 0, 0, 0, 0, 0},
602- {"delayed-start", OPT_SLAP_DELAYED_START,
603- "Delay the startup of threads by a random number of microsends (the maximum of the delay)",
604- (char**) &opt_delayed_start, (char**) &opt_delayed_start, 0, GET_UINT,
605- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
606- {"delimiter", 'F',
607- "Delimiter to use in SQL statements supplied in file or command line.",
608- (char**) &delimiter, (char**) &delimiter, 0, GET_STR, REQUIRED_ARG,
609- 0, 0, 0, 0, 0, 0},
610- {"detach", OPT_SLAP_DETACH,
611- "Detach (close and reopen) connections after X number of requests.",
612- (char**) &detach_rate, (char**) &detach_rate, 0, GET_UINT, REQUIRED_ARG,
613- 0, 0, 0, 0, 0, 0},
614- {"engine", 'e', "Storage engine to use for creating the table.",
615- (char**) &default_engine, (char**) &default_engine, 0,
616- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
617- {"host", 'h', "Connect to host.", (char**) &host, (char**) &host, 0, GET_STR,
618- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
619- {"iterations", 'i', "Number of times to run the tests.", (char**) &iterations,
620- (char**) &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
621- {"label", OPT_SLAP_LABEL, "Label to use for print and csv output.",
622- (char**) &opt_label, (char**) &opt_label, 0,
623- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
624- {"mysql", 'm', N_("Use MySQL Protocol."),
625- (char**) &opt_mysql, (char**) &opt_mysql, 0, GET_BOOL, NO_ARG, 1, 0, 0,
626- 0, 0, 0},
627- {"number-blob-cols", OPT_SLAP_BLOB_COL,
628- "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. ",
629- (char**) &num_blob_cols_opt, (char**) &num_blob_cols_opt, 0, GET_STR, REQUIRED_ARG,
630- 0, 0, 0, 0, 0, 0},
631- {"number-char-cols", 'x',
632- "Number of VARCHAR columns to create in table if specifying --auto-generate-sql.",
633- (char**) &num_char_cols_opt, (char**) &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG,
634- 0, 0, 0, 0, 0, 0},
635- {"number-int-cols", 'y',
636- "Number of INT columns to create in table if specifying --auto-generate-sql.",
637- (char**) &num_int_cols_opt, (char**) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG,
638- 0, 0, 0, 0, 0, 0},
639- {"number-of-queries", OPT_DRIZZLE_NUMBER_OF_QUERY,
640- "Limit each client to this number of queries (this is not exact).",
641- (char**) &num_of_query, (char**) &num_of_query, 0,
642- GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
643- {"only-print", OPT_DRIZZLE_ONLY_PRINT,
644- "This causes drizzleslap to not connect to the databases, but instead print "
645- "out what it would have done instead.",
646- (char**) &opt_only_print, (char**) &opt_only_print, 0, GET_BOOL, NO_ARG,
647- 0, 0, 0, 0, 0, 0},
648- {"password", 'P',
649- "Password to use when connecting to server. If password is not given it's "
650- "asked from the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
651- {"port", 'p', "Port number to use for connection.",
652- 0, 0, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
653- {"post-query", OPT_SLAP_POST_QUERY,
654- "Query to run or file containing query to execute after tests have completed.",
655- (char**) &user_supplied_post_statements,
656- (char**) &user_supplied_post_statements,
657- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
658- {"post-system", OPT_SLAP_POST_SYSTEM,
659- "system() string to execute after tests have completed.",
660- (char**) &post_system,
661- (char**) &post_system,
662- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
663- {"pre-query", OPT_SLAP_PRE_QUERY,
664- "Query to run or file containing query to execute before running tests.",
665- (char**) &user_supplied_pre_statements,
666- (char**) &user_supplied_pre_statements,
667- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
668- {"pre-system", OPT_SLAP_PRE_SYSTEM,
669- "system() string to execute before running tests.",
670- (char**) &pre_system,
671- (char**) &pre_system,
672- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
673- {"protocol", OPT_DRIZZLE_PROTOCOL,
674- "The protocol of connection (tcp,socket,pipe,memory).",
675- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
676- {"query", 'q', "Query to run or file containing query to run.",
677- (char**) &user_supplied_query, (char**) &user_supplied_query,
678- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
679- {"set-random-seed", OPT_SLAP_SET_RANDOM_SEED,
680- "Seed for random number generator (srandom(3))",
681- (char**)&opt_set_random_seed,
682- (char**)&opt_set_random_seed,0,
683- GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
684- {"silent", 's', "Run program in silent mode - no output.",
685- (char**) &opt_silent, (char**) &opt_silent, 0, GET_BOOL, NO_ARG,
686- 0, 0, 0, 0, 0, 0},
687- {"timer-length", OPT_SLAP_TIMER_LENGTH,
688- "Require drizzleslap to run each specific test a certain amount of time in seconds.",
689- (char**) &opt_timer_length, (char**) &opt_timer_length, 0, GET_UINT,
690- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
691- {"user", 'u', "User for login if not current user.", (char**) &user,
692- (char**) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
693- {"verbose", 'v',
694- "More verbose output; you can use this multiple times to get even more "
695- "verbose output.", (char**) &verbose, (char**) &verbose, 0,
696- GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
697- {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
698- NO_ARG, 0, 0, 0, 0, 0, 0},
699- {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
700-};
701-
702-
703-static void print_version(void)
704-{
705- printf("%s Ver %s Distrib %s, for %s-%s (%s)\n",internal::my_progname, SLAP_VERSION,
706- drizzle_version(),HOST_VENDOR,HOST_OS,HOST_CPU);
707-}
708-
709-
710-static void usage(void)
711-{
712- print_version();
713- puts("Copyright (C) 2008 Sun Microsystems");
714- puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\
715- \nand you are welcome to modify and redistribute it under the GPL \
716- license\n");
717- puts("Run a query multiple times against the server\n");
718- printf("Usage: %s [OPTIONS]\n",internal::my_progname);
719- internal::print_defaults("drizzle",load_default_groups);
720- my_print_help(my_long_options);
721-}
722-
723-static int get_one_option(int optid, const struct option *, char *argument)
724-{
725- char *endchar= NULL;
726- uint64_t temp_drizzle_port= 0;
727-
728- switch(optid) {
729- case 'v':
730- verbose++;
731- break;
732- case 'p':
733- temp_drizzle_port= (uint64_t) strtoul(argument, &endchar, 10);
734- /* if there is an alpha character this is not a valid port */
735- if (strlen(endchar) != 0)
736- {
737- fprintf(stderr, _("Non-integer value supplied for port. If you are trying to enter a password please use --password instead.\n"));
738- exit(1);
739- }
740- /* If the port number is > 65535 it is not a valid port
741- This also helps with potential data loss casting unsigned long to a
742- uint32_t. */
743- if ((temp_drizzle_port == 0) || (temp_drizzle_port > 65535))
744- {
745- fprintf(stderr, _("Value supplied for port is not valid.\n"));
746- exit(1);
747- }
748- else
749- {
750- opt_drizzle_port= (uint32_t) temp_drizzle_port;
751- }
752- break;
753- case 'P':
754- if (argument)
755- {
756- char *start= argument;
757- if (opt_password)
758- free(opt_password);
759- opt_password = strdup(argument);
760- if (opt_password == NULL)
761- {
762- fprintf(stderr, "Memory allocation error while copying password. "
763- "Aborting.\n");
764- exit(ENOMEM);
765- }
766- while (*argument)
767- {
768- /* Overwriting password with 'x' */
769- *argument++= 'x';
770- }
771- if (*start)
772- {
773- /* Cut length of argument */
774- start[1]= 0;
775- }
776- tty_password= 0;
777- }
778- else
779- tty_password= 1;
780- break;
781- case 'V':
782- print_version();
783- exit(0);
784- case '?':
785- case 'I': /* Info */
786- usage();
787- exit(0);
788- }
789- return(0);
790-}
791-
792
793 uint
794 get_random_string(char *buf, size_t size)
795@@ -1698,9 +1655,9 @@
796 query_string.reserve(HUGE_STRING_LENGTH);
797
798 query_string.append("SELECT ", 7);
799- if (auto_generate_selected_columns_opt)
800+ if (!auto_generate_selected_columns_opt.empty())
801 {
802- query_string.append(auto_generate_selected_columns_opt);
803+ query_string.append(auto_generate_selected_columns_opt.c_str());
804 }
805 else
806 {
807@@ -1777,27 +1734,24 @@
808 }
809
810 static int
811-get_options(int *argc,char ***argv)
812+process_options(void)
813 {
814- int ho_error;
815 char *tmp_string;
816 struct stat sbuf;
817 OptionString *sql_type;
818 unsigned int sql_type_count= 0;
819 ssize_t bytes_read= 0;
820-
821-
822- if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
823- exit(ho_error);
824-
825- if (!user)
826- user= (char *)"root";
827+
828+ if (user.empty())
829+ user= "root";
830+
831+ verbose= opt_verbose.length();
832
833 /* If something is created we clean it up, otherwise we leave schemas alone */
834- if (create_string || auto_generate_sql)
835+ if ( (!create_string.empty()) || auto_generate_sql)
836 opt_preserve= false;
837
838- if (auto_generate_sql && (create_string || user_supplied_query))
839+ if (auto_generate_sql && (!create_string.empty() || !user_supplied_query.empty()))
840 {
841 fprintf(stderr,
842 "%s: Can't use --auto-generate-sql when create and query strings are specified!\n",
843@@ -1822,9 +1776,9 @@
844 exit(1);
845 }
846
847- parse_comma(concurrency_str ? concurrency_str : "1", &concurrency);
848+ parse_comma(!concurrency_str.empty() ? concurrency_str.c_str() : "1", &concurrency);
849
850- if (opt_csv_str)
851+ if (!opt_csv_str.empty())
852 {
853 opt_silent= true;
854
855@@ -1834,11 +1788,11 @@
856 }
857 else
858 {
859- if ((csv_file= open(opt_csv_str, O_CREAT|O_WRONLY|O_APPEND,
860+ if ((csv_file= open(opt_csv_str.c_str(), O_CREAT|O_WRONLY|O_APPEND,
861 S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) == -1)
862 {
863 fprintf(stderr,"%s: Could not open csv file: %sn\n",
864- internal::my_progname, opt_csv_str);
865+ internal::my_progname, opt_csv_str.c_str());
866 exit(1);
867 }
868 }
869@@ -1847,20 +1801,20 @@
870 if (opt_only_print)
871 opt_silent= true;
872
873- if (num_int_cols_opt)
874+ if (!num_int_cols_opt.empty())
875 {
876 OptionString *str;
877- parse_option(num_int_cols_opt, &str, ',');
878+ parse_option(num_int_cols_opt.c_str(), &str, ',');
879 num_int_cols= atoi(str->getString());
880 if (str->getOption())
881 num_int_cols_index= atoi(str->getOption());
882 option_cleanup(str);
883 }
884
885- if (num_char_cols_opt)
886+ if (!num_char_cols_opt.empty())
887 {
888 OptionString *str;
889- parse_option(num_char_cols_opt, &str, ',');
890+ parse_option(num_char_cols_opt.c_str(), &str, ',');
891 num_char_cols= atoi(str->getString());
892 if (str->getOption())
893 num_char_cols_index= atoi(str->getOption());
894@@ -1869,10 +1823,10 @@
895 option_cleanup(str);
896 }
897
898- if (num_blob_cols_opt)
899+ if (!num_blob_cols_opt.empty())
900 {
901 OptionString *str;
902- parse_option(num_blob_cols_opt, &str, ',');
903+ parse_option(num_blob_cols_opt.c_str(), &str, ',');
904 num_blob_cols= atoi(str->getString());
905 if (str->getOption())
906 {
907@@ -1919,11 +1873,11 @@
908 if (verbose >= 2)
909 printf("Building Query Statements for Auto\n");
910
911- if (!opt_auto_generate_sql_type)
912+ if (opt_auto_generate_sql_type.empty())
913 opt_auto_generate_sql_type= "mixed";
914
915 query_statements_count=
916- parse_option(opt_auto_generate_sql_type, &query_options, ',');
917+ parse_option(opt_auto_generate_sql_type.c_str(), &query_options, ',');
918
919 query_statements= (Statement **)malloc(sizeof(Statement *) * query_statements_count);
920 if (query_statements == NULL)
921@@ -2037,7 +1991,7 @@
922 }
923 else
924 {
925- if (create_string && !stat(create_string, &sbuf))
926+ if (!create_string.empty() && !stat(create_string.c_str(), &sbuf))
927 {
928 int data_file;
929 if (!S_ISREG(sbuf.st_mode))
930@@ -2046,7 +2000,7 @@
931 internal::my_progname);
932 exit(1);
933 }
934- if ((data_file= open(create_string, O_RDWR)) == -1)
935+ if ((data_file= open(create_string.c_str(), O_RDWR)) == -1)
936 {
937 fprintf(stderr,"%s: Could not open create file\n", internal::my_progname);
938 exit(1);
939@@ -2074,13 +2028,13 @@
940 parse_delimiter(tmp_string, &create_statements, delimiter[0]);
941 free(tmp_string);
942 }
943- else if (create_string)
944+ else if (!create_string.empty())
945 {
946- parse_delimiter(create_string, &create_statements, delimiter[0]);
947+ parse_delimiter(create_string.c_str(), &create_statements, delimiter[0]);
948 }
949
950 /* Set this up till we fully support options on user generated queries */
951- if (user_supplied_query)
952+ if (!user_supplied_query.empty())
953 {
954 query_statements_count=
955 parse_option("default", &query_options, ',');
956@@ -2094,7 +2048,7 @@
957 memset(query_statements, 0, sizeof(Statement *) * query_statements_count);
958 }
959
960- if (user_supplied_query && !stat(user_supplied_query, &sbuf))
961+ if (!user_supplied_query.empty() && !stat(user_supplied_query.c_str(), &sbuf))
962 {
963 int data_file;
964 if (!S_ISREG(sbuf.st_mode))
965@@ -2103,7 +2057,7 @@
966 internal::my_progname);
967 exit(1);
968 }
969- if ((data_file= open(user_supplied_query, O_RDWR)) == -1)
970+ if ((data_file= open(user_supplied_query.c_str(), O_RDWR)) == -1)
971 {
972 fprintf(stderr,"%s: Could not open query supplied file\n", internal::my_progname);
973 exit(1);
974@@ -2128,20 +2082,20 @@
975 {
976 fprintf(stderr, "Problem reading file: read less bytes than requested\n");
977 }
978- if (user_supplied_query)
979+ if (!user_supplied_query.empty())
980 actual_queries= parse_delimiter(tmp_string, &query_statements[0],
981 delimiter[0]);
982 free(tmp_string);
983 }
984- else if (user_supplied_query)
985+ else if (!user_supplied_query.empty())
986 {
987- actual_queries= parse_delimiter(user_supplied_query, &query_statements[0],
988+ actual_queries= parse_delimiter(user_supplied_query.c_str(), &query_statements[0],
989 delimiter[0]);
990 }
991 }
992
993- if (user_supplied_pre_statements
994- && !stat(user_supplied_pre_statements, &sbuf))
995+ if (!user_supplied_pre_statements.empty()
996+ && !stat(user_supplied_pre_statements.c_str(), &sbuf))
997 {
998 int data_file;
999 if (!S_ISREG(sbuf.st_mode))
1000@@ -2150,7 +2104,7 @@
1001 internal::my_progname);
1002 exit(1);
1003 }
1004- if ((data_file= open(user_supplied_pre_statements, O_RDWR)) == -1)
1005+ if ((data_file= open(user_supplied_pre_statements.c_str(), O_RDWR)) == -1)
1006 {
1007 fprintf(stderr,"%s: Could not open query supplied file\n", internal::my_progname);
1008 exit(1);
1009@@ -2175,20 +2129,20 @@
1010 {
1011 fprintf(stderr, "Problem reading file: read less bytes than requested\n");
1012 }
1013- if (user_supplied_pre_statements)
1014+ if (!user_supplied_pre_statements.empty())
1015 (void)parse_delimiter(tmp_string, &pre_statements,
1016 delimiter[0]);
1017 free(tmp_string);
1018 }
1019- else if (user_supplied_pre_statements)
1020+ else if (!user_supplied_pre_statements.empty())
1021 {
1022- (void)parse_delimiter(user_supplied_pre_statements,
1023+ (void)parse_delimiter(user_supplied_pre_statements.c_str(),
1024 &pre_statements,
1025 delimiter[0]);
1026 }
1027
1028- if (user_supplied_post_statements
1029- && !stat(user_supplied_post_statements, &sbuf))
1030+ if (!user_supplied_post_statements.empty()
1031+ && !stat(user_supplied_post_statements.c_str(), &sbuf))
1032 {
1033 int data_file;
1034 if (!S_ISREG(sbuf.st_mode))
1035@@ -2197,7 +2151,7 @@
1036 internal::my_progname);
1037 exit(1);
1038 }
1039- if ((data_file= open(user_supplied_post_statements, O_RDWR)) == -1)
1040+ if ((data_file= open(user_supplied_post_statements.c_str(), O_RDWR)) == -1)
1041 {
1042 fprintf(stderr,"%s: Could not open query supplied file\n", internal::my_progname);
1043 exit(1);
1044@@ -2224,22 +2178,22 @@
1045 {
1046 fprintf(stderr, "Problem reading file: read less bytes than requested\n");
1047 }
1048- if (user_supplied_post_statements)
1049+ if (!user_supplied_post_statements.empty())
1050 (void)parse_delimiter(tmp_string, &post_statements,
1051 delimiter[0]);
1052 free(tmp_string);
1053 }
1054- else if (user_supplied_post_statements)
1055+ else if (!user_supplied_post_statements.empty())
1056 {
1057- (void)parse_delimiter(user_supplied_post_statements, &post_statements,
1058+ (void)parse_delimiter(user_supplied_post_statements.c_str(), &post_statements,
1059 delimiter[0]);
1060 }
1061
1062 if (verbose >= 2)
1063 printf("Parsing engines to use.\n");
1064
1065- if (default_engine)
1066- parse_option(default_engine, &engine_options, ',');
1067+ if (!default_engine.empty())
1068+ parse_option(default_engine.c_str(), &engine_options, ',');
1069
1070 if (tty_password)
1071 opt_password= client_get_tty_password(NULL);
1072@@ -3004,10 +2958,10 @@
1073 printf("Benchmark\n");
1074 if (con->getEngine())
1075 printf("\tRunning for engine %s\n", con->getEngine());
1076- if (opt_label || opt_auto_generate_sql_type)
1077+ if (!opt_label.empty() || !opt_auto_generate_sql_type.empty())
1078 {
1079- const char *ptr= opt_auto_generate_sql_type ? opt_auto_generate_sql_type : "query";
1080- printf("\tLoad: %s\n", opt_label ? opt_label : ptr);
1081+ const char *ptr= opt_auto_generate_sql_type.c_str() ? opt_auto_generate_sql_type.c_str() : "query";
1082+ printf("\tLoad: %s\n", !opt_label.empty() ? opt_label.c_str() : ptr);
1083 }
1084 printf("\tAverage Time took to generate schema and initial data: %ld.%03ld seconds\n",
1085 con->getCreateAvgTiming() / 1000, con->getCreateAvgTiming() % 1000);
1086@@ -3035,24 +2989,25 @@
1087 char buffer[HUGE_STRING_LENGTH];
1088 char label_buffer[HUGE_STRING_LENGTH];
1089 size_t string_len;
1090+ const char *temp_label= opt_label.c_str();
1091
1092 memset(label_buffer, 0, HUGE_STRING_LENGTH);
1093
1094- if (opt_label)
1095+ if (!opt_label.empty())
1096 {
1097- string_len= strlen(opt_label);
1098+ string_len= opt_label.length();
1099
1100 for (x= 0; x < string_len; x++)
1101 {
1102- if (opt_label[x] == ',')
1103+ if (temp_label[x] == ',')
1104 label_buffer[x]= '-';
1105 else
1106- label_buffer[x]= opt_label[x] ;
1107+ label_buffer[x]= temp_label[x] ;
1108 }
1109 }
1110- else if (opt_auto_generate_sql_type)
1111+ else if (!opt_auto_generate_sql_type.empty())
1112 {
1113- string_len= strlen(opt_auto_generate_sql_type);
1114+ string_len= opt_auto_generate_sql_type.length();
1115
1116 for (x= 0; x < string_len; x++)
1117 {
1118@@ -3198,9 +3153,9 @@
1119 usleep(random()%opt_delayed_start);
1120
1121 if ((drizzle= drizzle_create(NULL)) == NULL ||
1122- drizzle_con_add_tcp(drizzle, con, host, opt_drizzle_port, user,
1123- opt_password,
1124- connect_to_schema ? create_schema_string : NULL,
1125+ drizzle_con_add_tcp(drizzle, con, host.c_str(), opt_drizzle_port, user.c_str(),
1126+ opt_password.c_str(),
1127+ connect_to_schema ? create_schema_string.c_str() : NULL,
1128 opt_mysql ? DRIZZLE_CON_MYSQL : DRIZZLE_CON_NONE) == NULL)
1129 {
1130 fprintf(stderr,"%s: Error creating drizzle object\n", internal::my_progname);
1131
1132=== modified file 'client/include.am'
1133--- client/include.am 2010-01-11 23:50:15 +0000
1134+++ client/include.am 2010-05-24 21:40:58 +0000
1135@@ -47,11 +47,12 @@
1136 client_drizzledump_LDADD= ${CLIENT_LDADD}
1137
1138 client_drizzleimport_SOURCES= client/drizzleimport.cc
1139-client_drizzleimport_LDADD= ${CLIENT_LDADD}
1140+client_drizzleimport_LDADD= ${CLIENT_LDADD}
1141
1142 client_drizzleslap_SOURCES= client/drizzleslap.cc
1143-client_drizzleslap_LDADD= ${CLIENT_LDADD}
1144+client_drizzleslap_LDADD= ${CLIENT_LDADD} ${BOOST_LIBS}
1145
1146 client_drizzletest_SOURCES= client/drizzletest.cc client/errname.cc
1147 client_drizzletest_LDADD= ${CLIENT_LDADD} ${LIBPCRE}
1148+
1149
1150
1151=== modified file 'plugin/archive/archive_performance.cc'
1152--- plugin/archive/archive_performance.cc 2010-03-30 09:29:02 +0000
1153+++ plugin/archive/archive_performance.cc 2010-05-24 21:40:58 +0000
1154@@ -23,7 +23,7 @@
1155 #include <string.h>
1156 #include <fcntl.h>
1157 #include <sys/stat.h>
1158-#include "drizzled/option.h"
1159+//#include "drizzled/option.h"
1160
1161 #if TIME_WITH_SYS_TIME
1162 # include <sys/time.h>
1163
1164=== modified file 'plugin/archive/archive_test.cc'
1165--- plugin/archive/archive_test.cc 2010-03-30 09:29:02 +0000
1166+++ plugin/archive/archive_test.cc 2010-05-24 21:40:58 +0000
1167@@ -22,7 +22,7 @@
1168 #include <fcntl.h>
1169 #include <unistd.h>
1170 #include <cstdlib>
1171-#include "drizzled/option.h"
1172+//#include "drizzled/option.h"
1173
1174 #if TIME_WITH_SYS_TIME
1175 # include <sys/time.h>
1176
1177=== modified file 'plugin/archive/concurrency_test.cc'
1178--- plugin/archive/concurrency_test.cc 2010-03-30 09:29:02 +0000
1179+++ plugin/archive/concurrency_test.cc 2010-05-24 21:40:58 +0000
1180@@ -24,7 +24,7 @@
1181 #include "config.h"
1182
1183 #include "azio.h"
1184-#include "drizzled/option.h"
1185+//#include "drizzled/option.h"
1186 #include <stdio.h>
1187 #include <stdlib.h>
1188 #include <sys/types.h>
1189
1190=== modified file 'plugin/myisam/mi_check.cc'
1191--- plugin/myisam/mi_check.cc 2010-04-19 19:23:14 +0000
1192+++ plugin/myisam/mi_check.cc 2010-05-24 21:40:58 +0000
1193@@ -43,7 +43,7 @@
1194 #include "myisam_priv.h"
1195 #include "drizzled/internal/m_string.h"
1196 #include <stdarg.h>
1197-#include "drizzled/option.h"
1198+//#include "drizzled/option.h"
1199 #ifdef HAVE_SYS_VADVISE_H
1200 #include <sys/vadvise.h>
1201 #endif
1202
1203=== modified file 'tests/t/drizzleslap.test'
1204--- tests/t/drizzleslap.test 2009-12-01 17:50:17 +0000
1205+++ tests/t/drizzleslap.test 2010-05-24 21:40:58 +0000
1206@@ -44,7 +44,7 @@
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 --timer-length=1 --commit=100
1209
1210---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
1211+--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
1212
1213 --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
1214