290
287
connected= false, opt_raw_data= false, unbuffered= false,
291
288
output_tables= false, opt_rehash= true, skip_updates= false,
292
289
safe_updates= false, one_database= false,
293
opt_shutdown= false, opt_ping= false,
290
opt_compress= false, opt_shutdown= false, opt_ping= false,
294
291
vertical= false, line_numbers= true, column_names= true,
295
292
opt_nopager= true, opt_outfile= false, named_cmds= false,
296
293
opt_nobeep= false, opt_reconnect= true,
360
357
com_help(string *str,const char*), com_clear(string *str,const char*),
361
358
com_connect(string *str,const char*), com_status(string *str,const char*),
362
359
com_use(string *str,const char*), com_source(string *str, const char*),
363
com_shutdown(string *str,const char*),
364
360
com_rehash(string *str, const char*), com_tee(string *str, const char*),
365
361
com_notee(string *str, const char*),
366
362
com_prompt(string *str, const char*), com_delimiter(string *str, const char*),
492
488
N_("Set outfile [to_outfile]. Append everything into given outfile.") ),
493
489
Commands( "use", 'u', com_use, 1,
494
490
N_("Use another database. Takes database name as argument.") ),
495
Commands( "shutdown", 'u', com_shutdown, 1,
496
N_("Shutdown the instance you are connected too.") ),
497
491
Commands( "warnings", 'W', com_warnings, 0,
498
492
N_("Show warnings after every statement.") ),
499
493
Commands( "nowarning", 'w', com_nowarnings, 0,
529
523
Commands( "AUTO_INCREMENT", 0, 0, 0, ""),
530
524
Commands( "AVG", 0, 0, 0, ""),
531
525
Commands( "AVG_ROW_LENGTH", 0, 0, 0, ""),
526
Commands( "BACKUP", 0, 0, 0, ""),
527
Commands( "BDB", 0, 0, 0, ""),
532
528
Commands( "BEFORE", 0, 0, 0, ""),
533
529
Commands( "BEGIN", 0, 0, 0, ""),
530
Commands( "BERKELEYDB", 0, 0, 0, ""),
534
531
Commands( "BETWEEN", 0, 0, 0, ""),
535
532
Commands( "BIGINT", 0, 0, 0, ""),
536
533
Commands( "BINARY", 0, 0, 0, ""),
534
Commands( "BINLOG", 0, 0, 0, ""),
537
535
Commands( "BIT", 0, 0, 0, ""),
538
536
Commands( "BLOB", 0, 0, 0, ""),
539
537
Commands( "BOOL", 0, 0, 0, ""),
552
550
Commands( "CHANGED", 0, 0, 0, ""),
553
551
Commands( "CHAR", 0, 0, 0, ""),
554
552
Commands( "CHARACTER", 0, 0, 0, ""),
553
Commands( "CHARSET", 0, 0, 0, ""),
555
554
Commands( "CHECK", 0, 0, 0, ""),
556
555
Commands( "CHECKSUM", 0, 0, 0, ""),
556
Commands( "CIPHER", 0, 0, 0, ""),
557
557
Commands( "CLIENT", 0, 0, 0, ""),
558
558
Commands( "CLOSE", 0, 0, 0, ""),
559
Commands( "CODE", 0, 0, 0, ""),
559
560
Commands( "COLLATE", 0, 0, 0, ""),
560
561
Commands( "COLLATION", 0, 0, 0, ""),
561
562
Commands( "COLUMN", 0, 0, 0, ""),
597
598
Commands( "DEFAULT", 0, 0, 0, ""),
598
599
Commands( "DEFINER", 0, 0, 0, ""),
599
600
Commands( "DELAYED", 0, 0, 0, ""),
601
Commands( "DELAY_KEY_WRITE", 0, 0, 0, ""),
600
602
Commands( "DELETE", 0, 0, 0, ""),
601
603
Commands( "DESC", 0, 0, 0, ""),
602
604
Commands( "DESCRIBE", 0, 0, 0, ""),
605
Commands( "DES_KEY_FILE", 0, 0, 0, ""),
603
606
Commands( "DETERMINISTIC", 0, 0, 0, ""),
607
Commands( "DIRECTORY", 0, 0, 0, ""),
604
608
Commands( "DISABLE", 0, 0, 0, ""),
605
609
Commands( "DISCARD", 0, 0, 0, ""),
606
610
Commands( "DISTINCT", 0, 0, 0, ""),
607
611
Commands( "DISTINCTROW", 0, 0, 0, ""),
608
612
Commands( "DIV", 0, 0, 0, ""),
613
Commands( "DO", 0, 0, 0, ""),
609
614
Commands( "DOUBLE", 0, 0, 0, ""),
610
615
Commands( "DROP", 0, 0, 0, ""),
616
Commands( "DUAL", 0, 0, 0, ""),
611
617
Commands( "DUMPFILE", 0, 0, 0, ""),
612
618
Commands( "DUPLICATE", 0, 0, 0, ""),
613
619
Commands( "DYNAMIC", 0, 0, 0, ""),
623
629
Commands( "ERRORS", 0, 0, 0, ""),
624
630
Commands( "ESCAPE", 0, 0, 0, ""),
625
631
Commands( "ESCAPED", 0, 0, 0, ""),
632
Commands( "EVENTS", 0, 0, 0, ""),
633
Commands( "EXECUTE", 0, 0, 0, ""),
626
634
Commands( "EXISTS", 0, 0, 0, ""),
627
635
Commands( "EXIT", 0, 0, 0, ""),
636
Commands( "EXPANSION", 0, 0, 0, ""),
628
637
Commands( "EXPLAIN", 0, 0, 0, ""),
629
638
Commands( "EXTENDED", 0, 0, 0, ""),
630
639
Commands( "FALSE", 0, 0, 0, ""),
645
654
Commands( "FRAC_SECOND", 0, 0, 0, ""),
646
655
Commands( "FROM", 0, 0, 0, ""),
647
656
Commands( "FULL", 0, 0, 0, ""),
657
Commands( "FULLTEXT", 0, 0, 0, ""),
648
658
Commands( "FUNCTION", 0, 0, 0, ""),
649
659
Commands( "GLOBAL", 0, 0, 0, ""),
650
660
Commands( "GRANT", 0, 0, 0, ""),
712
722
Commands( "LOCKS", 0, 0, 0, ""),
713
723
Commands( "LOGS", 0, 0, 0, ""),
714
724
Commands( "LONG", 0, 0, 0, ""),
725
Commands( "LONGTEXT", 0, 0, 0, ""),
715
726
Commands( "LOOP", 0, 0, 0, ""),
727
Commands( "LOW_PRIORITY", 0, 0, 0, ""),
728
Commands( "MASTER", 0, 0, 0, ""),
729
Commands( "MASTER_CONNECT_RETRY", 0, 0, 0, ""),
730
Commands( "MASTER_HOST", 0, 0, 0, ""),
731
Commands( "MASTER_LOG_FILE", 0, 0, 0, ""),
732
Commands( "MASTER_LOG_POS", 0, 0, 0, ""),
733
Commands( "MASTER_PASSWORD", 0, 0, 0, ""),
734
Commands( "MASTER_PORT", 0, 0, 0, ""),
735
Commands( "MASTER_SERVER_ID", 0, 0, 0, ""),
736
Commands( "MASTER_SSL", 0, 0, 0, ""),
737
Commands( "MASTER_SSL_CA", 0, 0, 0, ""),
738
Commands( "MASTER_SSL_CAPATH", 0, 0, 0, ""),
739
Commands( "MASTER_SSL_CERT", 0, 0, 0, ""),
740
Commands( "MASTER_SSL_CIPHER", 0, 0, 0, ""),
741
Commands( "MASTER_SSL_KEY", 0, 0, 0, ""),
742
Commands( "MASTER_USER", 0, 0, 0, ""),
716
743
Commands( "MATCH", 0, 0, 0, ""),
717
744
Commands( "MAX_CONNECTIONS_PER_HOUR", 0, 0, 0, ""),
718
745
Commands( "MAX_QUERIES_PER_HOUR", 0, 0, 0, ""),
720
747
Commands( "MAX_UPDATES_PER_HOUR", 0, 0, 0, ""),
721
748
Commands( "MAX_USER_CONNECTIONS", 0, 0, 0, ""),
722
749
Commands( "MEDIUM", 0, 0, 0, ""),
750
Commands( "MEDIUMTEXT", 0, 0, 0, ""),
723
751
Commands( "MERGE", 0, 0, 0, ""),
724
752
Commands( "MICROSECOND", 0, 0, 0, ""),
753
Commands( "MIDDLEINT", 0, 0, 0, ""),
725
754
Commands( "MIGRATE", 0, 0, 0, ""),
726
755
Commands( "MINUTE", 0, 0, 0, ""),
727
756
Commands( "MINUTE_MICROSECOND", 0, 0, 0, ""),
740
769
Commands( "NAMES", 0, 0, 0, ""),
741
770
Commands( "NATIONAL", 0, 0, 0, ""),
742
771
Commands( "NATURAL", 0, 0, 0, ""),
772
Commands( "NDB", 0, 0, 0, ""),
773
Commands( "NDBCLUSTER", 0, 0, 0, ""),
743
774
Commands( "NCHAR", 0, 0, 0, ""),
744
775
Commands( "NEW", 0, 0, 0, ""),
745
776
Commands( "NEXT", 0, 0, 0, ""),
746
777
Commands( "NO", 0, 0, 0, ""),
747
778
Commands( "NONE", 0, 0, 0, ""),
748
779
Commands( "NOT", 0, 0, 0, ""),
780
Commands( "NO_WRITE_TO_BINLOG", 0, 0, 0, ""),
749
781
Commands( "NULL", 0, 0, 0, ""),
750
782
Commands( "NUMERIC", 0, 0, 0, ""),
751
783
Commands( "NVARCHAR", 0, 0, 0, ""),
752
784
Commands( "OFFSET", 0, 0, 0, ""),
785
Commands( "OLD_PASSWORD", 0, 0, 0, ""),
753
786
Commands( "ON", 0, 0, 0, ""),
754
787
Commands( "ONE", 0, 0, 0, ""),
755
788
Commands( "ONE_SHOT", 0, 0, 0, ""),
766
799
Commands( "PARTIAL", 0, 0, 0, ""),
767
800
Commands( "PASSWORD", 0, 0, 0, ""),
768
801
Commands( "PHASE", 0, 0, 0, ""),
802
Commands( "POINT", 0, 0, 0, ""),
803
Commands( "POLYGON", 0, 0, 0, ""),
769
804
Commands( "PRECISION", 0, 0, 0, ""),
770
805
Commands( "PREPARE", 0, 0, 0, ""),
771
806
Commands( "PREV", 0, 0, 0, ""),
785
820
Commands( "REDUNDANT", 0, 0, 0, ""),
786
821
Commands( "REFERENCES", 0, 0, 0, ""),
787
822
Commands( "REGEXP", 0, 0, 0, ""),
823
Commands( "RELAY_LOG_FILE", 0, 0, 0, ""),
824
Commands( "RELAY_LOG_POS", 0, 0, 0, ""),
825
Commands( "RELAY_THREAD", 0, 0, 0, ""),
788
826
Commands( "RELEASE", 0, 0, 0, ""),
789
827
Commands( "RELOAD", 0, 0, 0, ""),
790
828
Commands( "RENAME", 0, 0, 0, ""),
791
829
Commands( "REPAIR", 0, 0, 0, ""),
792
830
Commands( "REPEATABLE", 0, 0, 0, ""),
793
831
Commands( "REPLACE", 0, 0, 0, ""),
832
Commands( "REPLICATION", 0, 0, 0, ""),
794
833
Commands( "REPEAT", 0, 0, 0, ""),
795
834
Commands( "REQUIRE", 0, 0, 0, ""),
796
835
Commands( "RESET", 0, 0, 0, ""),
829
868
Commands( "SIMPLE", 0, 0, 0, ""),
830
869
Commands( "SLAVE", 0, 0, 0, ""),
831
870
Commands( "SNAPSHOT", 0, 0, 0, ""),
871
Commands( "SMALLINT", 0, 0, 0, ""),
832
872
Commands( "SOME", 0, 0, 0, ""),
833
873
Commands( "SONAME", 0, 0, 0, ""),
834
874
Commands( "SOUNDS", 0, 0, 0, ""),
877
917
Commands( "TIMESTAMP", 0, 0, 0, ""),
878
918
Commands( "TIMESTAMPADD", 0, 0, 0, ""),
879
919
Commands( "TIMESTAMPDIFF", 0, 0, 0, ""),
920
Commands( "TINYTEXT", 0, 0, 0, ""),
880
921
Commands( "TO", 0, 0, 0, ""),
881
922
Commands( "TRAILING", 0, 0, 0, ""),
882
923
Commands( "TRANSACTION", 0, 0, 0, ""),
924
Commands( "TRIGGER", 0, 0, 0, ""),
925
Commands( "TRIGGERS", 0, 0, 0, ""),
883
926
Commands( "TRUE", 0, 0, 0, ""),
884
927
Commands( "TRUNCATE", 0, 0, 0, ""),
885
928
Commands( "TYPE", 0, 0, 0, ""),
892
935
Commands( "UNIQUE", 0, 0, 0, ""),
893
936
Commands( "UNKNOWN", 0, 0, 0, ""),
894
937
Commands( "UNLOCK", 0, 0, 0, ""),
938
Commands( "UNSIGNED", 0, 0, 0, ""),
895
939
Commands( "UNTIL", 0, 0, 0, ""),
896
940
Commands( "UPDATE", 0, 0, 0, ""),
897
941
Commands( "UPGRADE", 0, 0, 0, ""),
899
943
Commands( "USE", 0, 0, 0, ""),
900
944
Commands( "USER", 0, 0, 0, ""),
901
945
Commands( "USER_RESOURCES", 0, 0, 0, ""),
946
Commands( "USE_FRM", 0, 0, 0, ""),
902
947
Commands( "USING", 0, 0, 0, ""),
903
948
Commands( "UTC_DATE", 0, 0, 0, ""),
904
949
Commands( "UTC_TIMESTAMP", 0, 0, 0, ""),
918
963
Commands( "WITH", 0, 0, 0, ""),
919
964
Commands( "WORK", 0, 0, 0, ""),
920
965
Commands( "WRITE", 0, 0, 0, ""),
966
Commands( "X509", 0, 0, 0, ""),
921
967
Commands( "XOR", 0, 0, 0, ""),
922
968
Commands( "XA", 0, 0, 0, ""),
923
969
Commands( "YEAR", 0, 0, 0, ""),
926
972
Commands( "ABS", 0, 0, 0, ""),
927
973
Commands( "ACOS", 0, 0, 0, ""),
928
974
Commands( "ADDDATE", 0, 0, 0, ""),
975
Commands( "AES_ENCRYPT", 0, 0, 0, ""),
976
Commands( "AES_DECRYPT", 0, 0, 0, ""),
929
977
Commands( "AREA", 0, 0, 0, ""),
930
978
Commands( "ASIN", 0, 0, 0, ""),
931
979
Commands( "ASBINARY", 0, 0, 0, ""),
932
980
Commands( "ASTEXT", 0, 0, 0, ""),
981
Commands( "ASWKB", 0, 0, 0, ""),
982
Commands( "ASWKT", 0, 0, 0, ""),
933
983
Commands( "ATAN", 0, 0, 0, ""),
934
984
Commands( "ATAN2", 0, 0, 0, ""),
935
985
Commands( "BENCHMARK", 0, 0, 0, ""),
995
1045
Commands( "GROUP_UNIQUE_USERS", 0, 0, 0, ""),
996
1046
Commands( "HEX", 0, 0, 0, ""),
997
1047
Commands( "IFNULL", 0, 0, 0, ""),
1048
Commands( "INET_ATON", 0, 0, 0, ""),
1049
Commands( "INET_NTOA", 0, 0, 0, ""),
998
1050
Commands( "INSTR", 0, 0, 0, ""),
999
1051
Commands( "INTERIORRINGN", 0, 0, 0, ""),
1000
1052
Commands( "INTERSECTS", 0, 0, 0, ""),
1010
1062
Commands( "LEAST", 0, 0, 0, ""),
1011
1063
Commands( "LENGTH", 0, 0, 0, ""),
1012
1064
Commands( "LN", 0, 0, 0, ""),
1065
Commands( "LINEFROMTEXT", 0, 0, 0, ""),
1066
Commands( "LINEFROMWKB", 0, 0, 0, ""),
1067
Commands( "LINESTRINGFROMTEXT", 0, 0, 0, ""),
1068
Commands( "LINESTRINGFROMWKB", 0, 0, 0, ""),
1013
1069
Commands( "LOAD_FILE", 0, 0, 0, ""),
1014
1070
Commands( "LOCATE", 0, 0, 0, ""),
1015
1071
Commands( "LOG", 0, 0, 0, ""),
1032
1088
Commands( "MD5", 0, 0, 0, ""),
1033
1089
Commands( "MID", 0, 0, 0, ""),
1034
1090
Commands( "MIN", 0, 0, 0, ""),
1091
Commands( "MLINEFROMTEXT", 0, 0, 0, ""),
1092
Commands( "MLINEFROMWKB", 0, 0, 0, ""),
1093
Commands( "MPOINTFROMTEXT", 0, 0, 0, ""),
1094
Commands( "MPOINTFROMWKB", 0, 0, 0, ""),
1095
Commands( "MPOLYFROMTEXT", 0, 0, 0, ""),
1096
Commands( "MPOLYFROMWKB", 0, 0, 0, ""),
1035
1097
Commands( "MONTHNAME", 0, 0, 0, ""),
1098
Commands( "MULTILINESTRINGFROMTEXT", 0, 0, 0, ""),
1099
Commands( "MULTILINESTRINGFROMWKB", 0, 0, 0, ""),
1100
Commands( "MULTIPOINTFROMTEXT", 0, 0, 0, ""),
1101
Commands( "MULTIPOINTFROMWKB", 0, 0, 0, ""),
1102
Commands( "MULTIPOLYGONFROMTEXT", 0, 0, 0, ""),
1103
Commands( "MULTIPOLYGONFROMWKB", 0, 0, 0, ""),
1036
1104
Commands( "NAME_CONST", 0, 0, 0, ""),
1037
1105
Commands( "NOW", 0, 0, 0, ""),
1038
1106
Commands( "NULLIF", 0, 0, 0, ""),
1107
Commands( "NUMINTERIORRINGS", 0, 0, 0, ""),
1039
1108
Commands( "NUMPOINTS", 0, 0, 0, ""),
1040
1109
Commands( "OCTET_LENGTH", 0, 0, 0, ""),
1041
1110
Commands( "OCT", 0, 0, 0, ""),
1044
1113
Commands( "PERIOD_ADD", 0, 0, 0, ""),
1045
1114
Commands( "PERIOD_DIFF", 0, 0, 0, ""),
1046
1115
Commands( "PI", 0, 0, 0, ""),
1116
Commands( "POINTFROMTEXT", 0, 0, 0, ""),
1117
Commands( "POINTFROMWKB", 0, 0, 0, ""),
1047
1118
Commands( "POINTN", 0, 0, 0, ""),
1119
Commands( "POLYFROMTEXT", 0, 0, 0, ""),
1120
Commands( "POLYFROMWKB", 0, 0, 0, ""),
1121
Commands( "POLYGONFROMTEXT", 0, 0, 0, ""),
1122
Commands( "POLYGONFROMWKB", 0, 0, 0, ""),
1048
1123
Commands( "POSITION", 0, 0, 0, ""),
1049
1124
Commands( "POW", 0, 0, 0, ""),
1050
1125
Commands( "POWER", 0, 0, 0, ""),
1293
1368
N_("Display column type information."))
1294
1369
("comments,c", po::value<bool>(&preserve_comments)->default_value(false)->zero_tokens(),
1295
1370
N_("Preserve comments. Send comments to the server. The default is --skip-comments (discard comments), enable with --comments"))
1371
("compress,C", po::value<bool>(&opt_compress)->default_value(false)->zero_tokens(),
1372
N_("Use compression in server/client protocol."))
1296
1373
("vertical,E", po::value<bool>(&vertical)->default_value(false)->zero_tokens(),
1297
1374
N_("Print the output of a query (rows) vertically."))
1298
1375
("force,f", po::value<bool>(&ignore_errors)->default_value(false)->zero_tokens(),
1299
1376
N_("Continue even if we get an sql error."))
1300
1377
("named-commands,G", po::value<bool>(&named_cmds)->default_value(false)->zero_tokens(),
1301
N_("Enable named commands. Named commands mean this program's internal commands; see drizzle> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter."))
1378
N_("Enable named commands. Named commands mean this program's internal commands; see drizzle> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default."))
1379
("no-named-commands,g",
1380
N_("Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead."))
1381
("ignore-spaces,i", N_("Ignore space after function names."))
1302
1382
("no-beep,b", po::value<bool>(&opt_nobeep)->default_value(false)->zero_tokens(),
1303
1383
N_("Turn off beep on error."))
1304
("disable-line-numbers", N_("Do not write line numbers for errors."))
1305
("disable-column-names", N_("Do not write column names in results."))
1384
("line-numbers", po::value<bool>(&line_numbers)->default_value(true)->zero_tokens(),
1385
N_("Write line numbers for errors."))
1386
("skip-line-numbers,L",
1387
N_("Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead."))
1388
("column-name", po::value<bool>(&column_names)->default_value(true)->zero_tokens(),
1389
N_("Write column names in results."))
1306
1390
("skip-column-names,N",
1307
1391
N_("Don't write column names in results. WARNING: -N is deprecated, use long version of this options instead."))
1308
1392
("set-variable,O", po::value<string>(),
1309
1393
N_("Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value."))
1310
1394
("table,t", po::value<bool>(&output_tables)->default_value(false)->zero_tokens(),
1311
1395
N_("Output in table format."))
1312
("safe-updates,U", po::value<bool>(&safe_updates)->default_value(false)->zero_tokens(),
1396
("safe-updates,U", po::value<bool>(&safe_updates)->default_value(0)->zero_tokens(),
1313
1397
N_("Only allow UPDATE and DELETE that uses keys."))
1314
("i-am-a-dummy,U", po::value<bool>(&safe_updates)->default_value(false)->zero_tokens(),
1398
("i-am-a-dummy,U", po::value<bool>(&safe_updates)->default_value(0)->zero_tokens(),
1315
1399
N_("Synonym for option --safe-updates, -U."))
1316
1400
("verbose,v", po::value<string>(&opt_verbose)->default_value(""),
1317
1401
N_("-v vvv implies that verbose= 3, Used to specify verbose"))
1331
1415
po::options_description drizzle_options(N_("Options specific to the drizzle client"));
1332
1416
drizzle_options.add_options()
1333
("disable-auto-rehash,A",
1334
N_("Disable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time."))
1417
("auto-rehash", po::value<bool>(&opt_rehash)->default_value(true)->zero_tokens(),
1418
N_("Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash."))
1419
("no-auto-rehash,A",N_("No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of drizzle_st and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead."))
1335
1420
("auto-vertical-output", po::value<bool>(&auto_vertical_output)->default_value(false)->zero_tokens(),
1336
1421
N_("Automatically switch to vertical output mode if the result is wider than the terminal width."))
1337
1422
("database,D", po::value<string>(¤t_db)->default_value(""),
1343
1428
("execute,e", po::value<string>(),
1344
1429
N_("Execute command and quit. (Disables --force and history file)"))
1345
1430
("local-infile", po::value<bool>(&opt_local_infile)->default_value(false)->zero_tokens(),
1346
N_("Enable LOAD DATA LOCAL INFILE."))
1431
N_("Enable/disable LOAD DATA LOCAL INFILE."))
1347
1432
("unbuffered,n", po::value<bool>(&unbuffered)->default_value(false)->zero_tokens(),
1348
1433
N_("Flush buffer after each query."))
1349
1434
("sigint-ignore", po::value<bool>(&opt_sigint_ignore)->default_value(false)->zero_tokens(),
1360
1445
N_("Don't cache result, print it row by row. This may slow down the server if the output is suspended. Doesn't use history file."))
1361
1446
("raw,r", po::value<bool>(&opt_raw_data)->default_value(false)->zero_tokens(),
1362
1447
N_("Write fields without conversion. Used with --batch."))
1363
("disable-reconnect", N_("Do not reconnect if the connection is lost."))
1364
("shutdown", po::value<bool>()->zero_tokens(),
1448
("reconnect", po::value<bool>(&opt_reconnect)->default_value(true)->zero_tokens(),
1449
N_("Reconnect if the connection is lost. Disable with --disable-reconnect. This option is enabled by default."))
1450
("shutdown", po::value<bool>(&opt_shutdown)->default_value(false)->zero_tokens(),
1365
1451
N_("Shutdown the server"))
1366
1452
("silent,s", N_("Be more silent. Print results with a tab as separator, each row on new line."))
1367
1453
("tee", po::value<string>(),
1368
1454
N_("Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode. Disable with --disable-tee. This option is disabled by default."))
1369
1455
("disable-tee", po::value<bool>()->default_value(false)->zero_tokens(),
1370
1456
N_("Disable outfile. See interactive help (\\h) also."))
1371
("connect-timeout", po::value<uint32_t>(&opt_connect_timeout)->default_value(0)->notifier(&check_timeout_value),
1457
("wait,w", N_("Wait and retry if connection is down."))
1458
("connect_timeout", po::value<uint32_t>(&opt_connect_timeout)->default_value(0)->notifier(&check_timeout_value),
1372
1459
N_("Number of seconds before connection timeout."))
1373
("max-input-line", po::value<uint32_t>(&opt_max_input_line)->default_value(16*1024L*1024L)->notifier(&check_max_input_line),
1460
("max_input_line", po::value<uint32_t>(&opt_max_input_line)->default_value(16*1024L*1024L)->notifier(&check_max_input_line),
1374
1461
N_("Max length of input line"))
1375
("select-limit", po::value<uint32_t>(&select_limit)->default_value(1000L),
1462
("select_limit", po::value<uint32_t>(&select_limit)->default_value(1000L),
1376
1463
N_("Automatic limit for SELECT when using --safe-updates"))
1377
("max-join-size", po::value<uint32_t>(&max_join_size)->default_value(1000000L),
1464
("max_join_size", po::value<uint32_t>(&max_join_size)->default_value(1000000L),
1378
1465
N_("Automatic limit for rows in a join when using --safe-updates"))
1386
1473
N_("Password to use when connecting to server. If password is not given it's asked from the tty."))
1387
1474
("port,p", po::value<uint32_t>()->default_value(0),
1388
1475
N_("Port number to use for connection or 0 for default to, in order of preference, drizzle.cnf, $DRIZZLE_TCP_PORT, built-in default"))
1389
#ifdef DRIZZLE_ADMIN_TOOL
1390
("user,u", po::value<string>(¤t_user)->default_value("root"),
1392
1476
("user,u", po::value<string>(¤t_user)->default_value(""),
1394
1477
N_("User for login if not current user."))
1395
1478
("protocol",po::value<string>(&opt_protocol)->default_value("mysql"),
1396
1479
N_("The protocol of connection (mysql or drizzle)."))
1406
1489
system_config_dir_client.append("/drizzle/client.cnf");
1408
1491
std::string user_config_dir((getenv("XDG_CONFIG_HOME")? getenv("XDG_CONFIG_HOME"):"~/.config"));
1410
if (user_config_dir.compare(0, 2, "~/") == 0)
1413
homedir= getenv("HOME");
1414
if (homedir != NULL)
1415
user_config_dir.replace(0, 1, homedir);
1418
1493
po::variables_map vm;
1420
1495
po::positional_options_description p;
1421
1496
p.add("database", 1);
1423
// Disable allow_guessing
1424
int style = po::command_line_style::default_style & ~po::command_line_style::allow_guessing;
1426
1498
po::store(po::command_line_parser(argc, argv).options(long_options).
1427
style(style).positional(p).extra_parser(parse_password_arg).run(),
1499
positional(p).extra_parser(parse_password_arg).run(), vm);
1430
1501
if (! vm["no-defaults"].as<bool>())
1436
1507
user_config_dir_client.append("/drizzle/client.cnf");
1438
1509
ifstream user_drizzle_ifs(user_config_dir_drizzle.c_str());
1439
po::store(dpo::parse_config_file(user_drizzle_ifs, drizzle_options), vm);
1510
po::store(parse_config_file(user_drizzle_ifs, drizzle_options), vm);
1441
1512
ifstream user_client_ifs(user_config_dir_client.c_str());
1442
po::store(dpo::parse_config_file(user_client_ifs, client_options), vm);
1513
po::store(parse_config_file(user_client_ifs, client_options), vm);
1444
1515
ifstream system_drizzle_ifs(system_config_dir_drizzle.c_str());
1445
store(dpo::parse_config_file(system_drizzle_ifs, drizzle_options), vm);
1516
store(parse_config_file(system_drizzle_ifs, drizzle_options), vm);
1447
1518
ifstream system_client_ifs(system_config_dir_client.c_str());
1448
po::store(dpo::parse_config_file(system_client_ifs, client_options), vm);
1519
po::store(parse_config_file(system_client_ifs, client_options), vm);
1451
1522
po::notify(vm);
1453
#ifdef DRIZZLE_ADMIN_TOOL
1454
default_prompt= strdup(getenv("DRIZZLE_PS1") ?
1455
getenv("DRIZZLE_PS1") :
1458
1524
default_prompt= strdup(getenv("DRIZZLE_PS1") ?
1459
1525
getenv("DRIZZLE_PS1") :
1462
1527
if (default_prompt == NULL)
1464
1529
fprintf(stderr, _("Memory allocation error while constructing initial "
1868
1921
sprintf(kill_buffer, "KILL /*!50000 QUERY */ %u",
1869
1922
drizzle_con_thread_id(&con));
1871
if (drizzle_query_str(kill_drizzle.get(), &res, kill_buffer, &ret) != NULL)
1924
if (drizzle_query_str(&kill_drizzle, &res, kill_buffer, &ret) != NULL)
1872
1925
drizzle_result_free(&res);
1874
drizzle_con_free(kill_drizzle.get());
1927
drizzle_con_free(&kill_drizzle);
1875
1928
tee_fprintf(stdout, _("Query aborted by Ctrl+C\n"));
1877
1930
interrupted_query= 1;
3920
static int com_shutdown(string *, const char *)
3922
drizzle_result_st result;
3923
drizzle_return_t ret;
3927
printf(_("shutting down drizzled"));
3928
if (opt_drizzle_port > 0)
3929
printf(_(" on port %d"), opt_drizzle_port);
3933
if (drizzle_shutdown(&con, &result, DRIZZLE_SHUTDOWN_DEFAULT,
3934
&ret) == NULL || ret != DRIZZLE_RETURN_OK)
3936
if (ret == DRIZZLE_RETURN_ERROR_CODE)
3938
fprintf(stderr, _("shutdown failed; error: '%s'"),
3939
drizzle_result_error(&result));
3940
drizzle_result_free(&result);
3944
fprintf(stderr, _("shutdown failed; error: '%s'"),
3945
drizzle_con_error(&con));
3950
drizzle_result_free(&result);
3953
printf(_("done\n"));
3959
3968
com_warnings(string *, const char *)
4045
4054
drizzle_free(&drizzle);
4047
4056
drizzle_create(&drizzle);
4049
#ifdef DRIZZLE_ADMIN_TOOL
4050
drizzle_con_options_t options= (drizzle_con_options_t) (DRIZZLE_CON_ADMIN | (use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL));
4052
drizzle_con_options_t options= (drizzle_con_options_t) (use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL);
4055
4057
if (drizzle_con_add_tcp(&drizzle, &con, (char *)host.c_str(),
4056
4058
opt_drizzle_port, (char *)user.c_str(),
4057
4059
(char *)password.c_str(), (char *)database.c_str(),
4060
use_drizzle_protocol ? DRIZZLE_CON_EXPERIMENTAL : DRIZZLE_CON_MYSQL) == NULL)
4060
4062
(void) put_error(&con, NULL);
4061
4063
(void) fflush(stdout);