2449
MY_INIT("drizzledump");
2450
2394
drizzle_result_st result;
2452
po::options_description commandline_options("Options used only in command line");
2396
po::options_description commandline_options(N_("Options used only in command line"));
2453
2397
commandline_options.add_options()
2454
2398
("all-databases,A", po::value<bool>(&opt_alldbs)->default_value(false)->zero_tokens(),
2455
"Dump all the databases. This will be same as --databases with all databases selected.")
2399
N_("Dump all the databases. This will be same as --databases with all databases selected."))
2456
2400
("all-tablespaces,Y", po::value<bool>(&opt_alltspcs)->default_value(false)->zero_tokens(),
2457
"Dump all the tablespaces.")
2401
N_("Dump all the tablespaces."))
2458
2402
("complete-insert,c", po::value<bool>(&opt_complete_insert)->default_value(false)->zero_tokens(),
2459
"Use complete insert statements.")
2403
N_("Use complete insert statements."))
2460
2404
("compress,C", po::value<bool>(&opt_compress)->default_value(false)->zero_tokens(),
2461
"Use compression in server/client protocol.")
2405
N_("Use compression in server/client protocol."))
2462
2406
("flush-logs,F", po::value<bool>(&flush_logs)->default_value(false)->zero_tokens(),
2463
"Flush logs file in server before starting dump. Note that if you dump many databases at once (using the option --databases= or --all-databases), the logs will be flushed for each database dumped. The exception is when using --lock-all-tables in this case the logs will be flushed only once, corresponding to the moment all tables are locked. So if you want your dump and the log flush to happen at the same exact moment you should use --lock-all-tables or --flush-logs")
2407
N_("Flush logs file in server before starting dump. Note that if you dump many databases at once (using the option --databases= or --all-databases), the logs will be flushed for each database dumped. The exception is when using --lock-all-tables in this case the logs will be flushed only once, corresponding to the moment all tables are locked. So if you want your dump and the log flush to happen at the same exact moment you should use --lock-all-tables or --flush-logs"))
2464
2408
("force,f", po::value<bool>(&ignore_errors)->default_value(false)->zero_tokens(),
2465
"Continue even if we get an sql-error.")
2466
("help,?", "Display this help message and exit.")
2409
N_("Continue even if we get an sql-error."))
2410
("help,?", N_("Display this help message and exit."))
2467
2411
("lock-all-tables,x", po::value<bool>(&opt_lock_all_tables)->default_value(false)->zero_tokens(),
2468
"Locks all tables across all databases. This is achieved by taking a global read lock for the duration of the whole dump. Automatically turns --single-transaction and --lock-tables off.")
2412
N_("Locks all tables across all databases. This is achieved by taking a global read lock for the duration of the whole dump. Automatically turns --single-transaction and --lock-tables off."))
2469
2413
("order-by-primary", po::value<bool>(&opt_order_by_primary)->default_value(false)->zero_tokens(),
2470
"Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.")
2471
("routines,R", po::value<bool>(&opt_routines)->default_value(false)->zero_tokens(),
2472
"Dump stored routines (functions and procedures).")
2414
N_("Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer."))
2473
2415
("single-transaction", po::value<bool>(&opt_single_transaction)->default_value(false)->zero_tokens(),
2474
"Creates a consistent snapshot by dumping all tables in a single transaction. Works ONLY for tables stored in storage engines which support multiversioning (currently only InnoDB does); the dump is NOT guaranteed to be consistent for other storage engines. While a --single-transaction dump is in process, to ensure a valid dump file (correct table contents), no other connection should use the following statements: ALTER TABLE, DROP TABLE, RENAME TABLE, TRUNCATE TABLE, as consistent snapshot is not isolated from them. Option automatically turns off --lock-tables.")
2475
("opt", "Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt.")
2416
N_("Creates a consistent snapshot by dumping all tables in a single transaction. Works ONLY for tables stored in storage engines which support multiversioning (currently only InnoDB does); the dump is NOT guaranteed to be consistent for other storage engines. While a --single-transaction dump is in process, to ensure a valid dump file (correct table contents), no other connection should use the following statements: ALTER TABLE, DROP TABLE, RENAME TABLE, TRUNCATE TABLE, as consistent snapshot is not isolated from them. Option automatically turns off --lock-tables."))
2417
("opt", N_("Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt."))
2477
"Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.")
2478
("tables", "Overrides option --databases (-B).")
2419
N_("Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys."))
2420
("tables", N_("Overrides option --databases (-B)."))
2479
2421
("show-progress-size", po::value<uint32_t>(&show_progress_size)->default_value(10000),
2480
2422
N_("Number of rows before each output progress report (requires --verbose)."))
2481
2423
("verbose,v", po::value<bool>(&verbose)->default_value(false)->zero_tokens(),
2482
"Print info about the various stages.")
2483
("version,V", "Output version information and exit.")
2484
("xml,X", "Dump a database as well formed XML.")
2485
("skip-comments", "Turn off Comments")
2486
("skip-create", "Turn off create-options")
2487
("skip-extended-insert", "Turn off extended-insert")
2488
("skip-dump-date", "Turn off dump-date")
2489
("no-defaults", "Do not read from the configuration files")
2424
N_("Print info about the various stages."))
2425
("version,V", N_("Output version information and exit."))
2426
("xml,X", N_("Dump a database as well formed XML."))
2427
("skip-comments", N_("Turn off Comments"))
2428
("skip-create", N_("Turn off create-options"))
2429
("skip-extended-insert", N_("Turn off extended-insert"))
2430
("skip-dump-date",N_( "Turn off dump-date"))
2431
("no-defaults", N_("Do not read from the configuration files"))
2492
po::options_description dump_options("Options specific to the drizzle client");
2434
po::options_description dump_options(N_("Options specific to the drizzle client"));
2493
2435
dump_options.add_options()
2494
2436
("add-drop-database", po::value<bool>(&opt_drop_database)->default_value(false)->zero_tokens(),
2495
"Add a 'DROP DATABASE' before each create.")
2437
N_("Add a 'DROP DATABASE' before each create."))
2496
2438
("add-drop-table", po::value<bool>(&opt_drop)->default_value(true)->zero_tokens(),
2497
"Add a 'drop table' before each create.")
2439
N_("Add a 'drop table' before each create."))
2498
2440
("allow-keywords", po::value<bool>(&opt_keywords)->default_value(false)->zero_tokens(),
2499
"Allow creation of column names that are keywords.")
2441
N_("Allow creation of column names that are keywords."))
2500
2442
("comments,i", po::value<bool>(&opt_comments)->default_value(true)->zero_tokens(),
2501
"Write additional information.")
2502
("compatible", po::value<string>(&opt_compatible_mode_str)->default_value(""),
2503
"Change the dump to be compatible with a given mode. By default tables are dumped in a format optimized for MySQL. Legal modes are: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires DRIZZLE server version 4.1.0 or higher. This option is ignored with earlier server versions.")
2443
N_("Write additional information."))
2504
2444
("compact", po::value<bool>(&opt_compact)->default_value(false)->zero_tokens(),
2505
"Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options --skip-add-drop-table --no-set-names --skip-disable-keys --skip-add-locks")
2445
N_("Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options --skip-add-drop-table --no-set-names --skip-disable-keys --skip-add-locks"))
2506
2446
("create-options", po::value<bool>(&create_options)->default_value(true)->zero_tokens(),
2507
"Include all DRIZZLE specific create options.")
2447
N_("Include all DRIZZLE specific create options."))
2508
2448
("dump-date", po::value<bool>(&opt_dump_date)->default_value(true)->zero_tokens(),
2509
"Put a dump date to the end of the output.")
2449
N_("Put a dump date to the end of the output."))
2510
2450
("databases,B", po::value<bool>(&opt_databases)->default_value(false)->zero_tokens(),
2511
"To dump several databases. Note the difference in usage; In this case no tables are given. All name arguments are regarded as databasenames. 'USE db_name;' will be included in the output.")
2451
N_("To dump several databases. Note the difference in usage; In this case no tables are given. All name arguments are regarded as databasenames. 'USE db_name;' will be included in the output."))
2512
2452
("delayed-insert", po::value<bool>(&opt_delayed)->default_value(false)->zero_tokens(),
2513
"Insert rows with INSERT DELAYED; ")
2453
N_("Insert rows with INSERT DELAYED;"))
2514
2454
("disable-keys,K", po::value<bool>(&opt_disable_keys)->default_value(true)->zero_tokens(),
2515
"'ALTER TABLE tb_name DISABLE KEYS; and 'ALTER TABLE tb_name ENABLE KEYS; will be put in the output.")
2455
N_("'ALTER TABLE tb_name DISABLE KEYS; and 'ALTER TABLE tb_name ENABLE KEYS; will be put in the output."))
2516
2456
("extended-insert,e", po::value<bool>(&extended_insert)->default_value(true)->zero_tokens(),
2517
"Allows utilization of the new, much faster INSERT syntax.")
2457
N_("Allows utilization of the new, much faster INSERT syntax."))
2518
2458
("fields-terminated-by", po::value<string>(&fields_terminated)->default_value(""),
2519
"Fields in the textfile are terminated by ...")
2459
N_("Fields in the textfile are terminated by ..."))
2520
2460
("fields-enclosed-by", po::value<string>(&enclosed)->default_value(""),
2521
"Fields in the importfile are enclosed by ...")
2461
N_("Fields in the importfile are enclosed by ..."))
2522
2462
("fields-optionally-enclosed-by", po::value<string>(&opt_enclosed)->default_value(""),
2523
"Fields in the i.file are opt. enclosed by ...")
2463
N_("Fields in the i.file are opt. enclosed by ..."))
2524
2464
("fields-escaped-by", po::value<string>(&escaped)->default_value(""),
2525
"Fields in the i.file are escaped by ...")
2465
N_("Fields in the i.file are escaped by ..."))
2526
2466
("hex-blob", po::value<bool>(&opt_hex_blob)->default_value(false)->zero_tokens(),
2527
2467
"Dump binary strings (BINARY, VARBINARY, BLOB) in hexadecimal format.")
2528
2468
("ignore-table", po::value<string>(),
2529
"Do not dump the specified table. To specify more than one table to ignore, use the directive multiple times, once for each table. Each table must be specified with both database and table names, e.g. --ignore-table=database.table")
2469
N_("Do not dump the specified table. To specify more than one table to ignore, use the directive multiple times, once for each table. Each table must be specified with both database and table names, e.g. --ignore-table=database.table"))
2530
2470
("insert-ignore", po::value<bool>(&opt_ignore)->default_value(false)->zero_tokens(),
2531
"Insert rows with INSERT IGNORE.")
2471
N_("Insert rows with INSERT IGNORE."))
2532
2472
("lines-terminated-by", po::value<string>(&lines_terminated)->default_value(""),
2533
"Lines in the i.file are terminated by ...")
2473
N_("Lines in the i.file are terminated by ..."))
2534
2474
("no-autocommit", po::value<bool>(&opt_autocommit)->default_value(false)->zero_tokens(),
2535
"Wrap tables with autocommit/commit statements.")
2475
N_("Wrap tables with autocommit/commit statements."))
2536
2476
("no-create-db,n", po::value<bool>(&opt_create_db)->default_value(false)->zero_tokens(),
2537
"'CREATE DATABASE IF NOT EXISTS db_name;' will not be put in the output. The above line will be added otherwise, if --databases or --all-databases option was given.}.")
2477
N_("'CREATE DATABASE IF NOT EXISTS db_name;' will not be put in the output. The above line will be added otherwise, if --databases or --all-databases option was given."))
2538
2478
("no-create-info,t", po::value<bool>(&opt_no_create_info)->default_value(false)->zero_tokens(),
2539
"Don't write table creation info.")
2479
N_("Don't write table creation info."))
2540
2480
("no-data,d", po::value<bool>(&opt_no_data)->default_value(false)->zero_tokens(),
2541
"No row information.")
2542
("no-set-names,N", "Deprecated. Use --skip-set-charset instead.")
2481
N_("No row information."))
2482
("no-set-names,N", N_("Deprecated. Use --skip-set-charset instead."))
2543
2483
("set-charset", po::value<bool>(&opt_set_charset)->default_value(false)->zero_tokens(),
2484
N_("Enable set-name"))
2545
2485
("quick,q", po::value<bool>(&quick)->default_value(true)->zero_tokens(),
2546
"Don't buffer query, dump directly to stdout.")
2486
N_("Don't buffer query, dump directly to stdout."))
2547
2487
("quote-names,Q", po::value<bool>(&opt_quoted)->default_value(true)->zero_tokens(),
2548
"Quote table and column names with backticks (`).")
2488
N_("Quote table and column names with backticks (`)."))
2549
2489
("replace", po::value<bool>(&opt_replace_into)->default_value(false)->zero_tokens(),
2550
"Use REPLACE INTO instead of INSERT INTO.")
2490
N_("Use REPLACE INTO instead of INSERT INTO."))
2551
2491
("result-file,r", po::value<string>(),
2552
"Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).")
2492
N_("Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed)."))
2553
2493
("tab,T", po::value<string>(&path)->default_value(""),
2554
"Creates tab separated textfile for each table to given path. (creates .sql and .txt files). NOTE: This only works if drizzledump is run on the same machine as the drizzled daemon.")
2494
N_("Creates tab separated textfile for each table to given path. (creates .sql and .txt files). NOTE: This only works if drizzledump is run on the same machine as the drizzled daemon."))
2555
2495
("where,w", po::value<string>(&where)->default_value(""),
2556
"Dump only selected records; QUOTES mandatory!")
2496
N_("Dump only selected records; QUOTES mandatory!"))
2559
po::options_description client_options("Options specific to the client");
2499
po::options_description client_options(N_("Options specific to the client"));
2560
2500
client_options.add_options()
2561
2501
("host,h", po::value<string>(¤t_host)->default_value("localhost"),
2563
("mysql,m", po::value<bool>(&opt_mysql)->default_value(true)->zero_tokens(),
2564
N_("Use MySQL Protocol."))
2502
N_("Connect to host."))
2565
2503
("password,P", po::value<string>(&password)->default_value(PASSWORD_SENTINEL),
2566
"Password to use when connecting to server. If password is not given it's solicited on the tty.")
2504
N_("Password to use when connecting to server. If password is not given it's solicited on the tty."))
2567
2505
("port,p", po::value<uint32_t>(&opt_drizzle_port)->default_value(0),
2568
"Port number to use for connection.")
2506
N_("Port number to use for connection."))
2569
2507
("user,u", po::value<string>(¤t_user)->default_value(""),
2570
"User for login if not current user.")
2571
("protocol",po::value<string>(),
2572
"The protocol of connection (tcp,socket,pipe,memory).")
2508
N_("User for login if not current user."))
2509
("protocol",po::value<string>(&opt_protocol)->default_value("mysql"),
2510
N_("The protocol of connection (mysql or drizzle)."))
2575
po::options_description hidden_options("Hidden Options");
2513
po::options_description hidden_options(N_("Hidden Options"));
2576
2514
hidden_options.add_options()
2577
("database-used", po::value<vector<string> >(), "Used to select the database")
2578
("Table-used", po::value<vector<string> >(), "Used to select the tables")
2515
("database-used", po::value<vector<string> >(), N_("Used to select the database"))
2516
("Table-used", po::value<vector<string> >(), N_("Used to select the tables"))
2581
po::options_description all_options("Allowed Options + Hidden Options");
2519
po::options_description all_options(N_("Allowed Options + Hidden Options"));
2582
2520
all_options.add(commandline_options).add(dump_options).add(client_options).add(hidden_options);
2584
po::options_description long_options("Allowed Options");
2522
po::options_description long_options(N_("Allowed Options"));
2585
2523
long_options.add(commandline_options).add(dump_options).add(client_options);
2587
2525
std::string system_config_dir_dump(SYSCONFDIR);