Merge lp:~james-page/ubuntu/trusty/mysql-5.6/5.6.17-security-update into lp:ubuntu/trusty/mysql-5.6

Proposed by James Page
Status: Merged
Approved by: Marc Deslauriers
Approved revision: 5
Merge reported by: James Page
Merged at revision: not available
Proposed branch: lp:~james-page/ubuntu/trusty/mysql-5.6/5.6.17-security-update
Merge into: lp:ubuntu/trusty/mysql-5.6
Diff against target: 123564 lines (+31074/-33371)
1274 files modified
.pc/CVE-2014-0001.patch/client/mysql.cc (+0/-5557)
.pc/applied-patches (+0/-1)
.pc/fix_standalone_tests.patch/mysql-test/lib/mtr_cases.pm (+2/-2)
.pc/spelling.patch/mysql-test/extra/rpl_tests/rpl_ddl.test (+4/-4)
.pc/spelling.patch/mysql-test/extra/rpl_tests/rpl_row_basic.test (+44/-42)
.pc/spelling.patch/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test (+17/-17)
.pc/spelling.patch/sql/log_event.cc (+152/-50)
.pc/spelling.patch/sql/sql_yacc.cc (+3737/-8151)
.pc/spelling.patch/sql/sql_yacc.yy (+15/-1)
CMakeLists.txt (+8/-7)
Docs/ChangeLog (+1381/-1330)
Docs/INFO_SRC (+6/-6)
Docs/INSTALL-BINARY (+96/-73)
INSTALL-SOURCE (+608/-568)
VERSION (+1/-1)
client/mysql.cc (+3/-3)
client/mysql_config_editor.cc (+15/-9)
client/mysql_upgrade.c (+1/-0)
client/mysqladmin.cc (+7/-2)
client/mysqlbinlog.cc (+7/-1)
client/mysqlcheck.c (+7/-2)
client/mysqldump.c (+8/-2)
client/mysqlimport.c (+7/-2)
client/mysqlshow.c (+7/-1)
client/mysqlslap.c (+7/-1)
cmake/libutils.cmake (+1/-1)
debian/changelog (+14/-0)
debian/control (+2/-1)
debian/patches/CVE-2014-0001.patch (+0/-14)
debian/patches/series (+0/-1)
extra/yassl/README (+30/-1)
extra/yassl/certs/ca-cert.pem (+73/-42)
extra/yassl/certs/ca-key.pem (+25/-7)
extra/yassl/certs/client-cert.pem (+69/-37)
extra/yassl/certs/client-key.pem (+25/-7)
extra/yassl/certs/client-keyEnc.pem (+25/-7)
extra/yassl/certs/dsa-cert.pem (+20/-68)
extra/yassl/certs/server-cert.pem (+148/-30)
extra/yassl/certs/server-key.pem (+25/-7)
extra/yassl/certs/server-keyEnc.pem (+25/-7)
extra/yassl/include/cert_wrapper.hpp (+5/-2)
extra/yassl/include/openssl/crypto.h (+1/-0)
extra/yassl/include/openssl/des.h (+1/-0)
extra/yassl/include/openssl/des_old.h (+1/-0)
extra/yassl/include/openssl/engine.h (+1/-0)
extra/yassl/include/openssl/err.h (+1/-0)
extra/yassl/include/openssl/evp.h (+1/-0)
extra/yassl/include/openssl/generate_prefix_files.pl (+1/-0)
extra/yassl/include/openssl/hmac.h (+1/-0)
extra/yassl/include/openssl/lhash.h (+1/-0)
extra/yassl/include/openssl/md4.h (+1/-0)
extra/yassl/include/openssl/md5.h (+1/-0)
extra/yassl/include/openssl/objects.h (+1/-0)
extra/yassl/include/openssl/opensslv.h (+1/-0)
extra/yassl/include/openssl/pem.h (+1/-0)
extra/yassl/include/openssl/pkcs12.h (+1/-0)
extra/yassl/include/openssl/prefix_crypto.h (+1/-0)
extra/yassl/include/openssl/rand.h (+1/-0)
extra/yassl/include/openssl/rsa.h (+1/-0)
extra/yassl/include/openssl/sha.h (+1/-0)
extra/yassl/include/openssl/ssl.h (+2/-2)
extra/yassl/include/openssl/x509.h (+1/-0)
extra/yassl/include/openssl/x509v3.h (+1/-0)
extra/yassl/src/cert_wrapper.cpp (+12/-2)
extra/yassl/src/crypto_wrapper.cpp (+2/-2)
extra/yassl/src/handshake.cpp (+3/-1)
extra/yassl/src/yassl_imp.cpp (+28/-10)
extra/yassl/taocrypt/include/integer.hpp (+8/-0)
extra/yassl/taocrypt/include/misc.hpp (+8/-1)
extra/yassl/taocrypt/src/aes.cpp (+54/-28)
extra/yassl/taocrypt/src/arc4.cpp (+29/-20)
extra/yassl/taocrypt/src/blowfish.cpp (+25/-18)
extra/yassl/taocrypt/src/des.cpp (+27/-25)
extra/yassl/taocrypt/src/integer.cpp (+4/-2)
extra/yassl/taocrypt/src/md5.cpp (+29/-21)
extra/yassl/taocrypt/src/rabbit.cpp (+10/-5)
extra/yassl/taocrypt/src/ripemd.cpp (+28/-19)
extra/yassl/taocrypt/src/sha.cpp (+31/-20)
extra/yassl/taocrypt/src/twofish.cpp (+29/-20)
extra/yassl/taocrypt/test/test.cpp (+7/-7)
include/atomic/nolock.h (+2/-2)
include/my_aes.h (+103/-41)
include/my_base.h (+5/-2)
include/my_rnd.h (+1/-0)
include/mysql_version.h.in (+4/-3)
include/queues.h (+1/-0)
include/t_ctype.h (+1/-0)
libmysql/libmysql.c (+21/-1)
libmysqld/CMakeLists.txt (+35/-1)
libmysqld/examples/test-run (+1/-0)
man/comp_err.1 (+4/-4)
man/innochecksum.1 (+2/-2)
man/msql2mysql.1 (+18/-2)
man/my_print_defaults.1 (+12/-5)
man/myisam_ftdump.1 (+2/-2)
man/myisamchk.1 (+4/-4)
man/myisamlog.1 (+2/-2)
man/myisampack.1 (+4/-4)
man/mysql-stress-test.pl.1 (+2/-2)
man/mysql-test-run.pl.1 (+2/-2)
man/mysql.1 (+34/-8)
man/mysql.server.1 (+3/-3)
man/mysql_client_test.1 (+2/-2)
man/mysql_config.1 (+2/-2)
man/mysql_config_editor.1 (+4/-4)
man/mysql_convert_table_format.1 (+19/-3)
man/mysql_find_rows.1 (+18/-2)
man/mysql_fix_extensions.1 (+18/-2)
man/mysql_install_db.1 (+3/-3)
man/mysql_plugin.1 (+2/-2)
man/mysql_secure_installation.1 (+3/-3)
man/mysql_setpermission.1 (+19/-3)
man/mysql_tzinfo_to_sql.1 (+2/-2)
man/mysql_upgrade.1 (+24/-4)
man/mysql_waitpid.1 (+2/-2)
man/mysql_zap.1 (+2/-2)
man/mysqlaccess.1 (+18/-2)
man/mysqladmin.1 (+64/-6)
man/mysqlbinlog.1 (+79/-5)
man/mysqlbug.1 (+2/-2)
man/mysqlcheck.1 (+64/-6)
man/mysqld.8 (+2/-2)
man/mysqld_multi.1 (+3/-3)
man/mysqld_safe.1 (+2/-2)
man/mysqldump.1 (+63/-5)
man/mysqldumpslow.1 (+2/-2)
man/mysqlhotcopy.1 (+2/-2)
man/mysqlimport.1 (+63/-5)
man/mysqlshow.1 (+63/-5)
man/mysqlslap.1 (+64/-6)
man/mysqltest.1 (+2/-2)
man/ndb-common-options.1 (+2/-2)
man/ndb_blob_tool.1 (+2/-2)
man/ndb_config.1 (+4/-3)
man/ndb_cpcd.1 (+2/-2)
man/ndb_delete_all.1 (+2/-2)
man/ndb_desc.1 (+2/-2)
man/ndb_drop_index.1 (+3/-3)
man/ndb_drop_table.1 (+2/-2)
man/ndb_error_reporter.1 (+2/-2)
man/ndb_index_stat.1 (+2/-2)
man/ndb_mgm.1 (+2/-2)
man/ndb_mgmd.8 (+2/-2)
man/ndb_print_backup_file.1 (+2/-2)
man/ndb_print_schema_file.1 (+2/-2)
man/ndb_print_sys_file.1 (+2/-2)
man/ndb_restore.1 (+2/-2)
man/ndb_select_all.1 (+2/-2)
man/ndb_select_count.1 (+2/-2)
man/ndb_setup.py.1 (+2/-2)
man/ndb_show_tables.1 (+2/-2)
man/ndb_size.pl.1 (+2/-2)
man/ndb_waiter.1 (+2/-2)
man/ndbd.8 (+2/-2)
man/ndbd_redo_log_reader.1 (+3/-3)
man/ndbinfo_select_all.1 (+2/-2)
man/ndbmtd.8 (+2/-2)
man/perror.1 (+2/-2)
man/replace.1 (+2/-2)
man/resolve_stack_dump.1 (+2/-2)
man/resolveip.1 (+2/-2)
mysql-test/collections/default.daily (+4/-0)
mysql-test/collections/default.push (+1/-1)
mysql-test/collections/default.release.done (+1/-1)
mysql-test/collections/default.weekly (+2/-0)
mysql-test/collections/disabled-gtid-on.list (+1/-0)
mysql-test/extra/rpl_tests/grep_pattern.inc (+22/-0)
mysql-test/extra/rpl_tests/rpl_auto_increment.test (+18/-18)
mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test (+2/-2)
mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test (+2/-2)
mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test (+2/-2)
mysql-test/extra/rpl_tests/rpl_binlog_error.inc (+483/-0)
mysql-test/extra/rpl_tests/rpl_blackhole.test (+1/-1)
mysql-test/extra/rpl_tests/rpl_change_master.test (+4/-4)
mysql-test/extra/rpl_tests/rpl_charset.test (+8/-8)
mysql-test/extra/rpl_tests/rpl_commit_after_flush.test (+2/-2)
mysql-test/extra/rpl_tests/rpl_conflicts.test (+3/-4)
mysql-test/extra/rpl_tests/rpl_crash_safe.test (+3/-3)
mysql-test/extra/rpl_tests/rpl_ddl.test (+4/-4)
mysql-test/extra/rpl_tests/rpl_delete_no_where.test (+3/-3)
mysql-test/extra/rpl_tests/rpl_do_table_filter_insensitive.inc (+16/-0)
mysql-test/extra/rpl_tests/rpl_do_table_filter_sensitive.inc (+16/-0)
mysql-test/extra/rpl_tests/rpl_filters.test (+2/-3)
mysql-test/extra/rpl_tests/rpl_flsh_tbls.test (+1/-1)
mysql-test/extra/rpl_tests/rpl_foreign_key.test (+4/-4)
mysql-test/extra/rpl_tests/rpl_heartbeat_2slaves.inc (+133/-0)
mysql-test/extra/rpl_tests/rpl_ignore_table_filter_insensitive.inc (+15/-0)
mysql-test/extra/rpl_tests/rpl_ignore_table_filter_sensitive.inc (+15/-0)
mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test (+2/-2)
mysql-test/extra/rpl_tests/rpl_insert_delayed.test (+6/-6)
mysql-test/extra/rpl_tests/rpl_insert_id.test (+21/-21)
mysql-test/extra/rpl_tests/rpl_insert_id_pk.test (+5/-5)
mysql-test/extra/rpl_tests/rpl_insert_ignore.test (+4/-2)
mysql-test/extra/rpl_tests/rpl_insert_ignore_gtid_on.inc (+17/-0)
mysql-test/extra/rpl_tests/rpl_loaddata.test (+5/-5)
mysql-test/extra/rpl_tests/rpl_loaddata_s.inc (+26/-0)
mysql-test/extra/rpl_tests/rpl_loadfile.test (+2/-2)
mysql-test/extra/rpl_tests/rpl_log.test (+19/-6)
mysql-test/extra/rpl_tests/rpl_max_relay_size.test (+2/-2)
mysql-test/extra/rpl_tests/rpl_mts_crash_safe.test (+3/-3)
mysql-test/extra/rpl_tests/rpl_multi_query.test (+1/-1)
mysql-test/extra/rpl_tests/rpl_multi_update.test (+1/-1)
mysql-test/extra/rpl_tests/rpl_multi_update2.test (+5/-6)
mysql-test/extra/rpl_tests/rpl_multi_update3.test (+4/-4)
mysql-test/extra/rpl_tests/rpl_not_null.test (+8/-8)
mysql-test/extra/rpl_tests/rpl_parallel_load.test (+3/-3)
mysql-test/extra/rpl_tests/rpl_parallel_load_innodb.test (+3/-3)
mysql-test/extra/rpl_tests/rpl_record_compare.test (+6/-6)
mysql-test/extra/rpl_tests/rpl_relayrotate.test (+1/-1)
mysql-test/extra/rpl_tests/rpl_row_001.test (+2/-0)
mysql-test/extra/rpl_tests/rpl_row_UUID.test (+1/-1)
mysql-test/extra/rpl_tests/rpl_row_basic.test (+44/-42)
mysql-test/extra/rpl_tests/rpl_row_blob.test (+1/-1)
mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test (+1/-0)
mysql-test/extra/rpl_tests/rpl_row_event_max_size.inc (+95/-0)
mysql-test/extra/rpl_tests/rpl_row_func003.test (+1/-1)
mysql-test/extra/rpl_tests/rpl_row_idempotency.test (+55/-55)
mysql-test/extra/rpl_tests/rpl_row_show_relaylog_events.inc (+20/-0)
mysql-test/extra/rpl_tests/rpl_row_sp002.test (+6/-6)
mysql-test/extra/rpl_tests/rpl_row_sp003.test (+3/-3)
mysql-test/extra/rpl_tests/rpl_row_sp006.test (+3/-3)
mysql-test/extra/rpl_tests/rpl_row_sp007.test (+2/-2)
mysql-test/extra/rpl_tests/rpl_set_null.test (+6/-6)
mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc (+2/-2)
mysql-test/extra/rpl_tests/rpl_stm_insert_delayed.inc (+10/-0)
mysql-test/extra/rpl_tests/rpl_stm_mix_show_relaylog_events.inc (+20/-0)
mysql-test/extra/rpl_tests/rpl_stress_test.inc (+1/-1)
mysql-test/extra/rpl_tests/rpl_sv_relay_space.test (+1/-1)
mysql-test/extra/rpl_tests/rpl_trig004.test (+2/-2)
mysql-test/extra/rpl_tests/rpl_truncate_helper.test (+5/-5)
mysql-test/include/default_my.cnf (+1/-0)
mysql-test/include/func_aes_block.inc (+130/-0)
mysql-test/include/have_perfschema.inc (+1/-0)
mysql-test/include/rpl_change_topology.inc (+10/-0)
mysql-test/include/rpl_end.inc (+6/-0)
mysql-test/include/rpl_init.inc (+4/-0)
mysql-test/include/subquery.inc (+16/-0)
mysql-test/include/truncate_file.inc (+3/-3)
mysql-test/lib/mtr_cases.pm (+2/-2)
mysql-test/lib/mtr_match.pm (+1/-0)
mysql-test/mysql-test-run.pl (+3/-4)
mysql-test/purify.supp (+1/-0)
mysql-test/r/alter_table.result (+4/-20)
mysql-test/r/create.result (+2/-0)
mysql-test/r/ctype_ldml.result (+1/-1)
mysql-test/r/ctype_uca.result (+14/-0)
mysql-test/r/delayed.result (+5/-0)
mysql-test/r/derived.result (+32/-0)
mysql-test/r/events_bugs.result (+4/-0)
mysql-test/r/func_aes.result (+411/-0)
mysql-test/r/func_aes_cfb1.result (+132/-0)
mysql-test/r/func_aes_cfb128.result (+132/-0)
mysql-test/r/func_aes_cfb8.result (+132/-0)
mysql-test/r/func_aes_misc.result (+255/-0)
mysql-test/r/func_aes_ofb.result (+132/-0)
mysql-test/r/information_schema-big.result (+4/-2)
mysql-test/r/innodb_mysql_lock.result (+4/-1)
mysql-test/r/innodb_mysql_sync.result (+181/-0)
mysql-test/r/insert.result (+2/-0)
mysql-test/r/mysql_upgrade.result (+2/-0)
mysql-test/r/mysqlcheck.result (+0/-3)
mysql-test/r/mysqld--help-notwin.result (+3/-0)
mysql-test/r/mysqld--help-win.result (+3/-0)
mysql-test/r/openssl_1.result (+1/-1)
mysql-test/r/parser.result (+25/-0)
mysql-test/r/partition.result (+2/-0)
mysql-test/r/partition_index_innodb.result (+116/-0)
mysql-test/r/partition_index_myisam.result (+83/-0)
mysql-test/r/partition_innodb.result (+27/-0)
mysql-test/r/sp.result (+10/-0)
mysql-test/r/strict.result (+17/-0)
mysql-test/r/subquery_all.result (+13/-0)
mysql-test/r/subquery_all_bka.result (+13/-0)
mysql-test/r/subquery_all_bka_nixbnl.result (+13/-0)
mysql-test/r/subquery_nomat_nosj.result (+13/-0)
mysql-test/r/subquery_nomat_nosj_bka.result (+13/-0)
mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result (+13/-0)
mysql-test/r/subquery_none.result (+13/-0)
mysql-test/r/subquery_none_bka.result (+13/-0)
mysql-test/r/subquery_none_bka_nixbnl.result (+13/-0)
mysql-test/r/temporal_literal.result (+4/-0)
mysql-test/r/type_date.result (+16/-0)
mysql-test/r/type_datetime.result (+16/-0)
mysql-test/r/type_temporal_fractional.result (+257/-0)
mysql-test/r/type_timestamp.result (+16/-0)
mysql-test/r/type_timestamp_explicit.result (+16/-0)
mysql-test/suite/binlog/r/binlog_unsafe.result (+9/-0)
mysql-test/suite/binlog/t/binlog_unsafe.test (+3/-0)
mysql-test/suite/funcs_1/r/storedproc.result (+2/-0)
mysql-test/suite/innodb/r/blob-update-debug.result (+15/-0)
mysql-test/suite/innodb/r/create-index.result (+9/-0)
mysql-test/suite/innodb/r/innodb-autoinc.result (+27/-0)
mysql-test/suite/innodb/r/innodb-double-write.result (+239/-0)
mysql-test/suite/innodb/r/innodb-update-insert.result (+43/-0)
mysql-test/suite/innodb/r/innodb.result (+1/-1)
mysql-test/suite/innodb/r/innodb_ctype_ldml.result (+1/-1)
mysql-test/suite/innodb/t/blob-update-debug.test (+17/-0)
mysql-test/suite/innodb/t/create-index.test (+11/-0)
mysql-test/suite/innodb/t/innodb-autoinc.test (+14/-0)
mysql-test/suite/innodb/t/innodb-double-write.test (+364/-0)
mysql-test/suite/innodb/t/innodb-update-insert.test (+38/-0)
mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result (+2/-0)
mysql-test/suite/perfschema/r/func_file_io.result (+1/-0)
mysql-test/suite/perfschema/r/func_mutex.result (+1/-0)
mysql-test/suite/perfschema/r/innodb_table_io.result (+0/-3)
mysql-test/suite/perfschema/r/myisam_file_io.result (+1/-0)
mysql-test/suite/perfschema/t/func_file_io.test (+1/-0)
mysql-test/suite/perfschema/t/func_mutex.test (+1/-0)
mysql-test/suite/perfschema/t/myisam_file_io.test (+1/-0)
mysql-test/suite/perfschema/t/nesting.test (+1/-0)
mysql-test/suite/rpl/r/rpl_000010.result (+2/-0)
mysql-test/suite/rpl/r/rpl_000011.result (+3/-0)
mysql-test/suite/rpl/r/rpl_000017.result (+1/-0)
mysql-test/suite/rpl/r/rpl_DML_error.result (+4/-0)
mysql-test/suite/rpl/r/rpl_LD_INFILE.result (+2/-0)
mysql-test/suite/rpl/r/rpl_alter.result (+2/-0)
mysql-test/suite/rpl/r/rpl_alter_db.result (+2/-0)
mysql-test/suite/rpl/r/rpl_alter_repository.result (+5/-0)
mysql-test/suite/rpl/r/rpl_auto_increment.result (+18/-0)
mysql-test/suite/rpl/r/rpl_auto_increment_11932.result (+1/-0)
mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result (+2/-0)
mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result (+28/-0)
mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result (+3/-0)
mysql-test/suite/rpl/r/rpl_binlog_gcommit_options.result (+2/-0)
mysql-test/suite/rpl/r/rpl_bit.result (+2/-0)
mysql-test/suite/rpl/r/rpl_bit_npk.result (+3/-0)
mysql-test/suite/rpl/r/rpl_blackhole.result (+12/-0)
mysql-test/suite/rpl/r/rpl_bug31076.result (+1/-0)
mysql-test/suite/rpl/r/rpl_bug37426.result (+2/-0)
mysql-test/suite/rpl/r/rpl_bug41902.result (+1/-0)
mysql-test/suite/rpl/r/rpl_charset.result (+8/-0)
mysql-test/suite/rpl/r/rpl_charset_sjis.result (+2/-0)
mysql-test/suite/rpl/r/rpl_check_gtid.result (+28/-0)
mysql-test/suite/rpl/r/rpl_checksum_cache.result (+7/-0)
mysql-test/suite/rpl/r/rpl_colSize.result (+7/-0)
mysql-test/suite/rpl/r/rpl_commit_after_flush.result (+2/-0)
mysql-test/suite/rpl/r/rpl_concurrency_error.result (+2/-0)
mysql-test/suite/rpl/r/rpl_conditional_comments.result (+3/-0)
mysql-test/suite/rpl/r/rpl_corruption.result (+3/-0)
mysql-test/suite/rpl/r/rpl_crash_safe_master.result (+6/-0)
mysql-test/suite/rpl/r/rpl_create_database.result (+4/-0)
mysql-test/suite/rpl/r/rpl_create_if_not_exists.result (+5/-0)
mysql-test/suite/rpl/r/rpl_current_user.result (+8/-0)
mysql-test/suite/rpl/r/rpl_delete_no_where.result (+3/-0)
mysql-test/suite/rpl/r/rpl_do_db_filter.result (+2/-0)
mysql-test/suite/rpl/r/rpl_do_table_filter_insensitive.result (+2/-0)
mysql-test/suite/rpl/r/rpl_do_table_filter_sensitive.result (+2/-0)
mysql-test/suite/rpl/r/rpl_drop.result (+1/-0)
mysql-test/suite/rpl/r/rpl_drop_view.result (+2/-0)
mysql-test/suite/rpl/r/rpl_dual_pos_advance.result (+4/-0)
mysql-test/suite/rpl/r/rpl_err_ignoredtable.result (+4/-0)
mysql-test/suite/rpl/r/rpl_events.result (+3/-0)
mysql-test/suite/rpl/r/rpl_extra_row_data.result (+2/-0)
mysql-test/suite/rpl/r/rpl_filter_database.result (+3/-0)
mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result (+7/-0)
mysql-test/suite/rpl/r/rpl_filter_warnings.result (+21/-0)
mysql-test/suite/rpl/r/rpl_flush_logs.result (+7/-0)
mysql-test/suite/rpl/r/rpl_flushlog_loop.result (+4/-0)
mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result (+4/-0)
mysql-test/suite/rpl/r/rpl_free_items.result (+2/-0)
mysql-test/suite/rpl/r/rpl_function_defaults.result (+2/-0)
mysql-test/suite/rpl/r/rpl_general_log.result (+2/-0)
mysql-test/suite/rpl/r/rpl_geometry.result (+1/-0)
mysql-test/suite/rpl/r/rpl_get_lock.result (+2/-0)
mysql-test/suite/rpl/r/rpl_grant.result (+12/-0)
mysql-test/suite/rpl/r/rpl_grant_plugin.result (+4/-0)
mysql-test/suite/rpl/r/rpl_group_commit_deadlock.result (+2/-0)
mysql-test/suite/rpl/r/rpl_gtid_binlog_errors.result (+270/-0)
mysql-test/suite/rpl/r/rpl_gtid_do_table_filter_insensitive.result (+40/-0)
mysql-test/suite/rpl/r/rpl_gtid_do_table_filter_sensitive.result (+40/-0)
mysql-test/suite/rpl/r/rpl_gtid_empty_group.result (+2/-0)
mysql-test/suite/rpl/r/rpl_gtid_execution.result (+110/-0)
mysql-test/suite/rpl/r/rpl_gtid_failover.result (+4/-0)
mysql-test/suite/rpl/r/rpl_gtid_heartbeat_2slave.result (+53/-0)
mysql-test/suite/rpl/r/rpl_gtid_ignore_table_filter_insensitive.result (+40/-0)
mysql-test/suite/rpl/r/rpl_gtid_ignore_table_filter_sensitive.result (+40/-0)
mysql-test/suite/rpl/r/rpl_gtid_loaddata_s.result (+21/-0)
mysql-test/suite/rpl/r/rpl_gtid_mode.result (+4/-0)
mysql-test/suite/rpl/r/rpl_gtid_parallel.result (+1/-0)
mysql-test/suite/rpl/r/rpl_gtid_purged_fail_to_connect.result (+2/-0)
mysql-test/suite/rpl/r/rpl_gtid_purged_maintained.result (+11/-0)
mysql-test/suite/rpl/r/rpl_gtid_row_event_max_size.result (+70/-0)
mysql-test/suite/rpl/r/rpl_gtid_row_show_relaylog_events.result (+203/-0)
mysql-test/suite/rpl/r/rpl_gtid_sql_until_before_after.result (+1/-0)
mysql-test/suite/rpl/r/rpl_gtid_stm_insert_delayed.result (+84/-0)
mysql-test/suite/rpl/r/rpl_gtid_stm_mix_show_relaylog_events.result (+182/-0)
mysql-test/suite/rpl/r/rpl_heartbeat.result (+2/-0)
mysql-test/suite/rpl/r/rpl_heartbeat_2slaves.result (+2/-0)
mysql-test/suite/rpl/r/rpl_heartbeat_basic.result (+10/-0)
mysql-test/suite/rpl/r/rpl_idempotency.result (+40/-35)
mysql-test/suite/rpl/r/rpl_ignore_db_filter.result (+2/-0)
mysql-test/suite/rpl/r/rpl_ignore_revoke.result (+3/-0)
mysql-test/suite/rpl/r/rpl_ignore_table_filter_insensitive.result (+2/-0)
mysql-test/suite/rpl/r/rpl_ignore_table_filter_sensitive.result (+2/-0)
mysql-test/suite/rpl/r/rpl_incident.result (+1/-0)
mysql-test/suite/rpl/r/rpl_init_slave.result (+3/-0)
mysql-test/suite/rpl/r/rpl_innodb_bug28430.result (+1/-0)
mysql-test/suite/rpl/r/rpl_innodb_bug30888.result (+1/-0)
mysql-test/suite/rpl/r/rpl_insert.result (+2/-0)
mysql-test/suite/rpl/r/rpl_insert_id.result (+21/-0)
mysql-test/suite/rpl/r/rpl_insert_id_pk.result (+5/-0)
mysql-test/suite/rpl/r/rpl_insert_ignore.result (+4/-0)
mysql-test/suite/rpl/r/rpl_invoked_features.result (+3/-0)
mysql-test/suite/rpl/r/rpl_killed_ddl.result (+1/-0)
mysql-test/suite/rpl/r/rpl_known_bugs_detection.result (+2/-0)
mysql-test/suite/rpl/r/rpl_lcase_tblnames_rewrite_db.result (+1/-0)
mysql-test/suite/rpl/r/rpl_loaddata.result (+5/-0)
mysql-test/suite/rpl/r/rpl_loaddata_charset.result (+2/-0)
mysql-test/suite/rpl/r/rpl_loaddata_fatal.result (+2/-0)
mysql-test/suite/rpl/r/rpl_loaddata_m.result (+2/-0)
mysql-test/suite/rpl/r/rpl_loaddata_map.result (+2/-0)
mysql-test/suite/rpl/r/rpl_loaddata_s.result (+2/-0)
mysql-test/suite/rpl/r/rpl_loaddata_simple.result (+2/-0)
mysql-test/suite/rpl/r/rpl_loaddata_symlink.result (+2/-0)
mysql-test/suite/rpl/r/rpl_loaddatalocal.result (+13/-0)
mysql-test/suite/rpl/r/rpl_loadfile.result (+3/-0)
mysql-test/suite/rpl/r/rpl_locale.result (+2/-0)
mysql-test/suite/rpl/r/rpl_log_pos.result (+2/-0)
mysql-test/suite/rpl/r/rpl_lost_events_on_rotate.result (+1/-0)
mysql-test/suite/rpl/r/rpl_manual_change_index_file.result (+5/-0)
mysql-test/suite/rpl/r/rpl_many_optimize.result (+1/-0)
mysql-test/suite/rpl/r/rpl_master_pos_wait.result (+1/-0)
mysql-test/suite/rpl/r/rpl_migration_crash_safe.result (+2/-0)
mysql-test/suite/rpl/r/rpl_misc_functions.result (+3/-0)
mysql-test/suite/rpl/r/rpl_mix_found_rows.result (+6/-0)
mysql-test/suite/rpl/r/rpl_mix_insert_delayed.result (+6/-0)
mysql-test/suite/rpl/r/rpl_mixed_bit_pk.result (+2/-0)
mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result (+3/-0)
mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result (+2/-0)
mysql-test/suite/rpl/r/rpl_mts_debug.result (+3/-0)
mysql-test/suite/rpl/r/rpl_multi_delete.result (+1/-0)
mysql-test/suite/rpl/r/rpl_multi_delete2.result (+1/-0)
mysql-test/suite/rpl/r/rpl_multi_engine.result (+254/-249)
mysql-test/suite/rpl/r/rpl_multi_update.result (+1/-0)
mysql-test/suite/rpl/r/rpl_multi_update2.result (+4/-0)
mysql-test/suite/rpl/r/rpl_multi_update3.result (+4/-0)
mysql-test/suite/rpl/r/rpl_multi_update4.result (+2/-0)
mysql-test/suite/rpl/r/rpl_mysql_upgrade.result (+2/-0)
mysql-test/suite/rpl/r/rpl_mysqlbinlog_gtid_on.result (+1/-0)
mysql-test/suite/rpl/r/rpl_name_const.result (+1/-0)
mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result (+1/-0)
mysql-test/suite/rpl/r/rpl_not_null_innodb.result (+8/-0)
mysql-test/suite/rpl/r/rpl_not_null_myisam.result (+8/-0)
mysql-test/suite/rpl/r/rpl_optimize.result (+1/-0)
mysql-test/suite/rpl/r/rpl_packet.result (+8/-0)
mysql-test/suite/rpl/r/rpl_parallel.result (+18/-0)
mysql-test/suite/rpl/r/rpl_parallel_change_master.result (+2/-0)
mysql-test/suite/rpl/r/rpl_parallel_conf_limits.result (+2/-0)
mysql-test/suite/rpl/r/rpl_parallel_conflicts.result (+2/-0)
mysql-test/suite/rpl/r/rpl_parallel_ddl.result (+3/-0)
mysql-test/suite/rpl/r/rpl_parallel_innodb.result (+18/-0)
mysql-test/suite/rpl/r/rpl_parallel_multi_db.result (+6/-0)
mysql-test/suite/rpl/r/rpl_parallel_seconds_behind_master.result (+1/-0)
mysql-test/suite/rpl/r/rpl_parallel_start_stop.result (+9/-0)
mysql-test/suite/rpl/r/rpl_parallel_temp_query.result (+4/-0)
mysql-test/suite/rpl/r/rpl_ps.result (+3/-0)
mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result (+1/-0)
mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result (+1/-0)
mysql-test/suite/rpl/r/rpl_read_only.result (+5/-0)
mysql-test/suite/rpl/r/rpl_relay_space_innodb.result (+1/-0)
mysql-test/suite/rpl/r/rpl_relay_space_myisam.result (+1/-0)
mysql-test/suite/rpl/r/rpl_relayrotate.result (+1/-0)
mysql-test/suite/rpl/r/rpl_replicate_do.result (+5/-0)
mysql-test/suite/rpl/r/rpl_replicate_event_after_sync_stage.result (+31/-0)
mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result (+3/-0)
mysql-test/suite/rpl/r/rpl_report_port.result (+1/-0)
mysql-test/suite/rpl/r/rpl_rewrite_db_filter.result (+2/-0)
mysql-test/suite/rpl/r/rpl_rewrt_db.result (+9/-0)
mysql-test/suite/rpl/r/rpl_rotate_logs.result (+6/-0)
mysql-test/suite/rpl/r/rpl_rotate_purge_deadlock.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_001.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_4_bytes.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_NOW.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_USER.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_UUID.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result (+17/-0)
mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result (+42/-0)
mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result (+42/-0)
mysql-test/suite/rpl/r/rpl_row_basic_8partition.result (+9/-0)
mysql-test/suite/rpl/r/rpl_row_basic_allow_batching.result (+42/-0)
mysql-test/suite/rpl/r/rpl_row_blob_innodb.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_blob_myisam.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_colSize.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_conflicts.result (+6/-0)
mysql-test/suite/rpl/r/rpl_row_corruption.result (+4/-0)
mysql-test/suite/rpl/r/rpl_row_crash_safe.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_drop.result (+5/-0)
mysql-test/suite/rpl/r/rpl_row_event_max_size.result (+4/-0)
mysql-test/suite/rpl/r/rpl_row_find_row.result (+8/-0)
mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_func001.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_func002.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_func003.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_hash_scan.result (+18/-0)
mysql-test/suite/rpl/r/rpl_row_hash_scan_sanity.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_idempotency.result (+100/-70)
mysql-test/suite/rpl/r/rpl_row_ignorable_event.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_img_misc.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_img_sanity.result (+48/-0)
mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_insert_delayed.result (+6/-0)
mysql-test/suite/rpl/r/rpl_row_log.result (+4/-0)
mysql-test/suite/rpl/r/rpl_row_log_innodb.result (+4/-0)
mysql-test/suite/rpl/r/rpl_row_max_relay_size.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_merge_engine.result (+3/-0)
mysql-test/suite/rpl/r/rpl_row_mts_crash_safe.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_mts_rec_crash_safe.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_mts_show_relaylog_events.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result (+6/-0)
mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result (+8/-0)
mysql-test/suite/rpl/r/rpl_row_record_find_myisam.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_sp001.result (+5/-0)
mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result (+6/-0)
mysql-test/suite/rpl/r/rpl_row_sp003.result (+3/-0)
mysql-test/suite/rpl/r/rpl_row_sp005.result (+3/-0)
mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result (+3/-0)
mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_sp008.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_sp009.result (+4/-0)
mysql-test/suite/rpl/r/rpl_row_sp010.result (+3/-0)
mysql-test/suite/rpl/r/rpl_row_sp011.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_sp012.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_tbl_metadata.result (+13/-0)
mysql-test/suite/rpl/r/rpl_row_trig001.result (+3/-0)
mysql-test/suite/rpl/r/rpl_row_trig002.result (+4/-0)
mysql-test/suite/rpl/r/rpl_row_trig003.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_trig004.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_trunc_temp.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result (+2/-0)
mysql-test/suite/rpl/r/rpl_row_until.result (+4/-0)
mysql-test/suite/rpl/r/rpl_row_utf16.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_utf32.result (+1/-0)
mysql-test/suite/rpl/r/rpl_row_view01.result (+4/-0)
mysql-test/suite/rpl/r/rpl_row_wide_table.result (+2/-0)
mysql-test/suite/rpl/r/rpl_seconds_behind_master.result (+5/-0)
mysql-test/suite/rpl/r/rpl_semi_sync.result (+11/-0)
mysql-test/suite/rpl/r/rpl_semi_sync_deadlock.result (+2/-0)
mysql-test/suite/rpl/r/rpl_semi_sync_event.result (+1/-0)
mysql-test/suite/rpl/r/rpl_semi_sync_group_commit_deadlock.result (+2/-0)
mysql-test/suite/rpl/r/rpl_semi_sync_non_group_commit_deadlock.result (+2/-0)
mysql-test/suite/rpl/r/rpl_sequential.result (+18/-0)
mysql-test/suite/rpl/r/rpl_server_id2.result (+1/-0)
mysql-test/suite/rpl/r/rpl_server_id_ignore.result (+3/-0)
mysql-test/suite/rpl/r/rpl_server_uuid.result (+2/-0)
mysql-test/suite/rpl/r/rpl_session_var.result (+4/-0)
mysql-test/suite/rpl/r/rpl_set_charset.result (+2/-0)
mysql-test/suite/rpl/r/rpl_set_null_innodb.result (+6/-0)
mysql-test/suite/rpl/r/rpl_set_null_myisam.result (+6/-0)
mysql-test/suite/rpl/r/rpl_show_errors.result (+1/-0)
mysql-test/suite/rpl/r/rpl_show_slave_running.result (+1/-0)
mysql-test/suite/rpl/r/rpl_skip_error.result (+9/-0)
mysql-test/suite/rpl/r/rpl_skip_incident.result (+2/-0)
mysql-test/suite/rpl/r/rpl_skip_slave_err_warnings.result (+13/-0)
mysql-test/suite/rpl/r/rpl_slave_grp_exec.result (+6/-0)
mysql-test/suite/rpl/r/rpl_slave_load_in.result (+2/-0)
mysql-test/suite/rpl/r/rpl_slave_skip.result (+7/-0)
mysql-test/suite/rpl/r/rpl_slave_status.result (+3/-0)
mysql-test/suite/rpl/r/rpl_slow_query_log.result (+7/-0)
mysql-test/suite/rpl/r/rpl_sp.result (+28/-0)
mysql-test/suite/rpl/r/rpl_sp004.result (+4/-0)
mysql-test/suite/rpl/r/rpl_sp_effects.result (+10/-0)
mysql-test/suite/rpl/r/rpl_spec_variables.result (+8/-0)
mysql-test/suite/rpl/r/rpl_sporadic_master.result (+3/-0)
mysql-test/suite/rpl/r/rpl_ssl.result (+27/-7)
mysql-test/suite/rpl/r/rpl_ssl1.result (+5/-0)
mysql-test/suite/rpl/r/rpl_stm_000001.result (+6/-0)
mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result (+4/-0)
mysql-test/suite/rpl/r/rpl_stm_conflicts.result (+3/-0)
mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result (+1/-0)
mysql-test/suite/rpl/r/rpl_stm_found_rows.result (+3/-0)
mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result (+2/-0)
mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result (+6/-0)
mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result (+5/-0)
mysql-test/suite/rpl/r/rpl_stm_loadfile.result (+2/-0)
mysql-test/suite/rpl/r/rpl_stm_log.result (+4/-0)
mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result (+2/-0)
mysql-test/suite/rpl/r/rpl_stm_mix_mts_show_relaylog_events.result (+2/-0)
mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result (+2/-0)
mysql-test/suite/rpl/r/rpl_stm_mixed_crash_safe.result (+1/-0)
mysql-test/suite/rpl/r/rpl_stm_mixed_mts_crash_safe.result (+1/-0)
mysql-test/suite/rpl/r/rpl_stm_mixed_mts_rec_crash_safe.result (+1/-0)
mysql-test/suite/rpl/r/rpl_stm_mixed_mts_rec_crash_safe_checksum.result (+1/-0)
mysql-test/suite/rpl/r/rpl_stm_mixed_mts_rec_crash_safe_small.result (+1/-0)
mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result (+3/-0)
mysql-test/suite/rpl/r/rpl_stm_multi_query.result (+1/-0)
mysql-test/suite/rpl/r/rpl_stm_no_op.result (+10/-0)
mysql-test/suite/rpl/r/rpl_stm_relay_ign_space.result (+3/-0)
mysql-test/suite/rpl/r/rpl_stm_sql_mode.result (+1/-0)
mysql-test/suite/rpl/r/rpl_stm_until.result (+3/-0)
mysql-test/suite/rpl/r/rpl_stm_user_variables.result (+9/-0)
mysql-test/suite/rpl/r/rpl_stop_slave.result (+2/-0)
mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result (+14/-0)
mysql-test/suite/rpl/r/rpl_sync.result (+3/-0)
mysql-test/suite/rpl/r/rpl_temp_table.result (+1/-0)
mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result (+8/-0)
mysql-test/suite/rpl/r/rpl_temporal_fractional.result (+6/-0)
mysql-test/suite/rpl/r/rpl_temporary.result (+10/-0)
mysql-test/suite/rpl/r/rpl_temporary_errors.result (+2/-0)
mysql-test/suite/rpl/r/rpl_timezone.result (+10/-0)
mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result (+1/-0)
mysql-test/suite/rpl/r/rpl_trigger.result (+40/-0)
mysql-test/suite/rpl/r/rpl_trunc_temp.result (+3/-0)
mysql-test/suite/rpl/r/rpl_truncate_2myisam.result (+10/-0)
mysql-test/suite/rpl/r/rpl_truncate_3innodb.result (+10/-0)
mysql-test/suite/rpl/r/rpl_typeconv.result (+1/-0)
mysql-test/suite/rpl/r/rpl_typeconv_innodb.result (+2/-0)
mysql-test/suite/rpl/r/rpl_user.result (+6/-0)
mysql-test/suite/rpl/r/rpl_user_variables.result (+17/-0)
mysql-test/suite/rpl/r/rpl_variables.result (+5/-0)
mysql-test/suite/rpl/r/rpl_variables_stm.result (+3/-0)
mysql-test/suite/rpl/r/rpl_view.result (+15/-1)
mysql-test/suite/rpl/r/rpl_view_multi.result (+4/-0)
mysql-test/suite/rpl/t/rpl_000010.test (+3/-2)
mysql-test/suite/rpl/t/rpl_000011.test (+3/-3)
mysql-test/suite/rpl/t/rpl_000017.test (+1/-1)
mysql-test/suite/rpl/t/rpl_DML_error.test (+4/-4)
mysql-test/suite/rpl/t/rpl_LD_INFILE.test (+2/-3)
mysql-test/suite/rpl/t/rpl_alter.test (+2/-2)
mysql-test/suite/rpl/t/rpl_alter_db.test (+2/-2)
mysql-test/suite/rpl/t/rpl_alter_repository.test (+6/-5)
mysql-test/suite/rpl/t/rpl_auto_increment_11932.test (+1/-1)
mysql-test/suite/rpl/t/rpl_auto_increment_bug33029.test (+1/-0)
mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test (+2/-2)
mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test (+8/-8)
mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test (+3/-3)
mysql-test/suite/rpl/t/rpl_binlog_corruption.test (+1/-0)
mysql-test/suite/rpl/t/rpl_binlog_errors.test (+3/-481)
mysql-test/suite/rpl/t/rpl_binlog_gcommit_options.test (+3/-2)
mysql-test/suite/rpl/t/rpl_binlog_index.test (+1/-0)
mysql-test/suite/rpl/t/rpl_bit.test (+2/-2)
mysql-test/suite/rpl/t/rpl_bit_npk.test (+3/-3)
mysql-test/suite/rpl/t/rpl_blackhole.test (+2/-2)
mysql-test/suite/rpl/t/rpl_bug31076.test (+1/-1)
mysql-test/suite/rpl/t/rpl_bug37426.test (+2/-2)
mysql-test/suite/rpl/t/rpl_bug41902.test (+1/-1)
mysql-test/suite/rpl/t/rpl_charset_sjis.test (+2/-2)
mysql-test/suite/rpl/t/rpl_check_gtid.test (+7/-7)
mysql-test/suite/rpl/t/rpl_checksum.test (+1/-0)
mysql-test/suite/rpl/t/rpl_checksum_cache.test (+7/-12)
mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test (+1/-0)
mysql-test/suite/rpl/t/rpl_colSize.test (+13/-8)
mysql-test/suite/rpl/t/rpl_concurrency_error.test (+2/-2)
mysql-test/suite/rpl/t/rpl_conditional_comments.test (+3/-3)
mysql-test/suite/rpl/t/rpl_corruption.test (+3/-3)
mysql-test/suite/rpl/t/rpl_crash_safe_master.test (+7/-6)
mysql-test/suite/rpl/t/rpl_create_database.test (+4/-4)
mysql-test/suite/rpl/t/rpl_create_if_not_exists.test (+5/-5)
mysql-test/suite/rpl/t/rpl_critical_errors.test (+1/-1)
mysql-test/suite/rpl/t/rpl_current_user.test (+13/-8)
mysql-test/suite/rpl/t/rpl_deadlock_innodb.test (+1/-0)
mysql-test/suite/rpl/t/rpl_delayed_slave.test (+3/-3)
mysql-test/suite/rpl/t/rpl_do_db_filter.test (+1/-1)
mysql-test/suite/rpl/t/rpl_do_grant.test (+1/-0)
mysql-test/suite/rpl/t/rpl_do_table_filter_insensitive.test (+2/-8)
mysql-test/suite/rpl/t/rpl_do_table_filter_sensitive.test (+2/-9)
mysql-test/suite/rpl/t/rpl_drop.test (+1/-1)
mysql-test/suite/rpl/t/rpl_drop_db.test (+1/-0)
mysql-test/suite/rpl/t/rpl_drop_temp.test (+1/-0)
mysql-test/suite/rpl/t/rpl_drop_view.test (+2/-2)
mysql-test/suite/rpl/t/rpl_dual_pos_advance.test (+18/-4)
mysql-test/suite/rpl/t/rpl_err_ignoredtable.test (+4/-4)
mysql-test/suite/rpl/t/rpl_events.test (+3/-3)
mysql-test/suite/rpl/t/rpl_extra_col_master_innodb.test (+1/-0)
mysql-test/suite/rpl/t/rpl_extra_col_master_myisam.test (+1/-0)
mysql-test/suite/rpl/t/rpl_extra_col_slave_innodb.test (+1/-0)
mysql-test/suite/rpl/t/rpl_extra_col_slave_myisam.test (+1/-0)
mysql-test/suite/rpl/t/rpl_extra_row_data.test (+2/-2)
mysql-test/suite/rpl/t/rpl_failed_optimize.test (+4/-0)
mysql-test/suite/rpl/t/rpl_filter_database.test (+3/-3)
mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test (+8/-7)
mysql-test/suite/rpl/t/rpl_filter_warnings-slave.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_filter_warnings.test (+49/-0)
mysql-test/suite/rpl/t/rpl_flush_logs.test (+8/-5)
mysql-test/suite/rpl/t/rpl_flushlog_loop.test (+8/-4)
mysql-test/suite/rpl/t/rpl_free_items.test (+2/-2)
mysql-test/suite/rpl/t/rpl_function_defaults.test (+2/-2)
mysql-test/suite/rpl/t/rpl_general_log.test (+2/-2)
mysql-test/suite/rpl/t/rpl_geometry.test (+1/-1)
mysql-test/suite/rpl/t/rpl_get_lock.test (+2/-2)
mysql-test/suite/rpl/t/rpl_grant.test (+13/-12)
mysql-test/suite/rpl/t/rpl_grant_plugin.test (+4/-4)
mysql-test/suite/rpl/t/rpl_gtid_binlog_errors-master.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_gtid_binlog_errors.test (+6/-0)
mysql-test/suite/rpl/t/rpl_gtid_do_table_filter_insensitive-master.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_gtid_do_table_filter_insensitive-slave.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_gtid_do_table_filter_insensitive.test (+9/-0)
mysql-test/suite/rpl/t/rpl_gtid_do_table_filter_sensitive-master.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_gtid_do_table_filter_sensitive-slave.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_gtid_do_table_filter_sensitive.test (+9/-0)
mysql-test/suite/rpl/t/rpl_gtid_empty_group-master.opt (+1/-1)
mysql-test/suite/rpl/t/rpl_gtid_empty_group-slave.opt (+1/-1)
mysql-test/suite/rpl/t/rpl_gtid_empty_group.test (+2/-2)
mysql-test/suite/rpl/t/rpl_gtid_execution-master.opt (+1/-1)
mysql-test/suite/rpl/t/rpl_gtid_execution-slave.opt (+1/-1)
mysql-test/suite/rpl/t/rpl_gtid_execution.test (+1/-1)
mysql-test/suite/rpl/t/rpl_gtid_failover.test (+8/-4)
mysql-test/suite/rpl/t/rpl_gtid_heartbeat_2slave.cnf (+12/-0)
mysql-test/suite/rpl/t/rpl_gtid_heartbeat_2slave.test (+10/-0)
mysql-test/suite/rpl/t/rpl_gtid_ignore_table_filter_insensitive-master.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_gtid_ignore_table_filter_insensitive-slave.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_gtid_ignore_table_filter_insensitive.test (+8/-0)
mysql-test/suite/rpl/t/rpl_gtid_ignore_table_filter_sensitive-master.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_gtid_ignore_table_filter_sensitive-slave.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_gtid_ignore_table_filter_sensitive.test (+9/-0)
mysql-test/suite/rpl/t/rpl_gtid_loaddata_s-slave.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_gtid_loaddata_s.test (+7/-0)
mysql-test/suite/rpl/t/rpl_gtid_mode.test (+5/-4)
mysql-test/suite/rpl/t/rpl_gtid_parallel-master.opt (+0/-1)
mysql-test/suite/rpl/t/rpl_gtid_parallel-slave.opt (+0/-1)
mysql-test/suite/rpl/t/rpl_gtid_parallel.test (+1/-0)
mysql-test/suite/rpl/t/rpl_gtid_purged_fail_to_connect-master.opt (+1/-1)
mysql-test/suite/rpl/t/rpl_gtid_purged_fail_to_connect-slave.opt (+1/-1)
mysql-test/suite/rpl/t/rpl_gtid_purged_fail_to_connect.test (+2/-2)
mysql-test/suite/rpl/t/rpl_gtid_purged_maintained.test (+3/-3)
mysql-test/suite/rpl/t/rpl_gtid_row_event_max_size-master.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_gtid_row_event_max_size-slave.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_gtid_row_event_max_size.test (+10/-0)
mysql-test/suite/rpl/t/rpl_gtid_row_show_relaylog_events.test (+15/-0)
mysql-test/suite/rpl/t/rpl_gtid_sql_until_before_after.test (+1/-1)
mysql-test/suite/rpl/t/rpl_gtid_stm_insert_delayed.test (+2/-0)
mysql-test/suite/rpl/t/rpl_gtid_stm_mix_show_relaylog_events.test (+15/-0)
mysql-test/suite/rpl/t/rpl_heartbeat.test (+2/-2)
mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test (+2/-131)
mysql-test/suite/rpl/t/rpl_heartbeat_basic.test (+12/-11)
mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test (+1/-0)
mysql-test/suite/rpl/t/rpl_idempotency.test (+5/-5)
mysql-test/suite/rpl/t/rpl_ignore_db_filter.test (+1/-1)
mysql-test/suite/rpl/t/rpl_ignore_revoke.test (+3/-3)
mysql-test/suite/rpl/t/rpl_ignore_table.test (+1/-0)
mysql-test/suite/rpl/t/rpl_ignore_table_filter_insensitive.test (+2/-9)
mysql-test/suite/rpl/t/rpl_ignore_table_filter_sensitive.test (+2/-9)
mysql-test/suite/rpl/t/rpl_incident.test (+2/-1)
mysql-test/suite/rpl/t/rpl_init_slave.test (+3/-3)
mysql-test/suite/rpl/t/rpl_innodb_bug28430.test (+1/-1)
mysql-test/suite/rpl/t/rpl_innodb_bug30888.test (+1/-1)
mysql-test/suite/rpl/t/rpl_insert.test (+3/-2)
mysql-test/suite/rpl/t/rpl_invoked_features.test (+6/-3)
mysql-test/suite/rpl/t/rpl_killed_ddl.test (+1/-1)
mysql-test/suite/rpl/t/rpl_known_bugs_detection.test (+2/-2)
mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test (+1/-1)
mysql-test/suite/rpl/t/rpl_loaddata.test (+1/-0)
mysql-test/suite/rpl/t/rpl_loaddata_charset.test (+2/-2)
mysql-test/suite/rpl/t/rpl_loaddata_fatal.test (+3/-2)
mysql-test/suite/rpl/t/rpl_loaddata_m.test (+2/-2)
mysql-test/suite/rpl/t/rpl_loaddata_map.test (+2/-2)
mysql-test/suite/rpl/t/rpl_loaddata_s.test (+2/-22)
mysql-test/suite/rpl/t/rpl_loaddata_simple.test (+2/-2)
mysql-test/suite/rpl/t/rpl_loaddata_symlink.test (+2/-2)
mysql-test/suite/rpl/t/rpl_loaddatalocal.test (+9/-9)
mysql-test/suite/rpl/t/rpl_loadfile.test (+1/-1)
mysql-test/suite/rpl/t/rpl_locale.test (+2/-2)
mysql-test/suite/rpl/t/rpl_log_pos.test (+3/-2)
mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test (+1/-1)
mysql-test/suite/rpl/t/rpl_manual_change_index_file.test (+6/-5)
mysql-test/suite/rpl/t/rpl_many_optimize.test (+1/-1)
mysql-test/suite/rpl/t/rpl_master_pos_wait.test (+1/-1)
mysql-test/suite/rpl/t/rpl_migration_crash_safe.test (+2/-2)
mysql-test/suite/rpl/t/rpl_misc_functions.test (+3/-3)
mysql-test/suite/rpl/t/rpl_mix_found_rows.test (+6/-6)
mysql-test/suite/rpl/t/rpl_mix_insert_delayed.test (+1/-0)
mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test (+2/-2)
mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test (+3/-3)
mysql-test/suite/rpl/t/rpl_mts_debug.test (+4/-3)
mysql-test/suite/rpl/t/rpl_multi_delete.test (+1/-1)
mysql-test/suite/rpl/t/rpl_multi_delete2.test (+1/-1)
mysql-test/suite/rpl/t/rpl_multi_engine.test (+5/-5)
mysql-test/suite/rpl/t/rpl_multi_update2.test (+1/-0)
mysql-test/suite/rpl/t/rpl_multi_update4.test (+3/-2)
mysql-test/suite/rpl/t/rpl_mysql_upgrade.test (+2/-2)
mysql-test/suite/rpl/t/rpl_mysqlbinlog_gtid_on-master.opt (+0/-1)
mysql-test/suite/rpl/t/rpl_mysqlbinlog_gtid_on-slave.opt (+0/-1)
mysql-test/suite/rpl/t/rpl_mysqlbinlog_gtid_on.test (+3/-1)
mysql-test/suite/rpl/t/rpl_name_const.test (+1/-1)
mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test (+1/-1)
mysql-test/suite/rpl/t/rpl_optimize.test (+1/-1)
mysql-test/suite/rpl/t/rpl_packet.test (+8/-8)
mysql-test/suite/rpl/t/rpl_parallel_change_master.test (+3/-2)
mysql-test/suite/rpl/t/rpl_parallel_conf_limits.test (+2/-2)
mysql-test/suite/rpl/t/rpl_parallel_conflicts.test (+2/-2)
mysql-test/suite/rpl/t/rpl_parallel_ddl.test (+3/-3)
mysql-test/suite/rpl/t/rpl_parallel_multi_db.test (+6/-6)
mysql-test/suite/rpl/t/rpl_parallel_seconds_behind_master.test (+1/-1)
mysql-test/suite/rpl/t/rpl_parallel_start_stop.test (+9/-9)
mysql-test/suite/rpl/t/rpl_parallel_switch_sequential.test (+1/-0)
mysql-test/suite/rpl/t/rpl_parallel_temp_query.test (+4/-4)
mysql-test/suite/rpl/t/rpl_plugin_load.test (+2/-2)
mysql-test/suite/rpl/t/rpl_ps.test (+4/-4)
mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test (+1/-1)
mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test (+2/-1)
mysql-test/suite/rpl/t/rpl_read_only.test (+5/-5)
mysql-test/suite/rpl/t/rpl_replicate_do.test (+5/-5)
mysql-test/suite/rpl/t/rpl_replicate_event_after_sync_stage.test (+66/-0)
mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test (+4/-3)
mysql-test/suite/rpl/t/rpl_report_port.test (+1/-1)
mysql-test/suite/rpl/t/rpl_rewrt_db.test (+9/-9)
mysql-test/suite/rpl/t/rpl_rotate_logs.test (+6/-6)
mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_4_bytes.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_NOW.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_USER.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test (+17/-17)
mysql-test/suite/rpl/t/rpl_row_basic_8partition.test (+9/-9)
mysql-test/suite/rpl/t/rpl_row_colSize.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_corruption.test (+4/-4)
mysql-test/suite/rpl/t/rpl_row_create_table.test (+19/-19)
mysql-test/suite/rpl/t/rpl_row_drop.test (+5/-5)
mysql-test/suite/rpl/t/rpl_row_event_max_size.test (+6/-90)
mysql-test/suite/rpl/t/rpl_row_find_row.test (+8/-8)
mysql-test/suite/rpl/t/rpl_row_func001.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_func002.test (+5/-5)
mysql-test/suite/rpl/t/rpl_row_hash_scan.test (+19/-18)
mysql-test/suite/rpl/t/rpl_row_hash_scan_sanity.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_ignorable_event.test (+1/-1)
mysql-test/suite/rpl/t/rpl_row_img_eng_full.test (+1/-0)
mysql-test/suite/rpl/t/rpl_row_img_misc.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_img_sanity.test (+16/-16)
mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test (+1/-1)
mysql-test/suite/rpl/t/rpl_row_insert_delayed.test (+1/-0)
mysql-test/suite/rpl/t/rpl_row_lcase_tblnames.test (+1/-0)
mysql-test/suite/rpl/t/rpl_row_merge_engine.test (+3/-3)
mysql-test/suite/rpl/t/rpl_row_mts_crash_safe.test (+1/-0)
mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test (+1/-0)
mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_record_find_myisam.test (+1/-1)
mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test (+3/-18)
mysql-test/suite/rpl/t/rpl_row_sp001.test (+6/-6)
mysql-test/suite/rpl/t/rpl_row_sp005.test (+3/-3)
mysql-test/suite/rpl/t/rpl_row_sp008.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_sp009.test (+4/-4)
mysql-test/suite/rpl/t/rpl_row_sp010.test (+3/-3)
mysql-test/suite/rpl/t/rpl_row_sp011.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_sp012.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test (+1/-1)
mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test (+1/-1)
mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test (+4/-4)
mysql-test/suite/rpl/t/rpl_row_trig001.test (+3/-3)
mysql-test/suite/rpl/t/rpl_row_trig002.test (+4/-4)
mysql-test/suite/rpl/t/rpl_row_trig003.test (+1/-1)
mysql-test/suite/rpl/t/rpl_row_trunc_temp.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test (+2/-2)
mysql-test/suite/rpl/t/rpl_row_until.test (+5/-4)
mysql-test/suite/rpl/t/rpl_row_utf16.test (+1/-1)
mysql-test/suite/rpl/t/rpl_row_utf32.test (+1/-1)
mysql-test/suite/rpl/t/rpl_row_view01.test (+4/-4)
mysql-test/suite/rpl/t/rpl_row_wide_table.test (+2/-2)
mysql-test/suite/rpl/t/rpl_seconds_behind_master.test (+5/-5)
mysql-test/suite/rpl/t/rpl_semi_sync.test (+11/-11)
mysql-test/suite/rpl/t/rpl_semi_sync_deadlock.test (+2/-2)
mysql-test/suite/rpl/t/rpl_semi_sync_event.test (+1/-1)
mysql-test/suite/rpl/t/rpl_server_id2-master.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_server_id2-slave.opt (+1/-1)
mysql-test/suite/rpl/t/rpl_server_id2.test (+2/-2)
mysql-test/suite/rpl/t/rpl_server_id_ignore-master.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_server_id_ignore-slave.opt (+1/-1)
mysql-test/suite/rpl/t/rpl_server_id_ignore.test (+3/-3)
mysql-test/suite/rpl/t/rpl_server_uuid.cnf (+1/-0)
mysql-test/suite/rpl/t/rpl_server_uuid.test (+3/-2)
mysql-test/suite/rpl/t/rpl_session_var.test (+4/-4)
mysql-test/suite/rpl/t/rpl_set_charset.test (+2/-2)
mysql-test/suite/rpl/t/rpl_show_errors.test (+1/-1)
mysql-test/suite/rpl/t/rpl_show_slave_running.test (+1/-1)
mysql-test/suite/rpl/t/rpl_skip_error.test (+9/-9)
mysql-test/suite/rpl/t/rpl_skip_incident.test (+2/-2)
mysql-test/suite/rpl/t/rpl_skip_slave_err_warnings-slave.opt (+1/-0)
mysql-test/suite/rpl/t/rpl_skip_slave_err_warnings.test (+38/-0)
mysql-test/suite/rpl/t/rpl_slave_grp_exec.test (+6/-6)
mysql-test/suite/rpl/t/rpl_slave_load_in.test (+2/-2)
mysql-test/suite/rpl/t/rpl_slave_skip.test (+8/-7)
mysql-test/suite/rpl/t/rpl_slave_status.test (+3/-3)
mysql-test/suite/rpl/t/rpl_slow_query_log.test (+7/-7)
mysql-test/suite/rpl/t/rpl_sp.test (+28/-28)
mysql-test/suite/rpl/t/rpl_sp004.test (+4/-4)
mysql-test/suite/rpl/t/rpl_sp_effects.test (+10/-10)
mysql-test/suite/rpl/t/rpl_spec_variables.test (+8/-8)
mysql-test/suite/rpl/t/rpl_sporadic_master.test (+4/-3)
mysql-test/suite/rpl/t/rpl_ssl.test (+36/-13)
mysql-test/suite/rpl/t/rpl_ssl1.test (+5/-5)
mysql-test/suite/rpl/t/rpl_stm_000001.test (+7/-6)
mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test (+4/-4)
mysql-test/suite/rpl/t/rpl_stm_found_rows.test (+3/-3)
mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test (+2/-10)
mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test (+1/-0)
mysql-test/suite/rpl/t/rpl_stm_loaddata_concurrent.test (+2/-0)
mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test (+2/-18)
mysql-test/suite/rpl/t/rpl_stm_mixed_mts_crash_safe.test (+1/-0)
mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test (+3/-3)
mysql-test/suite/rpl/t/rpl_stm_no_op.test (+10/-10)
mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test (+3/-3)
mysql-test/suite/rpl/t/rpl_stm_sql_mode.test (+1/-1)
mysql-test/suite/rpl/t/rpl_stm_until.test (+3/-2)
mysql-test/suite/rpl/t/rpl_stm_user_variables.test (+9/-9)
mysql-test/suite/rpl/t/rpl_stop_slave.test (+2/-2)
mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test (+14/-14)
mysql-test/suite/rpl/t/rpl_sync.test (+3/-3)
mysql-test/suite/rpl/t/rpl_temp_table.test (+1/-1)
mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test (+8/-8)
mysql-test/suite/rpl/t/rpl_temporal_fractional.test (+6/-6)
mysql-test/suite/rpl/t/rpl_temporary.test (+14/-13)
mysql-test/suite/rpl/t/rpl_temporary_errors.test (+2/-2)
mysql-test/suite/rpl/t/rpl_timezone.test (+10/-10)
mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test (+1/-1)
mysql-test/suite/rpl/t/rpl_trigger.test (+13/-13)
mysql-test/suite/rpl/t/rpl_trunc_temp.test (+3/-3)
mysql-test/suite/rpl/t/rpl_typeconv.test (+2/-1)
mysql-test/suite/rpl/t/rpl_typeconv_innodb.test (+2/-2)
mysql-test/suite/rpl/t/rpl_user.test (+6/-6)
mysql-test/suite/rpl/t/rpl_user_variables.test (+18/-14)
mysql-test/suite/rpl/t/rpl_variables.test (+3/-3)
mysql-test/suite/rpl/t/rpl_variables_stm.test (+3/-3)
mysql-test/suite/rpl/t/rpl_view.test (+15/-16)
mysql-test/suite/rpl/t/rpl_view_multi.test (+4/-4)
mysql-test/suite/sys_vars/r/block_encryption_mode_basic.result (+200/-0)
mysql-test/suite/sys_vars/r/general_log_file_basic.result (+1/-0)
mysql-test/suite/sys_vars/r/innodb_fil_make_page_dirty_debug_basic.result (+26/-0)
mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_basic.result (+10/-4)
mysql-test/suite/sys_vars/r/innodb_saved_page_number_debug_basic.result (+26/-0)
mysql-test/suite/sys_vars/r/innodb_thread_sleep_delay_basic.result (+30/-0)
mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result (+1/-0)
mysql-test/suite/sys_vars/r/sql_mode_basic.result (+16/-0)
mysql-test/suite/sys_vars/t/block_encryption_mode_basic.test (+225/-0)
mysql-test/suite/sys_vars/t/general_log_file_basic.test (+1/-1)
mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test (+34/-0)
mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_basic.test (+4/-1)
mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test (+35/-0)
mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test (+18/-0)
mysql-test/suite/sys_vars/t/pfs_digests_size_basic.test (+1/-0)
mysql-test/suite/sys_vars/t/pfs_session_connect_attrs_size_basic.test (+1/-0)
mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test (+1/-1)
mysql-test/t/alter_table.test (+0/-22)
mysql-test/t/ctype_uca.test (+48/-0)
mysql-test/t/derived.test (+37/-0)
mysql-test/t/func_aes.test (+225/-0)
mysql-test/t/func_aes_cfb1.test (+20/-0)
mysql-test/t/func_aes_cfb128.test (+20/-0)
mysql-test/t/func_aes_cfb8.test (+20/-0)
mysql-test/t/func_aes_misc.test (+180/-0)
mysql-test/t/func_aes_ofb.test (+20/-0)
mysql-test/t/information_schema-big.test (+2/-0)
mysql-test/t/innodb_mysql_sync.test (+199/-0)
mysql-test/t/mysqlcheck.test (+0/-3)
mysql-test/t/openssl_1.test (+1/-1)
mysql-test/t/parser.test (+25/-0)
mysql-test/t/partition_index_innodb.test (+143/-0)
mysql-test/t/partition_index_myisam.test (+108/-0)
mysql-test/t/partition_innodb.test (+20/-0)
mysql-test/t/type_temporal_fractional.test (+147/-0)
mysys/mf_arr_appstr.c (+1/-0)
mysys/mf_qsort2.c (+1/-0)
mysys/mf_same.c (+1/-0)
mysys/mf_soundex.c (+1/-0)
mysys/mf_wcomp.c (+1/-0)
mysys/mulalloc.c (+1/-0)
mysys/my_alarm.c (+1/-0)
mysys/my_crc32.c (+1/-0)
mysys/my_div.c (+1/-0)
mysys/my_getpagesize.c (+1/-0)
mysys/my_handler_errors.h (+2/-1)
mysys/my_libwrap.c (+1/-0)
mysys/my_memmem.c (+1/-0)
mysys/test_dir.c (+1/-0)
mysys/test_xml.c (+1/-0)
mysys_ssl/CMakeLists.txt (+13/-1)
mysys_ssl/my_aes.cc (+31/-272)
mysys_ssl/my_aes_impl.h (+31/-0)
mysys_ssl/my_aes_openssl.cc (+213/-0)
mysys_ssl/my_aes_yassl.cc (+240/-0)
mysys_ssl/my_default.cc (+5/-5)
mysys_ssl/my_rnd.cc (+39/-23)
packaging/rpm-fedora/CMakeLists.txt (+1/-2)
packaging/rpm-fedora/mysql-5.6-libmysqlclient-symbols.patch (+65/-143)
packaging/rpm-fedora/mysql-5.6.14-mysql-install.patch (+0/-204)
packaging/rpm-fedora/mysql-5.6.16-mysql-install.patch (+136/-0)
packaging/rpm-fedora/mysql-embedded-check.c (+0/-26)
packaging/rpm-fedora/mysql.spec.in (+21/-76)
packaging/rpm-oel/CMakeLists.txt (+2/-2)
packaging/rpm-oel/mysql-5.6-libmysqlclient-symbols.patch (+960/-0)
packaging/rpm-oel/mysql-5.6.14-mysql-install.patch (+0/-204)
packaging/rpm-oel/mysql-5.6.16-mysql-install.patch (+136/-0)
packaging/rpm-oel/mysql-embedded-check.c (+0/-26)
packaging/rpm-oel/mysql.spec.in (+140/-46)
plugin/innodb_memcached/daemon_memcached/CMakeLists.txt (+2/-2)
plugin/innodb_memcached/daemon_memcached/daemon/memcached.c (+10/-0)
plugin/innodb_memcached/daemon_memcached/daemon/memcached_mysql.cc (+14/-1)
plugin/innodb_memcached/daemon_memcached/daemon/memcached_mysql.h (+3/-1)
plugin/innodb_memcached/daemon_memcached/include/memcached/protocol_binary.h (+1/-0)
plugin/innodb_memcached/innodb_memcache/CMakeLists.txt (+2/-2)
plugin/semisync/semisync.cc (+1/-0)
plugin/semisync/semisync.h (+1/-0)
plugin/semisync/semisync_master.cc (+10/-3)
plugin/semisync/semisync_master_plugin.cc (+6/-1)
plugin/semisync/semisync_slave_plugin.cc (+1/-0)
scripts/CMakeLists.txt (+9/-1)
scripts/fill_help_tables.sql (+1615/-1612)
scripts/msql2mysql.sh (+3/-1)
scripts/mysql_config.pl.in (+2/-2)
scripts/mysql_config.sh (+4/-4)
scripts/mysql_convert_table_format.sh (+3/-1)
scripts/mysql_find_rows.sh (+3/-1)
scripts/mysql_fix_extensions.sh (+2/-1)
scripts/mysql_install_db.pl.in (+52/-20)
scripts/mysql_setpermission.sh (+3/-1)
scripts/mysql_test_data_timezone.sql (+1/-0)
scripts/mysqlaccess.sh (+4/-2)
scripts/mysqlbug.sh (+1/-0)
sql-common/client_authentication.cc (+6/-1)
sql-common/my_time.c (+11/-1)
sql-common/pack.c (+1/-0)
sql/binlog.cc (+33/-3)
sql/ha_partition.cc (+171/-19)
sql/ha_partition.h (+13/-7)
sql/handler.cc (+1/-0)
sql/handler.h (+8/-3)
sql/item.cc (+4/-2)
sql/item.h (+12/-1)
sql/item_create.cc (+94/-19)
sql/item_strfunc.cc (+177/-15)
sql/item_strfunc.h (+20/-0)
sql/item_subselect.cc (+11/-10)
sql/log_event.cc (+152/-50)
sql/log_event.h (+76/-29)
sql/mysqld.cc (+3/-2)
sql/opt_range.cc (+3/-0)
sql/replication.h (+18/-23)
sql/rpl_gtid_execution.cc (+7/-1)
sql/rpl_handler.cc (+12/-2)
sql/rpl_handler.h (+3/-2)
sql/rpl_master.cc (+49/-28)
sql/rpl_rli.h (+0/-7)
sql/rpl_slave.cc (+9/-112)
sql/share/charsets/Index.xml (+1/-0)
sql/share/charsets/armscii8.xml (+1/-0)
sql/share/charsets/ascii.xml (+1/-0)
sql/share/charsets/cp1250.xml (+1/-0)
sql/share/charsets/cp1256.xml (+1/-0)
sql/share/charsets/cp1257.xml (+1/-0)
sql/share/charsets/cp850.xml (+1/-0)
sql/share/charsets/cp852.xml (+1/-0)
sql/share/charsets/cp866.xml (+1/-0)
sql/share/charsets/dec8.xml (+1/-0)
sql/share/charsets/geostd8.xml (+1/-0)
sql/share/charsets/greek.xml (+1/-0)
sql/share/charsets/hebrew.xml (+1/-0)
sql/share/charsets/hp8.xml (+1/-0)
sql/share/charsets/keybcs2.xml (+1/-0)
sql/share/charsets/koi8r.xml (+1/-0)
sql/share/charsets/koi8u.xml (+1/-0)
sql/share/charsets/languages.html (+1/-0)
sql/share/charsets/latin1.xml (+1/-0)
sql/share/charsets/latin2.xml (+1/-0)
sql/share/charsets/latin5.xml (+1/-0)
sql/share/charsets/latin7.xml (+1/-0)
sql/share/charsets/macce.xml (+1/-0)
sql/share/charsets/macroman.xml (+1/-0)
sql/share/charsets/swe7.xml (+1/-0)
sql/share/errmsg-utf8.txt (+4/-0)
sql/sql_acl.cc (+9/-1)
sql/sql_admin.cc (+27/-5)
sql/sql_alter.h (+3/-1)
sql/sql_class.cc (+11/-6)
sql/sql_class.h (+17/-2)
sql/sql_executor.cc (+2/-12)
sql/sql_state.c (+1/-0)
sql/sql_table.cc (+27/-22)
sql/sql_table.h (+3/-2)
sql/sql_trigger.cc (+7/-0)
sql/sql_yacc.cc (+3737/-8151)
sql/sql_yacc.h (+19/-25)
sql/sql_yacc.yy (+15/-1)
sql/sys_vars.cc (+48/-0)
sql/table.cc (+27/-24)
storage/archive/archive_test.c (+1/-0)
storage/heap/_check.c (+1/-0)
storage/heap/_rectest.c (+1/-0)
storage/heap/hp_extra.c (+1/-0)
storage/heap/hp_rfirst.c (+1/-0)
storage/heap/hp_rlast.c (+1/-0)
storage/heap/hp_rnext.c (+1/-0)
storage/heap/hp_rprev.c (+1/-0)
storage/heap/hp_rrnd.c (+1/-0)
storage/heap/hp_rsame.c (+1/-0)
storage/heap/hp_scan.c (+1/-0)
storage/heap/hp_update.c (+1/-0)
storage/innobase/api/api0api.cc (+32/-21)
storage/innobase/btr/btr0cur.cc (+6/-9)
storage/innobase/buf/buf0buddy.cc (+1/-1)
storage/innobase/buf/buf0buf.cc (+28/-9)
storage/innobase/buf/buf0dblwr.cc (+37/-17)
storage/innobase/buf/buf0flu.cc (+6/-4)
storage/innobase/buf/buf0lru.cc (+8/-6)
storage/innobase/dict/dict0dict.cc (+4/-5)
storage/innobase/dict/dict0load.cc (+2/-1)
storage/innobase/dict/dict0stats.cc (+128/-53)
storage/innobase/fil/fil0fil.cc (+25/-37)
storage/innobase/fts/fts0blex.cc (+231/-233)
storage/innobase/fts/fts0fts.cc (+1/-1)
storage/innobase/fts/fts0opt.cc (+4/-4)
storage/innobase/fts/fts0pars.cc (+15/-9)
storage/innobase/fts/fts0que.cc (+31/-27)
storage/innobase/fts/fts0sql.cc (+3/-2)
storage/innobase/fts/fts0tlex.cc (+39/-38)
storage/innobase/handler/ha_innodb.cc (+156/-52)
storage/innobase/handler/handler0alter.cc (+11/-4)
storage/innobase/handler/i_s.cc (+169/-118)
storage/innobase/ibuf/ibuf0ibuf.cc (+3/-2)
storage/innobase/include/buf0buf.h (+10/-1)
storage/innobase/include/buf0buf.ic (+3/-3)
storage/innobase/include/buf0dblwr.h (+4/-3)
storage/innobase/include/db0err.h (+2/-0)
storage/innobase/include/fil0fil.h (+27/-1)
storage/innobase/include/lock0lock.h (+4/-11)
storage/innobase/include/log0recv.h (+6/-2)
storage/innobase/include/os0sync.h (+2/-2)
storage/innobase/include/os0sync.ic (+4/-2)
storage/innobase/include/row0log.h (+7/-6)
storage/innobase/include/sync0rw.ic (+24/-13)
storage/innobase/include/sync0sync.ic (+4/-2)
storage/innobase/include/ut0ut.h (+14/-1)
storage/innobase/lock/lock0lock.cc (+76/-79)
storage/innobase/log/log0recv.cc (+3/-14)
storage/innobase/os/os0sync.cc (+2/-2)
storage/innobase/page/page0zip.cc (+77/-65)
storage/innobase/pars/lexyy.cc (+28/-26)
storage/innobase/pars/pars0pars.cc (+3/-2)
storage/innobase/rem/rem0cmp.cc (+16/-15)
storage/innobase/row/row0ftsort.cc (+12/-9)
storage/innobase/row/row0ins.cc (+5/-1)
storage/innobase/row/row0log.cc (+277/-96)
storage/innobase/row/row0quiesce.cc (+5/-5)
storage/innobase/row/row0uins.cc (+2/-3)
storage/innobase/row/row0umod.cc (+9/-6)
storage/innobase/row/row0upd.cc (+10/-41)
storage/innobase/row/row0vers.cc (+34/-9)
storage/innobase/srv/srv0conc.cc (+1/-1)
storage/innobase/srv/srv0srv.cc (+5/-3)
storage/innobase/srv/srv0start.cc (+37/-4)
storage/innobase/sync/sync0arr.cc (+1/-1)
storage/innobase/trx/trx0trx.cc (+2/-1)
storage/innobase/ut/ut0ut.cc (+2/-0)
storage/myisam/ftbench/Ecompare.pl (+1/-0)
storage/myisam/ftbench/Ecreate.pl (+1/-0)
storage/myisam/ftbench/Ereport.pl (+1/-0)
storage/myisam/ftbench/ft-test-run.sh (+1/-0)
storage/myisam/mi_rfirst.c (+1/-0)
storage/myisam/mi_rlast.c (+1/-0)
storage/myisam/mi_rrnd.c (+1/-0)
storage/myisam/mi_rsamepos.c (+1/-0)
storage/myisam/mi_test_all.sh (+1/-0)
storage/myisam/rt_index.h (+1/-0)
storage/myisam/rt_key.c (+1/-0)
storage/myisam/rt_key.h (+1/-0)
storage/myisam/rt_mbr.h (+1/-0)
storage/myisam/sp_defs.h (+1/-0)
storage/myisammrg/myrg_delete.c (+1/-0)
storage/myisammrg/myrg_locking.c (+1/-0)
storage/myisammrg/myrg_panic.c (+1/-0)
storage/myisammrg/myrg_range.c (+1/-0)
storage/myisammrg/myrg_records.c (+1/-0)
storage/myisammrg/myrg_rfirst.c (+1/-0)
storage/myisammrg/myrg_rlast.c (+1/-0)
storage/myisammrg/myrg_rnext.c (+1/-0)
storage/myisammrg/myrg_rnext_same.c (+1/-0)
storage/myisammrg/myrg_rprev.c (+1/-0)
storage/myisammrg/myrg_rrnd.c (+1/-0)
storage/myisammrg/myrg_rsame.c (+1/-0)
storage/myisammrg/myrg_update.c (+1/-0)
storage/myisammrg/myrg_write.c (+1/-0)
storage/ndb/CMakeLists.txt (+3/-3)
storage/ndb/config/type_mgmapiclient.cmake (+1/-0)
storage/ndb/config/type_ndbapiclient.cmake (+1/-0)
storage/ndb/config/type_util.cmake (+1/-0)
storage/ndb/docs/doxygen/Doxyfile.mgmapi (+1/-0)
storage/ndb/docs/doxygen/Doxyfile.ndb (+1/-0)
storage/ndb/docs/doxygen/Doxyfile.ndbapi (+1/-0)
storage/ndb/docs/doxygen/Doxyfile.odbc (+1/-0)
storage/ndb/docs/doxygen/postdoxy.pl (+1/-0)
storage/ndb/include/kernel/signaldata/AlterIndxImpl.hpp (+1/-0)
storage/ndb/include/kernel/signaldata/BuildIndxImpl.hpp (+1/-0)
storage/ndb/include/kernel/signaldata/CreateIndxImpl.hpp (+1/-0)
storage/ndb/include/kernel/signaldata/CreateNodegroupImpl.hpp (+1/-0)
storage/ndb/include/kernel/signaldata/DictSignal.hpp (+1/-0)
storage/ndb/include/kernel/signaldata/DihScanTab.hpp (+1/-0)
storage/ndb/include/kernel/signaldata/DropIndxImpl.hpp (+1/-0)
storage/ndb/include/kernel/signaldata/DropNodegroup.hpp (+1/-0)
storage/ndb/include/kernel/signaldata/DropNodegroupImpl.hpp (+1/-0)
storage/ndb/include/kernel/signaldata/EnableCom.hpp (+1/-0)
storage/ndb/include/kernel/signaldata/HashMapImpl.hpp (+1/-0)
storage/ndb/include/kernel/signaldata/LqhTransReq.hpp (+1/-0)
storage/ndb/include/kernel/signaldata/StopForCrash.hpp (+1/-0)
storage/ndb/include/kernel/signaldata/TabCommit.hpp (+1/-0)
storage/ndb/src/common/CMakeLists.txt (+1/-0)
storage/ndb/src/common/debugger/signaldata/AlterIndxImpl.cpp (+1/-0)
storage/ndb/src/common/debugger/signaldata/BuildIndx.cpp (+1/-0)
storage/ndb/src/common/debugger/signaldata/BuildIndxImpl.cpp (+1/-0)
storage/ndb/src/common/debugger/signaldata/CreateIndxImpl.cpp (+1/-0)
storage/ndb/src/common/debugger/signaldata/CreateTab.cpp (+1/-0)
storage/ndb/src/common/debugger/signaldata/CreateTable.cpp (+1/-0)
storage/ndb/src/common/debugger/signaldata/DropIndxImpl.cpp (+1/-0)
storage/ndb/src/common/debugger/signaldata/DropTable.cpp (+1/-0)
storage/ndb/src/common/debugger/signaldata/DropTrigImpl.cpp (+1/-0)
storage/ndb/src/common/debugger/signaldata/GetTabInfo.cpp (+1/-0)
storage/ndb/src/kernel/blocks/RestoreProxy.cpp (+1/-0)
storage/ndb/src/kernel/blocks/RestoreProxy.hpp (+1/-0)
storage/ndb/src/kernel/blocks/backup/BackupProxy.cpp (+1/-0)
storage/ndb/src/kernel/blocks/backup/BackupProxy.hpp (+1/-0)
storage/ndb/src/kernel/error/CMakeLists.txt (+1/-0)
storage/ndb/src/kernel/vm/GlobalData.cpp (+1/-0)
storage/ndb/src/kernel/vm/SimulatedBlock_mt.cpp (+1/-0)
storage/ndb/src/kernel/vm/SimulatedBlock_nonmt.cpp (+1/-0)
storage/ndb/src/kernel/vm/TransporterCallbackKernel.hpp (+1/-0)
storage/ndb/src/kernel/vm/TransporterCallback_mt.cpp (+1/-0)
storage/ndb/src/kernel/vm/TransporterCallback_nonmt.cpp (+1/-0)
storage/ndb/test/ndbapi/bank/CMakeLists.txt (+1/-0)
storage/ndb/test/ndbapi/testSingleUserMode.cpp (+1/-0)
storage/ndb/test/run-test/16node-tests.txt (+1/-0)
storage/ndb/test/run-test/atrt-analyze-result.sh (+1/-0)
storage/ndb/test/run-test/atrt-mysql-test-run (+1/-0)
storage/ndb/test/run-test/atrt-testBackup (+1/-0)
storage/ndb/test/run-test/basic.txt (+1/-0)
storage/ndb/test/run-test/make-config.sh (+1/-0)
storage/ndb/test/run-test/make-html-reports.sh (+1/-0)
storage/ndb/test/run-test/make-index.sh (+1/-0)
storage/ndb/test/run-test/ndb-autotest.sh (+1/-0)
storage/ndb/test/run-test/upgrade-boot.sh (+1/-0)
storage/ndb/test/src/getarg.c (+1/-0)
storage/perfschema/ha_perfschema.cc (+8/-2)
storage/perfschema/ha_perfschema.h (+36/-1)
storage/perfschema/pfs.cc (+3/-1)
storage/perfschema/pfs_digest.cc (+2/-1)
storage/perfschema/table_helper.h (+2/-2)
storage/perfschema/table_threads.cc (+16/-2)
strings/ctype-uca.c (+10/-6)
strings/t_ctype.h (+1/-0)
support-files/MacOSX/Description.plist.sh (+1/-0)
support-files/MacOSX/Info.plist.sh (+1/-0)
support-files/MacOSX/MySQLCOM (+1/-0)
support-files/MacOSX/ReadMe.txt (+10/-10)
support-files/MacOSX/StartupItem.Description.plist (+1/-0)
support-files/MacOSX/StartupItem.Info.plist (+1/-0)
support-files/MacOSX/StartupItem.postinstall (+1/-0)
support-files/MacOSX/StartupParameters.plist.sh (+1/-0)
support-files/MacOSX/mwar-wrapper (+1/-0)
support-files/MacOSX/mwcc-wrapper (+1/-0)
support-files/MacOSX/postflight.sh (+1/-0)
support-files/MacOSX/preflight.sh (+1/-0)
support-files/RHEL4-SElinux/mysql.fc (+1/-0)
support-files/RHEL4-SElinux/mysql.te (+1/-0)
support-files/mysql.5.6.16.spec (+0/-2080)
support-files/mysql.5.6.17.spec (+2080/-0)
support-files/mysql.m4 (+1/-0)
tests/connect_test.c (+1/-0)
tests/deadlock_test.c (+1/-0)
tests/drop_test.pl (+1/-0)
tests/export.pl (+1/-0)
tests/fork2_test.pl (+1/-0)
tests/fork_big.pl (+1/-0)
tests/fork_big2.pl (+1/-0)
tests/index_corrupt.pl (+1/-0)
tests/insert_and_repair.pl (+1/-0)
tests/insert_test.c (+1/-0)
tests/list_test.c (+1/-0)
tests/lock_test.pl (+1/-0)
tests/mysql_client_fw.c (+12/-1)
tests/pmail.pl (+1/-0)
tests/rename_test.pl (+1/-0)
tests/select_test.c (+1/-0)
tests/showdb_test.c (+1/-0)
tests/ssl_test.c (+1/-0)
tests/table_types.pl (+1/-0)
tests/test_delayed_insert.pl (+1/-0)
tests/truncate.pl (+1/-0)
unittest/examples/simple-t.c (+1/-0)
unittest/gunit/yassl/CMakeLists.txt (+1/-2)
To merge this branch: bzr merge lp:~james-page/ubuntu/trusty/mysql-5.6/5.6.17-security-update
Reviewer Review Type Date Requested Status
Ubuntu Development Team Pending
Review via email: mp+217412@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed directory '.pc/CVE-2014-0001.patch'
2=== removed directory '.pc/CVE-2014-0001.patch/client'
3=== removed file '.pc/CVE-2014-0001.patch/client/mysql.cc'
4--- .pc/CVE-2014-0001.patch/client/mysql.cc 2014-03-17 08:56:24 +0000
5+++ .pc/CVE-2014-0001.patch/client/mysql.cc 1970-01-01 00:00:00 +0000
6@@ -1,5557 +0,0 @@
7-/*
8- Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
9-
10- This program is free software; you can redistribute it and/or modify
11- it under the terms of the GNU General Public License as published by
12- the Free Software Foundation; version 2 of the License.
13-
14- This program is distributed in the hope that it will be useful,
15- but WITHOUT ANY WARRANTY; without even the implied warranty of
16- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17- GNU General Public License for more details.
18-
19- You should have received a copy of the GNU General Public License
20- along with this program; if not, write to the Free Software
21- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22-*/
23-
24-/* mysql command tool
25- * Commands compatible with mSQL by David J. Hughes
26- *
27- * Written by:
28- * Michael 'Monty' Widenius
29- * Andi Gutmans <andi@zend.com>
30- * Zeev Suraski <zeev@zend.com>
31- * Jani Tolonen <jani@mysql.com>
32- * Matt Wagner <matt@mysql.com>
33- * Jeremy Cole <jcole@mysql.com>
34- * Tonu Samuel <tonu@mysql.com>
35- * Harrison Fisk <harrison@mysql.com>
36- *
37- **/
38-
39-#include "client_priv.h"
40-#include "my_default.h"
41-#include <m_ctype.h>
42-#include <stdarg.h>
43-#include <my_dir.h>
44-#ifndef __GNU_LIBRARY__
45-#define __GNU_LIBRARY__ // Skip warnings in getopt.h
46-#endif
47-#include "my_readline.h"
48-#include <signal.h>
49-#include <violite.h>
50-
51-#include <algorithm>
52-
53-using std::min;
54-using std::max;
55-
56-#if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H)
57-#include <locale.h>
58-#endif
59-
60-const char *VER= "14.14";
61-
62-/* Don't try to make a nice table if the data is too big */
63-#define MAX_COLUMN_LENGTH 1024
64-
65-/* Buffer to hold 'version' and 'version_comment' */
66-static char *server_version= NULL;
67-
68-/* Array of options to pass to libemysqld */
69-#define MAX_SERVER_ARGS 64
70-
71-/* Maximum memory limit that can be claimed by alloca(). */
72-#define MAX_ALLOCA_SIZE 512
73-
74-#include "sql_string.h"
75-
76-extern "C" {
77-#if defined(HAVE_CURSES_H) && defined(HAVE_TERM_H)
78-#include <curses.h>
79-#include <term.h>
80-#else
81-#if defined(HAVE_TERMIOS_H)
82-#include <termios.h>
83-#include <unistd.h>
84-#elif defined(HAVE_TERMBITS_H)
85-#include <termbits.h>
86-#elif defined(HAVE_ASM_TERMBITS_H) && (!defined __GLIBC__ || !(__GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ > 0))
87-#include <asm/termbits.h> // Standard linux
88-#endif
89-#undef VOID
90-#if defined(HAVE_TERMCAP_H)
91-#include <termcap.h>
92-#else
93-#ifdef HAVE_CURSES_H
94-#include <curses.h>
95-#endif
96-#undef SYSV // hack to avoid syntax error
97-#ifdef HAVE_TERM_H
98-#include <term.h>
99-#endif
100-#endif
101-#endif
102-
103-#if defined(__WIN__)
104-#include <conio.h>
105-#else
106-#include <readline.h>
107-#define HAVE_READLINE
108-#define USE_POPEN
109-#endif
110- //int vidattr(long unsigned int attrs); // Was missing in sun curses
111-}
112-
113-#if !defined(HAVE_VIDATTR)
114-#undef vidattr
115-#define vidattr(A) {} // Can't get this to work
116-#endif
117-
118-#ifdef FN_NO_CASE_SENSE
119-#define cmp_database(cs,A,B) my_strcasecmp((cs), (A), (B))
120-#else
121-#define cmp_database(cs,A,B) strcmp((A),(B))
122-#endif
123-
124-#include "completion_hash.h"
125-#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
126-
127-#define PROMPT_CHAR '\\'
128-#define DEFAULT_DELIMITER ";"
129-
130-#define MAX_BATCH_BUFFER_SIZE (1024L * 1024L * 1024L)
131-
132-typedef struct st_status
133-{
134- int exit_status;
135- ulong query_start_line;
136- char *file_name;
137- LINE_BUFFER *line_buff;
138- bool batch,add_to_history;
139-} STATUS;
140-
141-
142-static HashTable ht;
143-static char **defaults_argv;
144-
145-enum enum_info_type { INFO_INFO,INFO_ERROR,INFO_RESULT};
146-typedef enum enum_info_type INFO_TYPE;
147-
148-static MYSQL mysql; /* The connection */
149-static my_bool ignore_errors=0,wait_flag=0,quick=0,
150- connected=0,opt_raw_data=0,unbuffered=0,output_tables=0,
151- opt_rehash=1,skip_updates=0,safe_updates=0,one_database=0,
152- opt_compress=0, using_opt_local_infile=0,
153- vertical=0, line_numbers=1, column_names=1,opt_html=0,
154- opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
155- tty_password= 0, opt_nobeep=0, opt_reconnect=1,
156- opt_secure_auth= TRUE,
157- default_pager_set= 0, opt_sigint_ignore= 0,
158- auto_vertical_output= 0,
159- show_warnings= 0, executing_query= 0, interrupted_query= 0,
160- ignore_spaces= 0;
161-static my_bool debug_info_flag, debug_check_flag;
162-static my_bool column_types_flag;
163-static my_bool preserve_comments= 0;
164-static ulong opt_max_allowed_packet, opt_net_buffer_length;
165-static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
166-static uint opt_enable_cleartext_plugin= 0;
167-static my_bool using_opt_enable_cleartext_plugin= 0;
168-static uint my_end_arg;
169-static char * opt_mysql_unix_port=0;
170-static char *opt_bind_addr = NULL;
171-static int connect_flag=CLIENT_INTERACTIVE;
172-static my_bool opt_binary_mode= FALSE;
173-static my_bool opt_connect_expired_password= FALSE;
174-static char *current_host,*current_db,*current_user=0,*opt_password=0,
175- *current_prompt=0, *delimiter_str= 0,
176- *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME,
177- *opt_init_command= 0;
178-static char *histfile;
179-static char *histfile_tmp;
180-static char *opt_histignore= NULL;
181-DYNAMIC_STRING histignore_buffer;
182-static String glob_buffer,old_buffer;
183-static String processed_prompt;
184-static char *full_username=0,*part_username=0,*default_prompt=0;
185-static int wait_time = 5;
186-static STATUS status;
187-static ulong select_limit,max_join_size,opt_connect_timeout=0;
188-static char mysql_charsets_dir[FN_REFLEN+1];
189-static char *opt_plugin_dir= 0, *opt_default_auth= 0;
190-#if !defined(HAVE_YASSL)
191-static char *opt_server_public_key= 0;
192-#endif
193-static const char *xmlmeta[] = {
194- "&", "&amp;",
195- "<", "&lt;",
196- ">", "&gt;",
197- "\"", "&quot;",
198- /* Turn \0 into a space. Why not &#0;? That's not valid XML or HTML. */
199- "\0", " ",
200- 0, 0
201-};
202-static const char *day_names[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
203-static const char *month_names[]={"Jan","Feb","Mar","Apr","May","Jun","Jul",
204- "Aug","Sep","Oct","Nov","Dec"};
205-static char default_pager[FN_REFLEN];
206-static char pager[FN_REFLEN], outfile[FN_REFLEN];
207-static FILE *PAGER, *OUTFILE;
208-static MEM_ROOT hash_mem_root;
209-static uint prompt_counter;
210-static char delimiter[16]= DEFAULT_DELIMITER;
211-static uint delimiter_length= 1;
212-unsigned short terminal_width= 80;
213-
214-#ifdef HAVE_SMEM
215-static char *shared_memory_base_name=0;
216-#endif
217-static uint opt_protocol=0;
218-static const CHARSET_INFO *charset_info= &my_charset_latin1;
219-
220-#include "sslopt-vars.h"
221-
222-const char *default_dbug_option="d:t:o,/tmp/mysql.trace";
223-
224-#ifdef __WIN__
225-/*
226- A flag that indicates if --execute buffer has already been converted,
227- to avoid double conversion on reconnect.
228-*/
229-static my_bool execute_buffer_conversion_done= 0;
230-
231-/*
232- my_win_is_console(...) is quite slow.
233- We cache my_win_is_console() results for stdout and stderr.
234- Any other output files, except stdout and stderr,
235- cannot be Windows console.
236- Note, if mysql.exe is executed from a service, its _fileno(stdout) is -1,
237- so shift (1 << -1) can return implementation defined result.
238- This corner case is taken into account, as the shift result
239- will be multiplied to 0 and we'll get 0 as a result.
240- The same is true for stderr.
241-*/
242-static uint win_is_console_cache=
243- (MY_TEST(my_win_is_console(stdout)) * (1 << _fileno(stdout))) |
244- (MY_TEST(my_win_is_console(stderr)) * (1 << _fileno(stderr)));
245-
246-static inline my_bool
247-my_win_is_console_cached(FILE *file)
248-{
249- return win_is_console_cache & (1 << _fileno(file));
250-}
251-#endif /* __WIN__ */
252-
253-/* Various printing flags */
254-#define MY_PRINT_ESC_0 1 /* Replace 0x00 bytes to "\0" */
255-#define MY_PRINT_SPS_0 2 /* Replace 0x00 bytes to space */
256-#define MY_PRINT_XML 4 /* Encode XML entities */
257-#define MY_PRINT_MB 8 /* Recognize multi-byte characters */
258-#define MY_PRINT_CTRL 16 /* Replace TAB, NL, CR to "\t", "\n", "\r" */
259-
260-void tee_write(FILE *file, const char *s, size_t slen, int flags);
261-void tee_fprintf(FILE *file, const char *fmt, ...);
262-void tee_fputs(const char *s, FILE *file);
263-void tee_puts(const char *s, FILE *file);
264-void tee_putc(int c, FILE *file);
265-static void tee_print_sized_data(const char *, unsigned int, unsigned int, bool);
266-/* The names of functions that actually do the manipulation. */
267-static int get_options(int argc,char **argv);
268-extern "C" my_bool get_one_option(int optid, const struct my_option *opt,
269- char *argument);
270-static int com_quit(String *str,char*),
271- com_go(String *str,char*), com_ego(String *str,char*),
272- com_print(String *str,char*),
273- com_help(String *str,char*), com_clear(String *str,char*),
274- com_connect(String *str,char*), com_status(String *str,char*),
275- com_use(String *str,char*), com_source(String *str, char*),
276- com_rehash(String *str, char*), com_tee(String *str, char*),
277- com_notee(String *str, char*), com_charset(String *str,char*),
278- com_prompt(String *str, char*), com_delimiter(String *str, char*),
279- com_warnings(String *str, char*), com_nowarnings(String *str, char*);
280-
281-#ifdef USE_POPEN
282-static int com_nopager(String *str, char*), com_pager(String *str, char*),
283- com_edit(String *str,char*), com_shell(String *str, char *);
284-#endif
285-
286-static int read_and_execute(bool interactive);
287-static int sql_connect(char *host,char *database,char *user,char *password,
288- uint silent);
289-static const char *server_version_string(MYSQL *mysql);
290-static int put_info(const char *str,INFO_TYPE info,uint error=0,
291- const char *sql_state=0);
292-static int put_error(MYSQL *mysql);
293-static void safe_put_field(const char *pos,ulong length);
294-static void xmlencode_print(const char *src, uint length);
295-static void init_pager();
296-static void end_pager();
297-static void init_tee(const char *);
298-static void end_tee();
299-static const char* construct_prompt();
300-static char *get_arg(char *line, my_bool get_next_arg);
301-static void init_username();
302-static void add_int_to_prompt(int toadd);
303-static int get_result_width(MYSQL_RES *res);
304-static int get_field_disp_length(MYSQL_FIELD * field);
305-static int normalize_dbname(const char *line, char *buff, uint buff_size);
306-static int get_quote_count(const char *line);
307-
308-#if defined(HAVE_READLINE)
309-static void add_filtered_history(const char *string);
310-static my_bool check_histignore(const char *string);
311-static my_bool parse_histignore();
312-static my_bool init_hist_patterns();
313-static void free_hist_patterns();
314-DYNAMIC_ARRAY histignore_patterns;
315-#endif /* HAVE_READLINE */
316-
317-/* A structure which contains information on the commands this program
318- can understand. */
319-
320-typedef struct {
321- const char *name; /* User printable name of the function. */
322- char cmd_char; /* msql command character */
323- int (*func)(String *str,char *); /* Function to call to do the job. */
324- bool takes_params; /* Max parameters for command */
325- const char *doc; /* Documentation for this function. */
326-} COMMANDS;
327-
328-static COMMANDS commands[] = {
329- { "?", '?', com_help, 1, "Synonym for `help'." },
330- { "clear", 'c', com_clear, 0, "Clear the current input statement."},
331- { "connect",'r', com_connect,1,
332- "Reconnect to the server. Optional arguments are db and host." },
333- { "delimiter", 'd', com_delimiter, 1,
334- "Set statement delimiter." },
335-#ifdef USE_POPEN
336- { "edit", 'e', com_edit, 0, "Edit command with $EDITOR."},
337-#endif
338- { "ego", 'G', com_ego, 0,
339- "Send command to mysql server, display result vertically."},
340- { "exit", 'q', com_quit, 0, "Exit mysql. Same as quit."},
341- { "go", 'g', com_go, 0, "Send command to mysql server." },
342- { "help", 'h', com_help, 1, "Display this help." },
343-#ifdef USE_POPEN
344- { "nopager",'n', com_nopager,0, "Disable pager, print to stdout." },
345-#endif
346- { "notee", 't', com_notee, 0, "Don't write into outfile." },
347-#ifdef USE_POPEN
348- { "pager", 'P', com_pager, 1,
349- "Set PAGER [to_pager]. Print the query results via PAGER." },
350-#endif
351- { "print", 'p', com_print, 0, "Print current command." },
352- { "prompt", 'R', com_prompt, 1, "Change your mysql prompt."},
353- { "quit", 'q', com_quit, 0, "Quit mysql." },
354- { "rehash", '#', com_rehash, 0, "Rebuild completion hash." },
355- { "source", '.', com_source, 1,
356- "Execute an SQL script file. Takes a file name as an argument."},
357- { "status", 's', com_status, 0, "Get status information from the server."},
358-#ifdef USE_POPEN
359- { "system", '!', com_shell, 1, "Execute a system shell command."},
360-#endif
361- { "tee", 'T', com_tee, 1,
362- "Set outfile [to_outfile]. Append everything into given outfile." },
363- { "use", 'u', com_use, 1,
364- "Use another database. Takes database name as argument." },
365- { "charset", 'C', com_charset, 1,
366- "Switch to another charset. Might be needed for processing binlog with multi-byte charsets." },
367- { "warnings", 'W', com_warnings, 0,
368- "Show warnings after every statement." },
369- { "nowarning", 'w', com_nowarnings, 0,
370- "Don't show warnings after every statement." },
371- /* Get bash-like expansion for some commands */
372- { "create table", 0, 0, 0, ""},
373- { "create database", 0, 0, 0, ""},
374- { "show databases", 0, 0, 0, ""},
375- { "show fields from", 0, 0, 0, ""},
376- { "show keys from", 0, 0, 0, ""},
377- { "show tables", 0, 0, 0, ""},
378- { "load data from", 0, 0, 0, ""},
379- { "alter table", 0, 0, 0, ""},
380- { "set option", 0, 0, 0, ""},
381- { "lock tables", 0, 0, 0, ""},
382- { "unlock tables", 0, 0, 0, ""},
383- /* generated 2006-12-28. Refresh occasionally from lexer. */
384- { "ACTION", 0, 0, 0, ""},
385- { "ADD", 0, 0, 0, ""},
386- { "AFTER", 0, 0, 0, ""},
387- { "AGAINST", 0, 0, 0, ""},
388- { "AGGREGATE", 0, 0, 0, ""},
389- { "ALL", 0, 0, 0, ""},
390- { "ALGORITHM", 0, 0, 0, ""},
391- { "ALTER", 0, 0, 0, ""},
392- { "ANALYZE", 0, 0, 0, ""},
393- { "AND", 0, 0, 0, ""},
394- { "ANY", 0, 0, 0, ""},
395- { "AS", 0, 0, 0, ""},
396- { "ASC", 0, 0, 0, ""},
397- { "ASCII", 0, 0, 0, ""},
398- { "ASENSITIVE", 0, 0, 0, ""},
399- { "AUTO_INCREMENT", 0, 0, 0, ""},
400- { "AVG", 0, 0, 0, ""},
401- { "AVG_ROW_LENGTH", 0, 0, 0, ""},
402- { "BACKUP", 0, 0, 0, ""},
403- { "BDB", 0, 0, 0, ""},
404- { "BEFORE", 0, 0, 0, ""},
405- { "BEGIN", 0, 0, 0, ""},
406- { "BERKELEYDB", 0, 0, 0, ""},
407- { "BETWEEN", 0, 0, 0, ""},
408- { "BIGINT", 0, 0, 0, ""},
409- { "BINARY", 0, 0, 0, ""},
410- { "BINLOG", 0, 0, 0, ""},
411- { "BIT", 0, 0, 0, ""},
412- { "BLOB", 0, 0, 0, ""},
413- { "BOOL", 0, 0, 0, ""},
414- { "BOOLEAN", 0, 0, 0, ""},
415- { "BOTH", 0, 0, 0, ""},
416- { "BTREE", 0, 0, 0, ""},
417- { "BY", 0, 0, 0, ""},
418- { "BYTE", 0, 0, 0, ""},
419- { "CACHE", 0, 0, 0, ""},
420- { "CALL", 0, 0, 0, ""},
421- { "CASCADE", 0, 0, 0, ""},
422- { "CASCADED", 0, 0, 0, ""},
423- { "CASE", 0, 0, 0, ""},
424- { "CHAIN", 0, 0, 0, ""},
425- { "CHANGE", 0, 0, 0, ""},
426- { "CHANGED", 0, 0, 0, ""},
427- { "CHAR", 0, 0, 0, ""},
428- { "CHARACTER", 0, 0, 0, ""},
429- { "CHARSET", 0, 0, 0, ""},
430- { "CHECK", 0, 0, 0, ""},
431- { "CHECKSUM", 0, 0, 0, ""},
432- { "CIPHER", 0, 0, 0, ""},
433- { "CLIENT", 0, 0, 0, ""},
434- { "CLOSE", 0, 0, 0, ""},
435- { "CODE", 0, 0, 0, ""},
436- { "COLLATE", 0, 0, 0, ""},
437- { "COLLATION", 0, 0, 0, ""},
438- { "COLUMN", 0, 0, 0, ""},
439- { "COLUMNS", 0, 0, 0, ""},
440- { "COMMENT", 0, 0, 0, ""},
441- { "COMMIT", 0, 0, 0, ""},
442- { "COMMITTED", 0, 0, 0, ""},
443- { "COMPACT", 0, 0, 0, ""},
444- { "COMPRESSED", 0, 0, 0, ""},
445- { "CONCURRENT", 0, 0, 0, ""},
446- { "CONDITION", 0, 0, 0, ""},
447- { "CONNECTION", 0, 0, 0, ""},
448- { "CONSISTENT", 0, 0, 0, ""},
449- { "CONSTRAINT", 0, 0, 0, ""},
450- { "CONTAINS", 0, 0, 0, ""},
451- { "CONTINUE", 0, 0, 0, ""},
452- { "CONVERT", 0, 0, 0, ""},
453- { "CREATE", 0, 0, 0, ""},
454- { "CROSS", 0, 0, 0, ""},
455- { "CUBE", 0, 0, 0, ""},
456- { "CURRENT_DATE", 0, 0, 0, ""},
457- { "CURRENT_TIME", 0, 0, 0, ""},
458- { "CURRENT_TIMESTAMP", 0, 0, 0, ""},
459- { "CURRENT_USER", 0, 0, 0, ""},
460- { "CURSOR", 0, 0, 0, ""},
461- { "DATA", 0, 0, 0, ""},
462- { "DATABASE", 0, 0, 0, ""},
463- { "DATABASES", 0, 0, 0, ""},
464- { "DATE", 0, 0, 0, ""},
465- { "DATETIME", 0, 0, 0, ""},
466- { "DAY", 0, 0, 0, ""},
467- { "DAY_HOUR", 0, 0, 0, ""},
468- { "DAY_MICROSECOND", 0, 0, 0, ""},
469- { "DAY_MINUTE", 0, 0, 0, ""},
470- { "DAY_SECOND", 0, 0, 0, ""},
471- { "DEALLOCATE", 0, 0, 0, ""},
472- { "DEC", 0, 0, 0, ""},
473- { "DECIMAL", 0, 0, 0, ""},
474- { "DECLARE", 0, 0, 0, ""},
475- { "DEFAULT", 0, 0, 0, ""},
476- { "DEFINER", 0, 0, 0, ""},
477- { "DELAYED", 0, 0, 0, ""},
478- { "DELAY_KEY_WRITE", 0, 0, 0, ""},
479- { "DELETE", 0, 0, 0, ""},
480- { "DESC", 0, 0, 0, ""},
481- { "DESCRIBE", 0, 0, 0, ""},
482- { "DES_KEY_FILE", 0, 0, 0, ""},
483- { "DETERMINISTIC", 0, 0, 0, ""},
484- { "DIRECTORY", 0, 0, 0, ""},
485- { "DISABLE", 0, 0, 0, ""},
486- { "DISCARD", 0, 0, 0, ""},
487- { "DISTINCT", 0, 0, 0, ""},
488- { "DISTINCTROW", 0, 0, 0, ""},
489- { "DIV", 0, 0, 0, ""},
490- { "DO", 0, 0, 0, ""},
491- { "DOUBLE", 0, 0, 0, ""},
492- { "DROP", 0, 0, 0, ""},
493- { "DUAL", 0, 0, 0, ""},
494- { "DUMPFILE", 0, 0, 0, ""},
495- { "DUPLICATE", 0, 0, 0, ""},
496- { "DYNAMIC", 0, 0, 0, ""},
497- { "EACH", 0, 0, 0, ""},
498- { "ELSE", 0, 0, 0, ""},
499- { "ELSEIF", 0, 0, 0, ""},
500- { "ENABLE", 0, 0, 0, ""},
501- { "ENCLOSED", 0, 0, 0, ""},
502- { "END", 0, 0, 0, ""},
503- { "ENGINE", 0, 0, 0, ""},
504- { "ENGINES", 0, 0, 0, ""},
505- { "ENUM", 0, 0, 0, ""},
506- { "ERRORS", 0, 0, 0, ""},
507- { "ESCAPE", 0, 0, 0, ""},
508- { "ESCAPED", 0, 0, 0, ""},
509- { "EVENTS", 0, 0, 0, ""},
510- { "EXECUTE", 0, 0, 0, ""},
511- { "EXISTS", 0, 0, 0, ""},
512- { "EXIT", 0, 0, 0, ""},
513- { "EXPANSION", 0, 0, 0, ""},
514- { "EXPLAIN", 0, 0, 0, ""},
515- { "EXTENDED", 0, 0, 0, ""},
516- { "FALSE", 0, 0, 0, ""},
517- { "FAST", 0, 0, 0, ""},
518- { "FETCH", 0, 0, 0, ""},
519- { "FIELDS", 0, 0, 0, ""},
520- { "FILE", 0, 0, 0, ""},
521- { "FIRST", 0, 0, 0, ""},
522- { "FIXED", 0, 0, 0, ""},
523- { "FLOAT", 0, 0, 0, ""},
524- { "FLOAT4", 0, 0, 0, ""},
525- { "FLOAT8", 0, 0, 0, ""},
526- { "FLUSH", 0, 0, 0, ""},
527- { "FOR", 0, 0, 0, ""},
528- { "FORCE", 0, 0, 0, ""},
529- { "FOREIGN", 0, 0, 0, ""},
530- { "FOUND", 0, 0, 0, ""},
531- { "FROM", 0, 0, 0, ""},
532- { "FULL", 0, 0, 0, ""},
533- { "FULLTEXT", 0, 0, 0, ""},
534- { "FUNCTION", 0, 0, 0, ""},
535- { "GEOMETRY", 0, 0, 0, ""},
536- { "GEOMETRYCOLLECTION", 0, 0, 0, ""},
537- { "GET_FORMAT", 0, 0, 0, ""},
538- { "GLOBAL", 0, 0, 0, ""},
539- { "GRANT", 0, 0, 0, ""},
540- { "GRANTS", 0, 0, 0, ""},
541- { "GROUP", 0, 0, 0, ""},
542- { "HANDLER", 0, 0, 0, ""},
543- { "HASH", 0, 0, 0, ""},
544- { "HAVING", 0, 0, 0, ""},
545- { "HELP", 0, 0, 0, ""},
546- { "HIGH_PRIORITY", 0, 0, 0, ""},
547- { "HOSTS", 0, 0, 0, ""},
548- { "HOUR", 0, 0, 0, ""},
549- { "HOUR_MICROSECOND", 0, 0, 0, ""},
550- { "HOUR_MINUTE", 0, 0, 0, ""},
551- { "HOUR_SECOND", 0, 0, 0, ""},
552- { "IDENTIFIED", 0, 0, 0, ""},
553- { "IF", 0, 0, 0, ""},
554- { "IGNORE", 0, 0, 0, ""},
555- { "IMPORT", 0, 0, 0, ""},
556- { "IN", 0, 0, 0, ""},
557- { "INDEX", 0, 0, 0, ""},
558- { "INDEXES", 0, 0, 0, ""},
559- { "INFILE", 0, 0, 0, ""},
560- { "INNER", 0, 0, 0, ""},
561- { "INNOBASE", 0, 0, 0, ""},
562- { "INNODB", 0, 0, 0, ""},
563- { "INOUT", 0, 0, 0, ""},
564- { "INSENSITIVE", 0, 0, 0, ""},
565- { "INSERT", 0, 0, 0, ""},
566- { "INSERT_METHOD", 0, 0, 0, ""},
567- { "INT", 0, 0, 0, ""},
568- { "INT1", 0, 0, 0, ""},
569- { "INT2", 0, 0, 0, ""},
570- { "INT3", 0, 0, 0, ""},
571- { "INT4", 0, 0, 0, ""},
572- { "INT8", 0, 0, 0, ""},
573- { "INTEGER", 0, 0, 0, ""},
574- { "INTERVAL", 0, 0, 0, ""},
575- { "INTO", 0, 0, 0, ""},
576- { "IO_THREAD", 0, 0, 0, ""},
577- { "IS", 0, 0, 0, ""},
578- { "ISOLATION", 0, 0, 0, ""},
579- { "ISSUER", 0, 0, 0, ""},
580- { "ITERATE", 0, 0, 0, ""},
581- { "INVOKER", 0, 0, 0, ""},
582- { "JOIN", 0, 0, 0, ""},
583- { "KEY", 0, 0, 0, ""},
584- { "KEYS", 0, 0, 0, ""},
585- { "KILL", 0, 0, 0, ""},
586- { "LANGUAGE", 0, 0, 0, ""},
587- { "LAST", 0, 0, 0, ""},
588- { "LEADING", 0, 0, 0, ""},
589- { "LEAVE", 0, 0, 0, ""},
590- { "LEAVES", 0, 0, 0, ""},
591- { "LEFT", 0, 0, 0, ""},
592- { "LEVEL", 0, 0, 0, ""},
593- { "LIKE", 0, 0, 0, ""},
594- { "LIMIT", 0, 0, 0, ""},
595- { "LINES", 0, 0, 0, ""},
596- { "LINESTRING", 0, 0, 0, ""},
597- { "LOAD", 0, 0, 0, ""},
598- { "LOCAL", 0, 0, 0, ""},
599- { "LOCALTIME", 0, 0, 0, ""},
600- { "LOCALTIMESTAMP", 0, 0, 0, ""},
601- { "LOCK", 0, 0, 0, ""},
602- { "LOCKS", 0, 0, 0, ""},
603- { "LOGS", 0, 0, 0, ""},
604- { "LONG", 0, 0, 0, ""},
605- { "LONGBLOB", 0, 0, 0, ""},
606- { "LONGTEXT", 0, 0, 0, ""},
607- { "LOOP", 0, 0, 0, ""},
608- { "LOW_PRIORITY", 0, 0, 0, ""},
609- { "MASTER", 0, 0, 0, ""},
610- { "MASTER_CONNECT_RETRY", 0, 0, 0, ""},
611- { "MASTER_HOST", 0, 0, 0, ""},
612- { "MASTER_LOG_FILE", 0, 0, 0, ""},
613- { "MASTER_LOG_POS", 0, 0, 0, ""},
614- { "MASTER_PASSWORD", 0, 0, 0, ""},
615- { "MASTER_PORT", 0, 0, 0, ""},
616- { "MASTER_SERVER_ID", 0, 0, 0, ""},
617- { "MASTER_SSL", 0, 0, 0, ""},
618- { "MASTER_SSL_CA", 0, 0, 0, ""},
619- { "MASTER_SSL_CAPATH", 0, 0, 0, ""},
620- { "MASTER_SSL_CERT", 0, 0, 0, ""},
621- { "MASTER_SSL_CIPHER", 0, 0, 0, ""},
622- { "MASTER_SSL_KEY", 0, 0, 0, ""},
623- { "MASTER_USER", 0, 0, 0, ""},
624- { "MATCH", 0, 0, 0, ""},
625- { "MAX_CONNECTIONS_PER_HOUR", 0, 0, 0, ""},
626- { "MAX_QUERIES_PER_HOUR", 0, 0, 0, ""},
627- { "MAX_ROWS", 0, 0, 0, ""},
628- { "MAX_UPDATES_PER_HOUR", 0, 0, 0, ""},
629- { "MAX_USER_CONNECTIONS", 0, 0, 0, ""},
630- { "MEDIUM", 0, 0, 0, ""},
631- { "MEDIUMBLOB", 0, 0, 0, ""},
632- { "MEDIUMINT", 0, 0, 0, ""},
633- { "MEDIUMTEXT", 0, 0, 0, ""},
634- { "MERGE", 0, 0, 0, ""},
635- { "MICROSECOND", 0, 0, 0, ""},
636- { "MIDDLEINT", 0, 0, 0, ""},
637- { "MIGRATE", 0, 0, 0, ""},
638- { "MINUTE", 0, 0, 0, ""},
639- { "MINUTE_MICROSECOND", 0, 0, 0, ""},
640- { "MINUTE_SECOND", 0, 0, 0, ""},
641- { "MIN_ROWS", 0, 0, 0, ""},
642- { "MOD", 0, 0, 0, ""},
643- { "MODE", 0, 0, 0, ""},
644- { "MODIFIES", 0, 0, 0, ""},
645- { "MODIFY", 0, 0, 0, ""},
646- { "MONTH", 0, 0, 0, ""},
647- { "MULTILINESTRING", 0, 0, 0, ""},
648- { "MULTIPOINT", 0, 0, 0, ""},
649- { "MULTIPOLYGON", 0, 0, 0, ""},
650- { "MUTEX", 0, 0, 0, ""},
651- { "NAME", 0, 0, 0, ""},
652- { "NAMES", 0, 0, 0, ""},
653- { "NATIONAL", 0, 0, 0, ""},
654- { "NATURAL", 0, 0, 0, ""},
655- { "NDB", 0, 0, 0, ""},
656- { "NDBCLUSTER", 0, 0, 0, ""},
657- { "NCHAR", 0, 0, 0, ""},
658- { "NEW", 0, 0, 0, ""},
659- { "NEXT", 0, 0, 0, ""},
660- { "NO", 0, 0, 0, ""},
661- { "NONE", 0, 0, 0, ""},
662- { "NOT", 0, 0, 0, ""},
663- { "NO_WRITE_TO_BINLOG", 0, 0, 0, ""},
664- { "NULL", 0, 0, 0, ""},
665- { "NUMERIC", 0, 0, 0, ""},
666- { "NVARCHAR", 0, 0, 0, ""},
667- { "OFFSET", 0, 0, 0, ""},
668- { "OLD_PASSWORD", 0, 0, 0, ""},
669- { "ON", 0, 0, 0, ""},
670- { "ONE", 0, 0, 0, ""},
671- { "ONE_SHOT", 0, 0, 0, ""},
672- { "OPEN", 0, 0, 0, ""},
673- { "OPTIMIZE", 0, 0, 0, ""},
674- { "OPTION", 0, 0, 0, ""},
675- { "OPTIONALLY", 0, 0, 0, ""},
676- { "OR", 0, 0, 0, ""},
677- { "ORDER", 0, 0, 0, ""},
678- { "OUT", 0, 0, 0, ""},
679- { "OUTER", 0, 0, 0, ""},
680- { "OUTFILE", 0, 0, 0, ""},
681- { "PACK_KEYS", 0, 0, 0, ""},
682- { "PARTIAL", 0, 0, 0, ""},
683- { "PASSWORD", 0, 0, 0, ""},
684- { "PHASE", 0, 0, 0, ""},
685- { "POINT", 0, 0, 0, ""},
686- { "POLYGON", 0, 0, 0, ""},
687- { "PRECISION", 0, 0, 0, ""},
688- { "PREPARE", 0, 0, 0, ""},
689- { "PREV", 0, 0, 0, ""},
690- { "PRIMARY", 0, 0, 0, ""},
691- { "PRIVILEGES", 0, 0, 0, ""},
692- { "PROCEDURE", 0, 0, 0, ""},
693- { "PROCESS", 0, 0, 0, ""},
694- { "PROCESSLIST", 0, 0, 0, ""},
695- { "PURGE", 0, 0, 0, ""},
696- { "QUARTER", 0, 0, 0, ""},
697- { "QUERY", 0, 0, 0, ""},
698- { "QUICK", 0, 0, 0, ""},
699- { "READ", 0, 0, 0, ""},
700- { "READS", 0, 0, 0, ""},
701- { "REAL", 0, 0, 0, ""},
702- { "RECOVER", 0, 0, 0, ""},
703- { "REDUNDANT", 0, 0, 0, ""},
704- { "REFERENCES", 0, 0, 0, ""},
705- { "REGEXP", 0, 0, 0, ""},
706- { "RELAY_LOG_FILE", 0, 0, 0, ""},
707- { "RELAY_LOG_POS", 0, 0, 0, ""},
708- { "RELAY_THREAD", 0, 0, 0, ""},
709- { "RELEASE", 0, 0, 0, ""},
710- { "RELOAD", 0, 0, 0, ""},
711- { "RENAME", 0, 0, 0, ""},
712- { "REPAIR", 0, 0, 0, ""},
713- { "REPEATABLE", 0, 0, 0, ""},
714- { "REPLACE", 0, 0, 0, ""},
715- { "REPLICATION", 0, 0, 0, ""},
716- { "REPEAT", 0, 0, 0, ""},
717- { "REQUIRE", 0, 0, 0, ""},
718- { "RESET", 0, 0, 0, ""},
719- { "RESTORE", 0, 0, 0, ""},
720- { "RESTRICT", 0, 0, 0, ""},
721- { "RESUME", 0, 0, 0, ""},
722- { "RETURN", 0, 0, 0, ""},
723- { "RETURNS", 0, 0, 0, ""},
724- { "REVOKE", 0, 0, 0, ""},
725- { "RIGHT", 0, 0, 0, ""},
726- { "RLIKE", 0, 0, 0, ""},
727- { "ROLLBACK", 0, 0, 0, ""},
728- { "ROLLUP", 0, 0, 0, ""},
729- { "ROUTINE", 0, 0, 0, ""},
730- { "ROW", 0, 0, 0, ""},
731- { "ROWS", 0, 0, 0, ""},
732- { "ROW_FORMAT", 0, 0, 0, ""},
733- { "RTREE", 0, 0, 0, ""},
734- { "SAVEPOINT", 0, 0, 0, ""},
735- { "SCHEMA", 0, 0, 0, ""},
736- { "SCHEMAS", 0, 0, 0, ""},
737- { "SECOND", 0, 0, 0, ""},
738- { "SECOND_MICROSECOND", 0, 0, 0, ""},
739- { "SECURITY", 0, 0, 0, ""},
740- { "SELECT", 0, 0, 0, ""},
741- { "SENSITIVE", 0, 0, 0, ""},
742- { "SEPARATOR", 0, 0, 0, ""},
743- { "SERIAL", 0, 0, 0, ""},
744- { "SERIALIZABLE", 0, 0, 0, ""},
745- { "SESSION", 0, 0, 0, ""},
746- { "SET", 0, 0, 0, ""},
747- { "SHARE", 0, 0, 0, ""},
748- { "SHOW", 0, 0, 0, ""},
749- { "SHUTDOWN", 0, 0, 0, ""},
750- { "SIGNED", 0, 0, 0, ""},
751- { "SIMPLE", 0, 0, 0, ""},
752- { "SLAVE", 0, 0, 0, ""},
753- { "SNAPSHOT", 0, 0, 0, ""},
754- { "SMALLINT", 0, 0, 0, ""},
755- { "SOME", 0, 0, 0, ""},
756- { "SONAME", 0, 0, 0, ""},
757- { "SOUNDS", 0, 0, 0, ""},
758- { "SPATIAL", 0, 0, 0, ""},
759- { "SPECIFIC", 0, 0, 0, ""},
760- { "SQL", 0, 0, 0, ""},
761- { "SQLEXCEPTION", 0, 0, 0, ""},
762- { "SQLSTATE", 0, 0, 0, ""},
763- { "SQLWARNING", 0, 0, 0, ""},
764- { "SQL_BIG_RESULT", 0, 0, 0, ""},
765- { "SQL_BUFFER_RESULT", 0, 0, 0, ""},
766- { "SQL_CACHE", 0, 0, 0, ""},
767- { "SQL_CALC_FOUND_ROWS", 0, 0, 0, ""},
768- { "SQL_NO_CACHE", 0, 0, 0, ""},
769- { "SQL_SMALL_RESULT", 0, 0, 0, ""},
770- { "SQL_THREAD", 0, 0, 0, ""},
771- { "SQL_TSI_SECOND", 0, 0, 0, ""},
772- { "SQL_TSI_MINUTE", 0, 0, 0, ""},
773- { "SQL_TSI_HOUR", 0, 0, 0, ""},
774- { "SQL_TSI_DAY", 0, 0, 0, ""},
775- { "SQL_TSI_WEEK", 0, 0, 0, ""},
776- { "SQL_TSI_MONTH", 0, 0, 0, ""},
777- { "SQL_TSI_QUARTER", 0, 0, 0, ""},
778- { "SQL_TSI_YEAR", 0, 0, 0, ""},
779- { "SSL", 0, 0, 0, ""},
780- { "START", 0, 0, 0, ""},
781- { "STARTING", 0, 0, 0, ""},
782- { "STATUS", 0, 0, 0, ""},
783- { "STOP", 0, 0, 0, ""},
784- { "STORAGE", 0, 0, 0, ""},
785- { "STRAIGHT_JOIN", 0, 0, 0, ""},
786- { "STRING", 0, 0, 0, ""},
787- { "STRIPED", 0, 0, 0, ""},
788- { "SUBJECT", 0, 0, 0, ""},
789- { "SUPER", 0, 0, 0, ""},
790- { "SUSPEND", 0, 0, 0, ""},
791- { "TABLE", 0, 0, 0, ""},
792- { "TABLES", 0, 0, 0, ""},
793- { "TABLESPACE", 0, 0, 0, ""},
794- { "TEMPORARY", 0, 0, 0, ""},
795- { "TEMPTABLE", 0, 0, 0, ""},
796- { "TERMINATED", 0, 0, 0, ""},
797- { "TEXT", 0, 0, 0, ""},
798- { "THEN", 0, 0, 0, ""},
799- { "TIME", 0, 0, 0, ""},
800- { "TIMESTAMP", 0, 0, 0, ""},
801- { "TIMESTAMPADD", 0, 0, 0, ""},
802- { "TIMESTAMPDIFF", 0, 0, 0, ""},
803- { "TINYBLOB", 0, 0, 0, ""},
804- { "TINYINT", 0, 0, 0, ""},
805- { "TINYTEXT", 0, 0, 0, ""},
806- { "TO", 0, 0, 0, ""},
807- { "TRAILING", 0, 0, 0, ""},
808- { "TRANSACTION", 0, 0, 0, ""},
809- { "TRIGGER", 0, 0, 0, ""},
810- { "TRIGGERS", 0, 0, 0, ""},
811- { "TRUE", 0, 0, 0, ""},
812- { "TRUNCATE", 0, 0, 0, ""},
813- { "TYPE", 0, 0, 0, ""},
814- { "TYPES", 0, 0, 0, ""},
815- { "UNCOMMITTED", 0, 0, 0, ""},
816- { "UNDEFINED", 0, 0, 0, ""},
817- { "UNDO", 0, 0, 0, ""},
818- { "UNICODE", 0, 0, 0, ""},
819- { "UNION", 0, 0, 0, ""},
820- { "UNIQUE", 0, 0, 0, ""},
821- { "UNKNOWN", 0, 0, 0, ""},
822- { "UNLOCK", 0, 0, 0, ""},
823- { "UNSIGNED", 0, 0, 0, ""},
824- { "UNTIL", 0, 0, 0, ""},
825- { "UPDATE", 0, 0, 0, ""},
826- { "UPGRADE", 0, 0, 0, ""},
827- { "USAGE", 0, 0, 0, ""},
828- { "USE", 0, 0, 0, ""},
829- { "USER", 0, 0, 0, ""},
830- { "USER_RESOURCES", 0, 0, 0, ""},
831- { "USE_FRM", 0, 0, 0, ""},
832- { "USING", 0, 0, 0, ""},
833- { "UTC_DATE", 0, 0, 0, ""},
834- { "UTC_TIME", 0, 0, 0, ""},
835- { "UTC_TIMESTAMP", 0, 0, 0, ""},
836- { "VALUE", 0, 0, 0, ""},
837- { "VALUES", 0, 0, 0, ""},
838- { "VARBINARY", 0, 0, 0, ""},
839- { "VARCHAR", 0, 0, 0, ""},
840- { "VARCHARACTER", 0, 0, 0, ""},
841- { "VARIABLES", 0, 0, 0, ""},
842- { "VARYING", 0, 0, 0, ""},
843- { "WARNINGS", 0, 0, 0, ""},
844- { "WEEK", 0, 0, 0, ""},
845- { "WHEN", 0, 0, 0, ""},
846- { "WHERE", 0, 0, 0, ""},
847- { "WHILE", 0, 0, 0, ""},
848- { "VIEW", 0, 0, 0, ""},
849- { "WITH", 0, 0, 0, ""},
850- { "WORK", 0, 0, 0, ""},
851- { "WRITE", 0, 0, 0, ""},
852- { "X509", 0, 0, 0, ""},
853- { "XOR", 0, 0, 0, ""},
854- { "XA", 0, 0, 0, ""},
855- { "YEAR", 0, 0, 0, ""},
856- { "YEAR_MONTH", 0, 0, 0, ""},
857- { "ZEROFILL", 0, 0, 0, ""},
858- { "ABS", 0, 0, 0, ""},
859- { "ACOS", 0, 0, 0, ""},
860- { "ADDDATE", 0, 0, 0, ""},
861- { "ADDTIME", 0, 0, 0, ""},
862- { "AES_ENCRYPT", 0, 0, 0, ""},
863- { "AES_DECRYPT", 0, 0, 0, ""},
864- { "AREA", 0, 0, 0, ""},
865- { "ASIN", 0, 0, 0, ""},
866- { "ASBINARY", 0, 0, 0, ""},
867- { "ASTEXT", 0, 0, 0, ""},
868- { "ASWKB", 0, 0, 0, ""},
869- { "ASWKT", 0, 0, 0, ""},
870- { "ATAN", 0, 0, 0, ""},
871- { "ATAN2", 0, 0, 0, ""},
872- { "BENCHMARK", 0, 0, 0, ""},
873- { "BIN", 0, 0, 0, ""},
874- { "BIT_COUNT", 0, 0, 0, ""},
875- { "BIT_OR", 0, 0, 0, ""},
876- { "BIT_AND", 0, 0, 0, ""},
877- { "BIT_XOR", 0, 0, 0, ""},
878- { "CAST", 0, 0, 0, ""},
879- { "CEIL", 0, 0, 0, ""},
880- { "CEILING", 0, 0, 0, ""},
881- { "BIT_LENGTH", 0, 0, 0, ""},
882- { "CENTROID", 0, 0, 0, ""},
883- { "CHAR_LENGTH", 0, 0, 0, ""},
884- { "CHARACTER_LENGTH", 0, 0, 0, ""},
885- { "COALESCE", 0, 0, 0, ""},
886- { "COERCIBILITY", 0, 0, 0, ""},
887- { "COMPRESS", 0, 0, 0, ""},
888- { "CONCAT", 0, 0, 0, ""},
889- { "CONCAT_WS", 0, 0, 0, ""},
890- { "CONNECTION_ID", 0, 0, 0, ""},
891- { "CONV", 0, 0, 0, ""},
892- { "CONVERT_TZ", 0, 0, 0, ""},
893- { "COUNT", 0, 0, 0, ""},
894- { "COS", 0, 0, 0, ""},
895- { "COT", 0, 0, 0, ""},
896- { "CRC32", 0, 0, 0, ""},
897- { "CROSSES", 0, 0, 0, ""},
898- { "CURDATE", 0, 0, 0, ""},
899- { "CURTIME", 0, 0, 0, ""},
900- { "DATE_ADD", 0, 0, 0, ""},
901- { "DATEDIFF", 0, 0, 0, ""},
902- { "DATE_FORMAT", 0, 0, 0, ""},
903- { "DATE_SUB", 0, 0, 0, ""},
904- { "DAYNAME", 0, 0, 0, ""},
905- { "DAYOFMONTH", 0, 0, 0, ""},
906- { "DAYOFWEEK", 0, 0, 0, ""},
907- { "DAYOFYEAR", 0, 0, 0, ""},
908- { "DECODE", 0, 0, 0, ""},
909- { "DEGREES", 0, 0, 0, ""},
910- { "DES_ENCRYPT", 0, 0, 0, ""},
911- { "DES_DECRYPT", 0, 0, 0, ""},
912- { "DIMENSION", 0, 0, 0, ""},
913- { "DISJOINT", 0, 0, 0, ""},
914- { "ELT", 0, 0, 0, ""},
915- { "ENCODE", 0, 0, 0, ""},
916- { "ENCRYPT", 0, 0, 0, ""},
917- { "ENDPOINT", 0, 0, 0, ""},
918- { "ENVELOPE", 0, 0, 0, ""},
919- { "EQUALS", 0, 0, 0, ""},
920- { "EXTERIORRING", 0, 0, 0, ""},
921- { "EXTRACT", 0, 0, 0, ""},
922- { "EXP", 0, 0, 0, ""},
923- { "EXPORT_SET", 0, 0, 0, ""},
924- { "FIELD", 0, 0, 0, ""},
925- { "FIND_IN_SET", 0, 0, 0, ""},
926- { "FLOOR", 0, 0, 0, ""},
927- { "FORMAT", 0, 0, 0, ""},
928- { "FOUND_ROWS", 0, 0, 0, ""},
929- { "FROM_DAYS", 0, 0, 0, ""},
930- { "FROM_UNIXTIME", 0, 0, 0, ""},
931- { "GET_LOCK", 0, 0, 0, ""},
932- { "GEOMETRYN", 0, 0, 0, ""},
933- { "GEOMETRYTYPE", 0, 0, 0, ""},
934- { "GEOMCOLLFROMTEXT", 0, 0, 0, ""},
935- { "GEOMCOLLFROMWKB", 0, 0, 0, ""},
936- { "GEOMETRYCOLLECTIONFROMTEXT", 0, 0, 0, ""},
937- { "GEOMETRYCOLLECTIONFROMWKB", 0, 0, 0, ""},
938- { "GEOMETRYFROMTEXT", 0, 0, 0, ""},
939- { "GEOMETRYFROMWKB", 0, 0, 0, ""},
940- { "GEOMFROMTEXT", 0, 0, 0, ""},
941- { "GEOMFROMWKB", 0, 0, 0, ""},
942- { "GLENGTH", 0, 0, 0, ""},
943- { "GREATEST", 0, 0, 0, ""},
944- { "GROUP_CONCAT", 0, 0, 0, ""},
945- { "GROUP_UNIQUE_USERS", 0, 0, 0, ""},
946- { "HEX", 0, 0, 0, ""},
947- { "IFNULL", 0, 0, 0, ""},
948- { "INET_ATON", 0, 0, 0, ""},
949- { "INET_NTOA", 0, 0, 0, ""},
950- { "INSTR", 0, 0, 0, ""},
951- { "INTERIORRINGN", 0, 0, 0, ""},
952- { "INTERSECTS", 0, 0, 0, ""},
953- { "ISCLOSED", 0, 0, 0, ""},
954- { "ISEMPTY", 0, 0, 0, ""},
955- { "ISNULL", 0, 0, 0, ""},
956- { "IS_FREE_LOCK", 0, 0, 0, ""},
957- { "IS_USED_LOCK", 0, 0, 0, ""},
958- { "LAST_INSERT_ID", 0, 0, 0, ""},
959- { "ISSIMPLE", 0, 0, 0, ""},
960- { "LAST_DAY", 0, 0, 0, ""},
961- { "LCASE", 0, 0, 0, ""},
962- { "LEAST", 0, 0, 0, ""},
963- { "LENGTH", 0, 0, 0, ""},
964- { "LN", 0, 0, 0, ""},
965- { "LINEFROMTEXT", 0, 0, 0, ""},
966- { "LINEFROMWKB", 0, 0, 0, ""},
967- { "LINESTRINGFROMTEXT", 0, 0, 0, ""},
968- { "LINESTRINGFROMWKB", 0, 0, 0, ""},
969- { "LOAD_FILE", 0, 0, 0, ""},
970- { "LOCATE", 0, 0, 0, ""},
971- { "LOG", 0, 0, 0, ""},
972- { "LOG2", 0, 0, 0, ""},
973- { "LOG10", 0, 0, 0, ""},
974- { "LOWER", 0, 0, 0, ""},
975- { "LPAD", 0, 0, 0, ""},
976- { "LTRIM", 0, 0, 0, ""},
977- { "MAKE_SET", 0, 0, 0, ""},
978- { "MAKEDATE", 0, 0, 0, ""},
979- { "MAKETIME", 0, 0, 0, ""},
980- { "MASTER_POS_WAIT", 0, 0, 0, ""},
981- { "MAX", 0, 0, 0, ""},
982- { "MBRCONTAINS", 0, 0, 0, ""},
983- { "MBRDISJOINT", 0, 0, 0, ""},
984- { "MBREQUAL", 0, 0, 0, ""},
985- { "MBRINTERSECTS", 0, 0, 0, ""},
986- { "MBROVERLAPS", 0, 0, 0, ""},
987- { "MBRTOUCHES", 0, 0, 0, ""},
988- { "MBRWITHIN", 0, 0, 0, ""},
989- { "MD5", 0, 0, 0, ""},
990- { "MID", 0, 0, 0, ""},
991- { "MIN", 0, 0, 0, ""},
992- { "MLINEFROMTEXT", 0, 0, 0, ""},
993- { "MLINEFROMWKB", 0, 0, 0, ""},
994- { "MPOINTFROMTEXT", 0, 0, 0, ""},
995- { "MPOINTFROMWKB", 0, 0, 0, ""},
996- { "MPOLYFROMTEXT", 0, 0, 0, ""},
997- { "MPOLYFROMWKB", 0, 0, 0, ""},
998- { "MONTHNAME", 0, 0, 0, ""},
999- { "MULTILINESTRINGFROMTEXT", 0, 0, 0, ""},
1000- { "MULTILINESTRINGFROMWKB", 0, 0, 0, ""},
1001- { "MULTIPOINTFROMTEXT", 0, 0, 0, ""},
1002- { "MULTIPOINTFROMWKB", 0, 0, 0, ""},
1003- { "MULTIPOLYGONFROMTEXT", 0, 0, 0, ""},
1004- { "MULTIPOLYGONFROMWKB", 0, 0, 0, ""},
1005- { "NAME_CONST", 0, 0, 0, ""},
1006- { "NOW", 0, 0, 0, ""},
1007- { "NULLIF", 0, 0, 0, ""},
1008- { "NUMGEOMETRIES", 0, 0, 0, ""},
1009- { "NUMINTERIORRINGS", 0, 0, 0, ""},
1010- { "NUMPOINTS", 0, 0, 0, ""},
1011- { "OCTET_LENGTH", 0, 0, 0, ""},
1012- { "OCT", 0, 0, 0, ""},
1013- { "ORD", 0, 0, 0, ""},
1014- { "OVERLAPS", 0, 0, 0, ""},
1015- { "PERIOD_ADD", 0, 0, 0, ""},
1016- { "PERIOD_DIFF", 0, 0, 0, ""},
1017- { "PI", 0, 0, 0, ""},
1018- { "POINTFROMTEXT", 0, 0, 0, ""},
1019- { "POINTFROMWKB", 0, 0, 0, ""},
1020- { "POINTN", 0, 0, 0, ""},
1021- { "POLYFROMTEXT", 0, 0, 0, ""},
1022- { "POLYFROMWKB", 0, 0, 0, ""},
1023- { "POLYGONFROMTEXT", 0, 0, 0, ""},
1024- { "POLYGONFROMWKB", 0, 0, 0, ""},
1025- { "POSITION", 0, 0, 0, ""},
1026- { "POW", 0, 0, 0, ""},
1027- { "POWER", 0, 0, 0, ""},
1028- { "QUOTE", 0, 0, 0, ""},
1029- { "RADIANS", 0, 0, 0, ""},
1030- { "RAND", 0, 0, 0, ""},
1031- { "RELEASE_LOCK", 0, 0, 0, ""},
1032- { "REVERSE", 0, 0, 0, ""},
1033- { "ROUND", 0, 0, 0, ""},
1034- { "ROW_COUNT", 0, 0, 0, ""},
1035- { "RPAD", 0, 0, 0, ""},
1036- { "RTRIM", 0, 0, 0, ""},
1037- { "SEC_TO_TIME", 0, 0, 0, ""},
1038- { "SESSION_USER", 0, 0, 0, ""},
1039- { "SUBDATE", 0, 0, 0, ""},
1040- { "SIGN", 0, 0, 0, ""},
1041- { "SIN", 0, 0, 0, ""},
1042- { "SHA", 0, 0, 0, ""},
1043- { "SHA1", 0, 0, 0, ""},
1044- { "SLEEP", 0, 0, 0, ""},
1045- { "SOUNDEX", 0, 0, 0, ""},
1046- { "SPACE", 0, 0, 0, ""},
1047- { "SQRT", 0, 0, 0, ""},
1048- { "SRID", 0, 0, 0, ""},
1049- { "STARTPOINT", 0, 0, 0, ""},
1050- { "STD", 0, 0, 0, ""},
1051- { "STDDEV", 0, 0, 0, ""},
1052- { "STDDEV_POP", 0, 0, 0, ""},
1053- { "STDDEV_SAMP", 0, 0, 0, ""},
1054- { "STR_TO_DATE", 0, 0, 0, ""},
1055- { "STRCMP", 0, 0, 0, ""},
1056- { "SUBSTR", 0, 0, 0, ""},
1057- { "SUBSTRING", 0, 0, 0, ""},
1058- { "SUBSTRING_INDEX", 0, 0, 0, ""},
1059- { "SUBTIME", 0, 0, 0, ""},
1060- { "SUM", 0, 0, 0, ""},
1061- { "SYSDATE", 0, 0, 0, ""},
1062- { "SYSTEM_USER", 0, 0, 0, ""},
1063- { "TAN", 0, 0, 0, ""},
1064- { "TIME_FORMAT", 0, 0, 0, ""},
1065- { "TIME_TO_SEC", 0, 0, 0, ""},
1066- { "TIMEDIFF", 0, 0, 0, ""},
1067- { "TO_DAYS", 0, 0, 0, ""},
1068- { "TOUCHES", 0, 0, 0, ""},
1069- { "TRIM", 0, 0, 0, ""},
1070- { "UCASE", 0, 0, 0, ""},
1071- { "UNCOMPRESS", 0, 0, 0, ""},
1072- { "UNCOMPRESSED_LENGTH", 0, 0, 0, ""},
1073- { "UNHEX", 0, 0, 0, ""},
1074- { "UNIQUE_USERS", 0, 0, 0, ""},
1075- { "UNIX_TIMESTAMP", 0, 0, 0, ""},
1076- { "UPPER", 0, 0, 0, ""},
1077- { "UUID", 0, 0, 0, ""},
1078- { "VARIANCE", 0, 0, 0, ""},
1079- { "VAR_POP", 0, 0, 0, ""},
1080- { "VAR_SAMP", 0, 0, 0, ""},
1081- { "VERSION", 0, 0, 0, ""},
1082- { "WEEKDAY", 0, 0, 0, ""},
1083- { "WEEKOFYEAR", 0, 0, 0, ""},
1084- { "WITHIN", 0, 0, 0, ""},
1085- { "X", 0, 0, 0, ""},
1086- { "Y", 0, 0, 0, ""},
1087- { "YEARWEEK", 0, 0, 0, ""},
1088- /* end sentinel */
1089- { (char *)NULL, 0, 0, 0, ""}
1090-};
1091-
1092-static const char *load_default_groups[]= { "mysql","client",0 };
1093-
1094-static int embedded_server_arg_count= 0;
1095-static char *embedded_server_args[MAX_SERVER_ARGS];
1096-static const char *embedded_server_groups[]=
1097-{ "server", "embedded", "mysql_SERVER", 0 };
1098-
1099-#ifdef HAVE_READLINE
1100-/*
1101- HIST_ENTRY is defined for libedit, but not for the real readline
1102- Need to redefine it for real readline to find it
1103-*/
1104-#if !defined(HAVE_HIST_ENTRY)
1105-typedef struct _hist_entry {
1106- const char *line;
1107- const char *data;
1108-} HIST_ENTRY;
1109-#endif
1110-
1111-extern "C" int add_history(const char *command); /* From readline directory */
1112-extern "C" int read_history(const char *command);
1113-extern "C" int write_history(const char *command);
1114-extern "C" HIST_ENTRY *history_get(int num);
1115-extern "C" int history_length;
1116-static int not_in_history(const char *line);
1117-static void initialize_readline (char *name);
1118-static void fix_history(String *final_command);
1119-#endif
1120-
1121-static COMMANDS *find_command(char *name);
1122-static COMMANDS *find_command(char cmd_name);
1123-static bool add_line(String &buffer, char *line, ulong line_length,
1124- char *in_string, bool *ml_comment, bool truncated);
1125-static void remove_cntrl(String &buffer);
1126-static void print_table_data(MYSQL_RES *result);
1127-static void print_table_data_html(MYSQL_RES *result);
1128-static void print_table_data_xml(MYSQL_RES *result);
1129-static void print_tab_data(MYSQL_RES *result);
1130-static void print_table_data_vertically(MYSQL_RES *result);
1131-static void print_warnings(void);
1132-static ulong start_timer(void);
1133-static void end_timer(ulong start_time,char *buff);
1134-static void mysql_end_timer(ulong start_time,char *buff);
1135-static void nice_time(double sec,char *buff,bool part_second);
1136-extern "C" sig_handler mysql_end(int sig);
1137-extern "C" sig_handler handle_kill_signal(int sig);
1138-#if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL)
1139-static sig_handler window_resize(int sig);
1140-#endif
1141-
1142-const char DELIMITER_NAME[]= "delimiter";
1143-const uint DELIMITER_NAME_LEN= sizeof(DELIMITER_NAME) - 1;
1144-inline bool is_delimiter_command(char *name, ulong len)
1145-{
1146- /*
1147- Delimiter command has a parameter, so the length of the whole command
1148- is larger than DELIMITER_NAME_LEN. We don't care the parameter, so
1149- only name(first DELIMITER_NAME_LEN bytes) is checked.
1150- */
1151- return (len >= DELIMITER_NAME_LEN &&
1152- !my_strnncoll(charset_info, (uchar*) name, DELIMITER_NAME_LEN,
1153- (uchar *) DELIMITER_NAME, DELIMITER_NAME_LEN));
1154-}
1155-
1156-/**
1157- Get the index of a command in the commands array.
1158-
1159- @param cmd_char Short form command.
1160-
1161- @return int
1162- The index of the command is returned if it is found, else -1 is returned.
1163-*/
1164-inline int get_command_index(char cmd_char)
1165-{
1166- /*
1167- All client-specific commands are in the first part of commands array
1168- and have a function to implement it.
1169- */
1170- for (uint i= 0; *commands[i].func; i++)
1171- if (commands[i].cmd_char == cmd_char)
1172- return i;
1173- return -1;
1174-}
1175-
1176-static int delimiter_index= -1;
1177-static int charset_index= -1;
1178-static bool real_binary_mode= FALSE;
1179-
1180-#ifdef _WIN32
1181-BOOL windows_ctrl_handler(DWORD fdwCtrlType)
1182-{
1183- switch (fdwCtrlType)
1184- {
1185- case CTRL_C_EVENT:
1186- case CTRL_BREAK_EVENT:
1187- if (!opt_sigint_ignore)
1188- handle_kill_signal(SIGINT);
1189- /* Indicate that signal has beed handled. */
1190- return TRUE;
1191- case CTRL_CLOSE_EVENT:
1192- case CTRL_LOGOFF_EVENT:
1193- case CTRL_SHUTDOWN_EVENT:
1194- handle_kill_signal(SIGINT + 1);
1195- }
1196- /* Pass signal to the next control handler function. */
1197- return FALSE;
1198-}
1199-#endif
1200-
1201-
1202-int main(int argc,char *argv[])
1203-{
1204- char buff[80];
1205-
1206- MY_INIT(argv[0]);
1207- DBUG_ENTER("main");
1208- DBUG_PROCESS(argv[0]);
1209-
1210- charset_index= get_command_index('C');
1211- delimiter_index= get_command_index('d');
1212- delimiter_str= delimiter;
1213- default_prompt = my_strdup(getenv("MYSQL_PS1") ?
1214- getenv("MYSQL_PS1") :
1215- "mysql> ",MYF(MY_WME));
1216- current_prompt = my_strdup(default_prompt,MYF(MY_WME));
1217- prompt_counter=0;
1218-
1219- outfile[0]=0; // no (default) outfile
1220- strmov(pager, "stdout"); // the default, if --pager wasn't given
1221- {
1222- char *tmp=getenv("PAGER");
1223- if (tmp && strlen(tmp))
1224- {
1225- default_pager_set= 1;
1226- strmov(default_pager, tmp);
1227- }
1228- }
1229- if (!isatty(0) || !isatty(1))
1230- {
1231- status.batch=1; opt_silent=1;
1232- ignore_errors=0;
1233- }
1234- else
1235- status.add_to_history=1;
1236- status.exit_status=1;
1237-
1238- {
1239- /*
1240- The file descriptor-layer may be out-of-sync with the file-number layer,
1241- so we make sure that "stdout" is really open. If its file is closed then
1242- explicitly close the FD layer.
1243- */
1244- int stdout_fileno_copy;
1245- stdout_fileno_copy= dup(fileno(stdout)); /* Okay if fileno fails. */
1246- if (stdout_fileno_copy == -1)
1247- fclose(stdout);
1248- else
1249- close(stdout_fileno_copy); /* Clean up dup(). */
1250- }
1251-
1252-#ifdef __WIN__
1253- /* Convert command line parameters from UTF16LE to UTF8MB4. */
1254- my_win_translate_command_line_args(&my_charset_utf8mb4_bin, &argc, &argv);
1255-#endif
1256-
1257- my_getopt_use_args_separator= TRUE;
1258- if (load_defaults("my",load_default_groups,&argc,&argv))
1259- {
1260- my_end(0);
1261- exit(1);
1262- }
1263- my_getopt_use_args_separator= FALSE;
1264-
1265- defaults_argv=argv;
1266- if (get_options(argc, (char **) argv))
1267- {
1268- free_defaults(defaults_argv);
1269- my_end(0);
1270- exit(1);
1271- }
1272- if (status.batch && !status.line_buff &&
1273- !(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin)))
1274- {
1275- put_info("Can't initialize batch_readline - may be the input source is "
1276- "a directory or a block device.", INFO_ERROR, 0);
1277- free_defaults(defaults_argv);
1278- my_end(0);
1279- exit(1);
1280- }
1281- if (mysql_server_init(embedded_server_arg_count, embedded_server_args,
1282- (char**) embedded_server_groups))
1283- {
1284- put_error(NULL);
1285- free_defaults(defaults_argv);
1286- my_end(0);
1287- exit(1);
1288- }
1289- glob_buffer.realloc(512);
1290- completion_hash_init(&ht, 128);
1291- init_alloc_root(&hash_mem_root, 16384, 0);
1292- memset(&mysql, 0, sizeof(mysql));
1293- if (sql_connect(current_host,current_db,current_user,opt_password,
1294- opt_silent))
1295- {
1296- quick= 1; // Avoid history
1297- status.exit_status= 1;
1298- mysql_end(-1);
1299- }
1300- if (!status.batch)
1301- ignore_errors=1; // Don't abort monitor
1302-
1303-#ifndef _WIN32
1304- if (opt_sigint_ignore)
1305- signal(SIGINT, SIG_IGN);
1306- else
1307- signal(SIGINT, handle_kill_signal); // Catch SIGINT to clean up
1308- signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up
1309- signal(SIGHUP, handle_kill_signal); // Catch SIGHUP to clean up
1310-#else
1311- SetConsoleCtrlHandler((PHANDLER_ROUTINE) windows_ctrl_handler, TRUE);
1312-#endif
1313-
1314-
1315-#if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL)
1316- /* Readline will call this if it installs a handler */
1317- signal(SIGWINCH, window_resize);
1318- /* call the SIGWINCH handler to get the default term width */
1319- window_resize(0);
1320-#endif
1321-
1322- put_info("Welcome to the MySQL monitor. Commands end with ; or \\g.",
1323- INFO_INFO);
1324- sprintf((char*) glob_buffer.ptr(),
1325- "Your MySQL connection id is %lu\nServer version: %s\n",
1326- mysql_thread_id(&mysql), server_version_string(&mysql));
1327- put_info((char*) glob_buffer.ptr(),INFO_INFO);
1328-
1329- put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"), INFO_INFO);
1330-
1331-#ifdef HAVE_READLINE
1332- initialize_readline((char*) my_progname);
1333- if (!status.batch && !quick && !opt_html && !opt_xml)
1334- {
1335- init_dynamic_string(&histignore_buffer, "*IDENTIFIED*:*PASSWORD*",
1336- 1024, 1024);
1337-
1338- /*
1339- More history-ignore patterns can be supplied using either --histignore
1340- option or MYSQL_HISTIGNORE environment variable. If supplied, it will
1341- get appended to the default pattern (*IDENTIFIED*:*PASSWORD*). In case
1342- both are specified, pattern(s) supplied using --histignore option will
1343- be used.
1344- */
1345- if (opt_histignore)
1346- {
1347- dynstr_append(&histignore_buffer, ":");
1348- dynstr_append(&histignore_buffer, opt_histignore);
1349- }
1350- else if (getenv("MYSQL_HISTIGNORE"))
1351- {
1352- dynstr_append(&histignore_buffer, ":");
1353- dynstr_append(&histignore_buffer, getenv("MYSQL_HISTIGNORE"));
1354- }
1355-
1356- parse_histignore();
1357-
1358- /* read-history from file, default ~/.mysql_history*/
1359- if (getenv("MYSQL_HISTFILE"))
1360- histfile=my_strdup(getenv("MYSQL_HISTFILE"),MYF(MY_WME));
1361- else if (getenv("HOME"))
1362- {
1363- histfile=(char*) my_malloc((uint) strlen(getenv("HOME"))
1364- + (uint) strlen("/.mysql_history")+2,
1365- MYF(MY_WME));
1366- if (histfile)
1367- sprintf(histfile,"%s/.mysql_history",getenv("HOME"));
1368- char link_name[FN_REFLEN];
1369- if (my_readlink(link_name, histfile, 0) == 0 &&
1370- strncmp(link_name, "/dev/null", 10) == 0)
1371- {
1372- /* The .mysql_history file is a symlink to /dev/null, don't use it */
1373- my_free(histfile);
1374- histfile= 0;
1375- }
1376- }
1377-
1378- /* We used to suggest setting MYSQL_HISTFILE=/dev/null. */
1379- if (histfile && strncmp(histfile, "/dev/null", 10) == 0)
1380- histfile= NULL;
1381-
1382- if (histfile && histfile[0])
1383- {
1384- if (verbose)
1385- tee_fprintf(stdout, "Reading history-file %s\n",histfile);
1386- read_history(histfile);
1387- if (!(histfile_tmp= (char*) my_malloc((uint) strlen(histfile) + 5,
1388- MYF(MY_WME))))
1389- {
1390- fprintf(stderr, "Couldn't allocate memory for temp histfile!\n");
1391- exit(1);
1392- }
1393- sprintf(histfile_tmp, "%s.TMP", histfile);
1394- }
1395- }
1396-
1397-#endif
1398-
1399- sprintf(buff, "%s",
1400- "Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n");
1401- put_info(buff,INFO_INFO);
1402- status.exit_status= read_and_execute(!status.batch);
1403- if (opt_outfile)
1404- end_tee();
1405- mysql_end(0);
1406-#ifndef _lint
1407- DBUG_RETURN(0); // Keep compiler happy
1408-#endif
1409-}
1410-
1411-sig_handler mysql_end(int sig)
1412-{
1413- mysql_close(&mysql);
1414-#ifdef HAVE_READLINE
1415- if (!status.batch && !quick && !opt_html && !opt_xml &&
1416- histfile && histfile[0])
1417- {
1418- /* write-history */
1419- if (verbose)
1420- tee_fprintf(stdout, "Writing history-file %s\n",histfile);
1421- if (!write_history(histfile_tmp))
1422- my_rename(histfile_tmp, histfile, MYF(MY_WME));
1423- }
1424- batch_readline_end(status.line_buff);
1425- completion_hash_free(&ht);
1426- free_root(&hash_mem_root,MYF(0));
1427-
1428- my_free(opt_histignore);
1429- my_free(histfile);
1430- my_free(histfile_tmp);
1431- dynstr_free(&histignore_buffer);
1432- free_hist_patterns();
1433-#endif
1434- if (sig >= 0)
1435- put_info(sig ? "Aborted" : "Bye", INFO_RESULT);
1436- glob_buffer.free();
1437- old_buffer.free();
1438- processed_prompt.free();
1439- my_free(server_version);
1440- my_free(opt_password);
1441- my_free(opt_mysql_unix_port);
1442- my_free(current_db);
1443- my_free(current_host);
1444- my_free(current_user);
1445- my_free(full_username);
1446- my_free(part_username);
1447- my_free(default_prompt);
1448-#ifdef HAVE_SMEM
1449- my_free(shared_memory_base_name);
1450-#endif
1451- my_free(current_prompt);
1452- while (embedded_server_arg_count > 1)
1453- my_free(embedded_server_args[--embedded_server_arg_count]);
1454- mysql_server_end();
1455- free_defaults(defaults_argv);
1456- my_end(my_end_arg);
1457- exit(status.exit_status);
1458-}
1459-
1460-
1461-/*
1462- This function handles sigint calls
1463- If query is in process, kill query
1464- no query in process, terminate like previous behavior
1465- */
1466-sig_handler handle_kill_signal(int sig)
1467-{
1468- char kill_buffer[40];
1469- MYSQL *kill_mysql= NULL;
1470- const char *reason = sig == SIGINT ? "Ctrl-C" : "Terminal close";
1471-
1472- /* terminate if no query being executed, or we already tried interrupting */
1473- /* terminate if no query being executed, or we already tried interrupting */
1474- if (!executing_query || (interrupted_query == 2))
1475- {
1476- tee_fprintf(stdout, "%s -- exit!\n", reason);
1477- goto err;
1478- }
1479-
1480- kill_mysql= mysql_init(kill_mysql);
1481- mysql_options(kill_mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
1482- mysql_options4(kill_mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
1483- "program_name", "mysql");
1484- if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
1485- "", opt_mysql_port, opt_mysql_unix_port,0))
1486- {
1487- tee_fprintf(stdout, "%s -- sorry, cannot connect to server to kill query, giving up ...\n", reason);
1488- goto err;
1489- }
1490-
1491- interrupted_query++;
1492-
1493- /* mysqld < 5 does not understand KILL QUERY, skip to KILL CONNECTION */
1494- if ((interrupted_query == 1) && (mysql_get_server_version(&mysql) < 50000))
1495- interrupted_query= 2;
1496-
1497- /* kill_buffer is always big enough because max length of %lu is 15 */
1498- sprintf(kill_buffer, "KILL %s%lu",
1499- (interrupted_query == 1) ? "QUERY " : "",
1500- mysql_thread_id(&mysql));
1501- tee_fprintf(stdout, "%s -- sending \"%s\" to server ...\n",
1502- reason, kill_buffer);
1503- mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
1504- mysql_close(kill_mysql);
1505- tee_fprintf(stdout, "%s -- query aborted.\n", reason);
1506-
1507- return;
1508-
1509-err:
1510-#ifdef _WIN32
1511- /*
1512- When SIGINT is raised on Windows, the OS creates a new thread to handle the
1513- interrupt. Once that thread completes, the main thread continues running
1514- only to find that it's resources have already been free'd when the sigint
1515- handler called mysql_end().
1516- */
1517- mysql_thread_end();
1518- return;
1519-#else
1520- mysql_end(sig);
1521-#endif
1522-}
1523-
1524-
1525-#if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL)
1526-sig_handler window_resize(int sig)
1527-{
1528- struct winsize window_size;
1529-
1530- if (ioctl(fileno(stdin), TIOCGWINSZ, &window_size) == 0)
1531- terminal_width= window_size.ws_col;
1532-}
1533-#endif
1534-
1535-static struct my_option my_long_options[] =
1536-{
1537- {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
1538- 0, 0, 0, 0, 0},
1539- {"help", 'I', "Synonym for -?", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
1540- 0, 0, 0, 0, 0},
1541- {"auto-rehash", OPT_AUTO_REHASH,
1542- "Enable automatic rehashing. One doesn't need to use 'rehash' to get table "
1543- "and field completion, but startup and reconnecting may take a longer time. "
1544- "Disable with --disable-auto-rehash.",
1545- &opt_rehash, &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
1546- 0, 0},
1547- {"no-auto-rehash", 'A',
1548- "No automatic rehashing. One has to use 'rehash' to get table and field "
1549- "completion. This gives a quicker start of mysql and disables rehashing "
1550- "on reconnect.",
1551- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1552- {"auto-vertical-output", OPT_AUTO_VERTICAL_OUTPUT,
1553- "Automatically switch to vertical output mode if the result is wider "
1554- "than the terminal width.",
1555- &auto_vertical_output, &auto_vertical_output, 0, GET_BOOL, NO_ARG, 0,
1556- 0, 0, 0, 0, 0},
1557- {"batch", 'B',
1558- "Don't use history file. Disable interactive behavior. (Enables --silent.)",
1559- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1560- {"bind-address", 0, "IP address to bind to.",
1561- (uchar**) &opt_bind_addr, (uchar**) &opt_bind_addr, 0, GET_STR,
1562- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1563- {"character-sets-dir", OPT_CHARSETS_DIR,
1564- "Directory for character set files.", &charsets_dir,
1565- &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1566- {"column-type-info", OPT_COLUMN_TYPES, "Display column type information.",
1567- &column_types_flag, &column_types_flag,
1568- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1569- {"comments", 'c', "Preserve comments. Send comments to the server."
1570- " The default is --skip-comments (discard comments), enable with --comments.",
1571- &preserve_comments, &preserve_comments,
1572- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1573- {"compress", 'C', "Use compression in server/client protocol.",
1574- &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
1575- 0, 0, 0},
1576-#ifdef DBUG_OFF
1577- {"debug", '#', "This is a non-debug version. Catch this and exit.",
1578- 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
1579-#else
1580- {"debug", '#', "Output debug log.", &default_dbug_option,
1581- &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
1582-#endif
1583- {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
1584- &debug_check_flag, &debug_check_flag, 0,
1585- GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1586- {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag,
1587- &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1588- {"database", 'D', "Database to use.", &current_db,
1589- &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1590- {"default-character-set", OPT_DEFAULT_CHARSET,
1591- "Set the default character set.", &default_charset,
1592- &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1593- {"delimiter", OPT_DELIMITER, "Delimiter to be used.", &delimiter_str,
1594- &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1595- {"enable_cleartext_plugin", OPT_ENABLE_CLEARTEXT_PLUGIN,
1596- "Enable/disable the clear text authentication plugin.",
1597- &opt_enable_cleartext_plugin, &opt_enable_cleartext_plugin,
1598- 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
1599- {"execute", 'e', "Execute command and quit. (Disables --force and history file.)", 0,
1600- 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1601- {"vertical", 'E', "Print the output of a query (rows) vertically.",
1602- &vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
1603- 0},
1604- {"force", 'f', "Continue even if we get an SQL error.",
1605- &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
1606- 0, 0, 0, 0},
1607- {"named-commands", 'G',
1608- "Enable named commands. Named commands mean this program's internal "
1609- "commands; see mysql> help . When enabled, the named commands can be "
1610- "used from any line of the query, otherwise only from the first line, "
1611- "before an enter. Disable with --disable-named-commands. This option "
1612- "is disabled by default.",
1613- &named_cmds, &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
1614- 0, 0},
1615- {"ignore-spaces", 'i', "Ignore space after function names.",
1616- &ignore_spaces, &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0,
1617- 0, 0, 0, 0},
1618- {"init-command", OPT_INIT_COMMAND,
1619- "SQL Command to execute when connecting to MySQL server. Will "
1620- "automatically be re-executed when reconnecting.",
1621- &opt_init_command, &opt_init_command, 0,
1622- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1623- {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
1624- &opt_local_infile, &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
1625- {"no-beep", 'b', "Turn off beep on error.", &opt_nobeep,
1626- &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1627- {"host", 'h', "Connect to host.", &current_host,
1628- &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1629- {"html", 'H', "Produce HTML output.", &opt_html, &opt_html,
1630- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1631- {"xml", 'X', "Produce XML output.", &opt_xml, &opt_xml, 0,
1632- GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1633- {"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.",
1634- &line_numbers, &line_numbers, 0, GET_BOOL,
1635- NO_ARG, 1, 0, 0, 0, 0, 0},
1636- {"skip-line-numbers", 'L', "Don't write line number for errors.", 0, 0, 0, GET_NO_ARG,
1637- NO_ARG, 0, 0, 0, 0, 0, 0},
1638- {"unbuffered", 'n', "Flush buffer after each query.", &unbuffered,
1639- &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1640- {"column-names", OPT_COLUMN_NAMES, "Write column names in results.",
1641- &column_names, &column_names, 0, GET_BOOL,
1642- NO_ARG, 1, 0, 0, 0, 0, 0},
1643- {"skip-column-names", 'N',
1644- "Don't write column names in results.",
1645- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1646- {"sigint-ignore", OPT_SIGINT_IGNORE, "Ignore SIGINT (CTRL-C).",
1647- &opt_sigint_ignore, &opt_sigint_ignore, 0, GET_BOOL,
1648- NO_ARG, 0, 0, 0, 0, 0, 0},
1649- {"one-database", 'o',
1650- "Ignore statements except those that occur while the default "
1651- "database is the one named at the command line.",
1652- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1653-#ifdef USE_POPEN
1654- {"pager", OPT_PAGER,
1655- "Pager to use to display results. If you don't supply an option, the "
1656- "default pager is taken from your ENV variable PAGER. Valid pagers are "
1657- "less, more, cat [> filename], etc. See interactive help (\\h) also. "
1658- "This option does not work in batch mode. Disable with --disable-pager. "
1659- "This option is disabled by default.",
1660- 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
1661-#endif
1662- {"password", 'p',
1663- "Password to use when connecting to server. If password is not given it's asked from the tty.",
1664- 0, 0, 0, GET_PASSWORD, OPT_ARG, 0, 0, 0, 0, 0, 0},
1665-#ifdef __WIN__
1666- {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
1667- NO_ARG, 0, 0, 0, 0, 0, 0},
1668-#endif
1669- {"port", 'P', "Port number to use for connection or 0 for default to, in "
1670- "order of preference, my.cnf, $MYSQL_TCP_PORT, "
1671-#if MYSQL_PORT_DEFAULT == 0
1672- "/etc/services, "
1673-#endif
1674- "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
1675- &opt_mysql_port,
1676- &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1677- {"prompt", OPT_PROMPT, "Set the mysql prompt to this value.",
1678- &current_prompt, &current_prompt, 0, GET_STR_ALLOC,
1679- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1680- {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).",
1681- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1682- {"quick", 'q',
1683- "Don't cache result, print it row by row. This may slow down the server "
1684- "if the output is suspended. Doesn't use history file.",
1685- &quick, &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1686- {"raw", 'r', "Write fields without conversion. Used with --batch.",
1687- &opt_raw_data, &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0,
1688- 0, 0, 0},
1689- {"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable "
1690- "with --disable-reconnect. This option is enabled by default.",
1691- &opt_reconnect, &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
1692- {"silent", 's', "Be more silent. Print results with a tab as separator, "
1693- "each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1694-#ifdef HAVE_SMEM
1695- {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
1696- "Base name of shared memory.", &shared_memory_base_name,
1697- &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1698-#endif
1699- {"socket", 'S', "The socket file to use for connection.",
1700- &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR_ALLOC,
1701- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1702-#include "sslopt-longopts.h"
1703- {"table", 't', "Output in table format.", &output_tables,
1704- &output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1705- {"tee", OPT_TEE,
1706- "Append everything into outfile. See interactive help (\\h) also. "
1707- "Does not work in batch mode. Disable with --disable-tee. "
1708- "This option is disabled by default.",
1709- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1710-#ifndef DONT_ALLOW_USER_CHANGE
1711- {"user", 'u', "User for login if not current user.", &current_user,
1712- &current_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1713-#endif
1714- {"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.",
1715- &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
1716- 0, 0, 0, 0},
1717- {"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.",
1718- &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
1719- 0, 0, 0, 0},
1720- {"verbose", 'v', "Write more. (-v -v -v gives the table output format).", 0,
1721- 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1722- {"version", 'V', "Output version information and exit.", 0, 0, 0,
1723- GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1724- {"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_NO_ARG,
1725- NO_ARG, 0, 0, 0, 0, 0, 0},
1726- {"connect_timeout", OPT_CONNECT_TIMEOUT,
1727- "Number of seconds before connection timeout.",
1728- &opt_connect_timeout, &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG,
1729- 0, 0, 3600*12, 0, 0, 0},
1730- {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
1731- "The maximum packet length to send to or receive from server.",
1732- &opt_max_allowed_packet, &opt_max_allowed_packet, 0,
1733- GET_ULONG, REQUIRED_ARG, 16 *1024L*1024L, 4096,
1734- (longlong) 2*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
1735- {"net_buffer_length", OPT_NET_BUFFER_LENGTH,
1736- "The buffer size for TCP/IP and socket communication.",
1737- &opt_net_buffer_length, &opt_net_buffer_length, 0, GET_ULONG,
1738- REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
1739- {"select_limit", OPT_SELECT_LIMIT,
1740- "Automatic limit for SELECT when using --safe-updates.",
1741- &select_limit, &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L,
1742- 1, ULONG_MAX, 0, 1, 0},
1743- {"max_join_size", OPT_MAX_JOIN_SIZE,
1744- "Automatic limit for rows in a join when using --safe-updates.",
1745- &max_join_size, &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L,
1746- 1, ULONG_MAX, 0, 1, 0},
1747- {"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it"
1748- " uses old (pre-4.1.1) protocol.", &opt_secure_auth,
1749- &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
1750- {"server-arg", OPT_SERVER_ARG, "Send embedded server this as a parameter.",
1751- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1752- {"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.",
1753- &show_warnings, &show_warnings, 0, GET_BOOL, NO_ARG,
1754- 0, 0, 0, 0, 0, 0},
1755- {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
1756- &opt_plugin_dir, &opt_plugin_dir, 0,
1757- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1758- {"default_auth", OPT_DEFAULT_AUTH,
1759- "Default authentication client-side plugin to use.",
1760- &opt_default_auth, &opt_default_auth, 0,
1761- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1762- {"histignore", OPT_HISTIGNORE, "A colon-separated list of patterns "
1763- "to keep statements from getting logged into mysql history.",
1764- &opt_histignore, &opt_histignore, 0, GET_STR_ALLOC, REQUIRED_ARG,
1765- 0, 0, 0, 0, 0, 0},
1766- {"binary-mode", OPT_BINARY_MODE,
1767- "By default, ASCII '\\0' is disallowed and '\\r\\n' is translated to '\\n'. "
1768- "This switch turns off both features, and also turns off parsing of all client"
1769- "commands except \\C and DELIMITER, in non-interactive mode (for input "
1770- "piped to mysql or loaded using the 'source' command). This is necessary "
1771- "when processing output from mysqlbinlog that may contain blobs.",
1772- &opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1773-#if !defined(HAVE_YASSL)
1774- {"server-public-key-path", OPT_SERVER_PUBLIC_KEY,
1775- "File path to the server public RSA key in PEM format.",
1776- &opt_server_public_key, &opt_server_public_key, 0,
1777- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1778-#endif
1779- {"connect-expired-password", 0,
1780- "Notify the server that this client is prepared to handle expired "
1781- "password sandbox mode.",
1782- &opt_connect_expired_password, &opt_connect_expired_password, 0, GET_BOOL,
1783- NO_ARG, 0, 0, 0, 0, 0, 0},
1784- { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
1785-};
1786-
1787-
1788-static void usage(int version)
1789-{
1790-#if defined(USE_LIBEDIT_INTERFACE)
1791- const char* readline= "";
1792-#else
1793- const char* readline= "readline";
1794-#endif
1795-
1796-#ifdef HAVE_READLINE
1797- printf("%s Ver %s Distrib %s, for %s (%s) using %s %s\n",
1798- my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE,
1799- readline, rl_library_version);
1800-#else
1801- printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, VER,
1802- MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
1803-#endif
1804-
1805- if (version)
1806- return;
1807- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
1808- printf("Usage: %s [OPTIONS] [database]\n", my_progname);
1809- my_print_help(my_long_options);
1810- print_defaults("my", load_default_groups);
1811- my_print_variables(my_long_options);
1812-}
1813-
1814-
1815-my_bool
1816-get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
1817- char *argument)
1818-{
1819- switch(optid) {
1820- case OPT_CHARSETS_DIR:
1821- strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir) - 1);
1822- charsets_dir = mysql_charsets_dir;
1823- break;
1824- case OPT_DELIMITER:
1825- if (argument == disabled_my_option)
1826- {
1827- strmov(delimiter, DEFAULT_DELIMITER);
1828- }
1829- else
1830- {
1831- /* Check that delimiter does not contain a backslash */
1832- if (!strstr(argument, "\\"))
1833- {
1834- strmake(delimiter, argument, sizeof(delimiter) - 1);
1835- }
1836- else
1837- {
1838- put_info("DELIMITER cannot contain a backslash character", INFO_ERROR);
1839- return 0;
1840- }
1841- }
1842- delimiter_length= (uint)strlen(delimiter);
1843- delimiter_str= delimiter;
1844- break;
1845- case OPT_LOCAL_INFILE:
1846- using_opt_local_infile=1;
1847- break;
1848- case OPT_ENABLE_CLEARTEXT_PLUGIN:
1849- using_opt_enable_cleartext_plugin= TRUE;
1850- break;
1851- case OPT_TEE:
1852- if (argument == disabled_my_option)
1853- {
1854- if (opt_outfile)
1855- end_tee();
1856- }
1857- else
1858- init_tee(argument);
1859- break;
1860- case OPT_PAGER:
1861- if (argument == disabled_my_option)
1862- opt_nopager= 1;
1863- else
1864- {
1865- opt_nopager= 0;
1866- if (argument && strlen(argument))
1867- {
1868- default_pager_set= 1;
1869- strmake(pager, argument, sizeof(pager) - 1);
1870- strmov(default_pager, pager);
1871- }
1872- else if (default_pager_set)
1873- strmov(pager, default_pager);
1874- else
1875- opt_nopager= 1;
1876- }
1877- break;
1878- case OPT_MYSQL_PROTOCOL:
1879-#ifndef EMBEDDED_LIBRARY
1880- opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
1881- opt->name);
1882-#endif
1883- break;
1884- case OPT_SERVER_ARG:
1885-#ifdef EMBEDDED_LIBRARY
1886- /*
1887- When the embedded server is being tested, the client needs to be
1888- able to pass command-line arguments to the embedded server so it can
1889- locate the language files and data directory.
1890- */
1891- if (!embedded_server_arg_count)
1892- {
1893- embedded_server_arg_count= 1;
1894- embedded_server_args[0]= (char*) "";
1895- }
1896- if (embedded_server_arg_count == MAX_SERVER_ARGS-1 ||
1897- !(embedded_server_args[embedded_server_arg_count++]=
1898- my_strdup(argument, MYF(MY_FAE))))
1899- {
1900- put_info("Can't use server argument", INFO_ERROR);
1901- return 0;
1902- }
1903-#else /*EMBEDDED_LIBRARY */
1904- printf("WARNING: --server-arg option not supported in this configuration.\n");
1905-#endif
1906- break;
1907- case 'A':
1908- opt_rehash= 0;
1909- break;
1910- case 'N':
1911- column_names= 0;
1912- break;
1913- case 'e':
1914- status.batch= 1;
1915- status.add_to_history= 0;
1916- if (!status.line_buff)
1917- ignore_errors= 0; // do it for the first -e only
1918- if (!(status.line_buff= batch_readline_command(status.line_buff, argument)))
1919- return 1;
1920- break;
1921- case 'o':
1922- if (argument == disabled_my_option)
1923- one_database= 0;
1924- else
1925- one_database= skip_updates= 1;
1926- break;
1927- case 'p':
1928- if (argument == disabled_my_option)
1929- argument= (char*) ""; // Don't require password
1930- if (argument)
1931- {
1932- char *start= argument;
1933- my_free(opt_password);
1934- opt_password= my_strdup(argument, MYF(MY_FAE));
1935- while (*argument) *argument++= 'x'; // Destroy argument
1936- if (*start)
1937- start[1]=0 ;
1938- tty_password= 0;
1939- }
1940- else
1941- tty_password= 1;
1942- break;
1943- case '#':
1944- DBUG_PUSH(argument ? argument : default_dbug_option);
1945- debug_info_flag= 1;
1946- break;
1947- case 's':
1948- if (argument == disabled_my_option)
1949- opt_silent= 0;
1950- else
1951- opt_silent++;
1952- break;
1953- case 'v':
1954- if (argument == disabled_my_option)
1955- verbose= 0;
1956- else
1957- verbose++;
1958- break;
1959- case 'B':
1960- status.batch= 1;
1961- status.add_to_history= 0;
1962- set_if_bigger(opt_silent,1); // more silent
1963- break;
1964- case 'W':
1965-#ifdef __WIN__
1966- opt_protocol = MYSQL_PROTOCOL_PIPE;
1967-#endif
1968- break;
1969-#include <sslopt-case.h>
1970- case 'V':
1971- usage(1);
1972- exit(0);
1973- case 'I':
1974- case '?':
1975- usage(0);
1976- exit(0);
1977- }
1978- return 0;
1979-}
1980-
1981-
1982-static int get_options(int argc, char **argv)
1983-{
1984- char *tmp, *pagpoint;
1985- int ho_error;
1986- MYSQL_PARAMETERS *mysql_params= mysql_get_parameters();
1987-
1988- tmp= (char *) getenv("MYSQL_HOST");
1989- if (tmp)
1990- current_host= my_strdup(tmp, MYF(MY_WME));
1991-
1992- pagpoint= getenv("PAGER");
1993- if (!((char*) (pagpoint)))
1994- {
1995- strmov(pager, "stdout");
1996- opt_nopager= 1;
1997- }
1998- else
1999- strmov(pager, pagpoint);
2000- strmov(default_pager, pager);
2001-
2002- opt_max_allowed_packet= *mysql_params->p_max_allowed_packet;
2003- opt_net_buffer_length= *mysql_params->p_net_buffer_length;
2004-
2005- if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
2006- exit(ho_error);
2007-
2008- *mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
2009- *mysql_params->p_net_buffer_length= opt_net_buffer_length;
2010-
2011- if (status.batch) /* disable pager and outfile in this case */
2012- {
2013- strmov(default_pager, "stdout");
2014- strmov(pager, "stdout");
2015- opt_nopager= 1;
2016- default_pager_set= 0;
2017- opt_outfile= 0;
2018- opt_reconnect= 0;
2019- connect_flag= 0; /* Not in interactive mode */
2020- }
2021-
2022- if (argc > 1)
2023- {
2024- usage(0);
2025- exit(1);
2026- }
2027- if (argc == 1)
2028- {
2029- skip_updates= 0;
2030- my_free(current_db);
2031- current_db= my_strdup(*argv, MYF(MY_WME));
2032- }
2033- if (tty_password)
2034- opt_password= get_tty_password(NullS);
2035- if (debug_info_flag)
2036- my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
2037- if (debug_check_flag)
2038- my_end_arg= MY_CHECK_ERROR;
2039-
2040- if (ignore_spaces)
2041- connect_flag|= CLIENT_IGNORE_SPACE;
2042-
2043- return(0);
2044-}
2045-
2046-static int read_and_execute(bool interactive)
2047-{
2048-#if defined(__WIN__)
2049- String tmpbuf;
2050- String buffer;
2051-#endif
2052-
2053- char *line= NULL;
2054- char in_string=0;
2055- ulong line_number=0;
2056- bool ml_comment= 0;
2057- COMMANDS *com;
2058- ulong line_length= 0;
2059- status.exit_status=1;
2060-
2061- real_binary_mode= !interactive && opt_binary_mode;
2062- for (;;)
2063- {
2064- if (!interactive)
2065- {
2066- /*
2067- batch_readline can return 0 on EOF or error.
2068- In that case, we need to double check that we have a valid
2069- line before actually setting line_length to read_length.
2070- */
2071- line= batch_readline(status.line_buff, real_binary_mode);
2072- if (line)
2073- {
2074- line_length= status.line_buff->read_length;
2075-
2076- /*
2077- ASCII 0x00 is not allowed appearing in queries if it is not in binary
2078- mode.
2079- */
2080- if (!real_binary_mode && strlen(line) != line_length)
2081- {
2082- status.exit_status= 1;
2083- String msg;
2084- msg.append("ASCII '\\0' appeared in the statement, but this is not "
2085- "allowed unless option --binary-mode is enabled and mysql is "
2086- "run in non-interactive mode. Set --binary-mode to 1 if ASCII "
2087- "'\\0' is expected. Query: '");
2088- msg.append(glob_buffer);
2089- msg.append(line);
2090- msg.append("'.");
2091- put_info(msg.c_ptr(), INFO_ERROR);
2092- break;
2093- }
2094-
2095- /*
2096- Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF.
2097- Editors like "notepad" put this marker in
2098- the very beginning of a text file when
2099- you save the file using "Unicode UTF-8" format.
2100- */
2101- if (!line_number &&
2102- (uchar) line[0] == 0xEF &&
2103- (uchar) line[1] == 0xBB &&
2104- (uchar) line[2] == 0xBF)
2105- {
2106- line+= 3;
2107- // decrease the line length accordingly to the 3 bytes chopped
2108- line_length -=3;
2109- }
2110- }
2111- line_number++;
2112- if (!glob_buffer.length())
2113- status.query_start_line=line_number;
2114- }
2115- else
2116- {
2117- char *prompt= (char*) (ml_comment ? " /*> " :
2118- glob_buffer.is_empty() ? construct_prompt() :
2119- !in_string ? " -> " :
2120- in_string == '\'' ?
2121- " '> " : (in_string == '`' ?
2122- " `> " :
2123- " \"> "));
2124- if (opt_outfile && glob_buffer.is_empty())
2125- fflush(OUTFILE);
2126-
2127-#if defined(__WIN__)
2128- tee_fputs(prompt, stdout);
2129- if (!tmpbuf.is_alloced())
2130- tmpbuf.alloc(65535);
2131- tmpbuf.length(0);
2132- buffer.length(0);
2133- line= my_win_console_readline(charset_info,
2134- (char *) tmpbuf.ptr(),
2135- tmpbuf.alloced_length());
2136-#else
2137- if (opt_outfile)
2138- fputs(prompt, OUTFILE);
2139- /*
2140- free the previous entered line.
2141- Note: my_free() cannot be used here as the memory was allocated under
2142- the readline/libedit library.
2143- */
2144- if (line)
2145- free(line);
2146- line= readline(prompt);
2147-#endif /* defined(__WIN__) */
2148-
2149- /*
2150- When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS
2151- which may cause coredump.
2152- */
2153- if (opt_outfile && line)
2154- fprintf(OUTFILE, "%s\n", line);
2155-
2156- line_length= line ? strlen(line) : 0;
2157- }
2158- // End of file or system error
2159- if (!line)
2160- {
2161- if (status.line_buff && status.line_buff->error)
2162- status.exit_status= 1;
2163- else
2164- status.exit_status= 0;
2165- break;
2166- }
2167-
2168- /*
2169- Check if line is a mysql command line
2170- (We want to allow help, print and clear anywhere at line start
2171- */
2172- if ((named_cmds || glob_buffer.is_empty())
2173- && !ml_comment && !in_string && (com= find_command(line)))
2174- {
2175- if ((*com->func)(&glob_buffer,line) > 0)
2176- break;
2177- if (glob_buffer.is_empty()) // If buffer was emptied
2178- in_string=0;
2179-#ifdef HAVE_READLINE
2180- if (interactive && status.add_to_history && not_in_history(line))
2181- add_filtered_history(line);
2182-#endif
2183- continue;
2184- }
2185- if (add_line(glob_buffer, line, line_length, &in_string, &ml_comment,
2186- status.line_buff ? status.line_buff->truncated : 0))
2187- break;
2188- }
2189- /* if in batch mode, send last query even if it doesn't end with \g or go */
2190-
2191- if (!interactive && !status.exit_status)
2192- {
2193- remove_cntrl(glob_buffer);
2194- if (!glob_buffer.is_empty())
2195- {
2196- status.exit_status=1;
2197- if (com_go(&glob_buffer,line) <= 0)
2198- status.exit_status=0;
2199- }
2200- }
2201-
2202-#if defined(__WIN__)
2203- buffer.free();
2204- tmpbuf.free();
2205-#else
2206- if (interactive)
2207- /*
2208- free the last entered line.
2209- Note: my_free() cannot be used here as the memory was allocated under
2210- the readline/libedit library.
2211- */
2212- free(line);
2213-#endif
2214-
2215- /*
2216- If the function is called by 'source' command, it will return to interactive
2217- mode, so real_binary_mode should be FALSE. Otherwise, it will exit the
2218- program, it is safe to set real_binary_mode to FALSE.
2219- */
2220- real_binary_mode= FALSE;
2221- return status.exit_status;
2222-}
2223-
2224-/**
2225- It checks if the input is a short form command. It returns the command's
2226- pointer if a command is found, else return NULL. Note that if binary-mode
2227- is set, then only \C is searched for.
2228-
2229- @param cmd_char A character of one byte.
2230-
2231- @return
2232- the command's pointer or NULL.
2233-*/
2234-static COMMANDS *find_command(char cmd_char)
2235-{
2236- DBUG_ENTER("find_command");
2237- DBUG_PRINT("enter", ("cmd_char: %d", cmd_char));
2238-
2239- int index= -1;
2240-
2241- /*
2242- In binary-mode, we disallow all mysql commands except '\C'
2243- and DELIMITER.
2244- */
2245- if (real_binary_mode)
2246- {
2247- if (cmd_char == 'C')
2248- index= charset_index;
2249- }
2250- else
2251- index= get_command_index(cmd_char);
2252-
2253- if (index >= 0)
2254- {
2255- DBUG_PRINT("exit",("found command: %s", commands[index].name));
2256- DBUG_RETURN(&commands[index]);
2257- }
2258- else
2259- DBUG_RETURN((COMMANDS *) 0);
2260-}
2261-
2262-/**
2263- It checks if the input is a long form command. It returns the command's
2264- pointer if a command is found, else return NULL. Note that if binary-mode
2265- is set, then only DELIMITER is searched for.
2266-
2267- @param name A string.
2268- @return
2269- the command's pointer or NULL.
2270-*/
2271-static COMMANDS *find_command(char *name)
2272-{
2273- uint len;
2274- char *end;
2275- DBUG_ENTER("find_command");
2276-
2277- DBUG_ASSERT(name != NULL);
2278- DBUG_PRINT("enter", ("name: '%s'", name));
2279-
2280- while (my_isspace(charset_info, *name))
2281- name++;
2282- /*
2283- If there is an \\g in the row or if the row has a delimiter but
2284- this is not a delimiter command, let add_line() take care of
2285- parsing the row and calling find_command().
2286- */
2287- if ((!real_binary_mode && strstr(name, "\\g")) ||
2288- (strstr(name, delimiter) &&
2289- !is_delimiter_command(name, DELIMITER_NAME_LEN)))
2290- DBUG_RETURN((COMMANDS *) 0);
2291-
2292- if ((end=strcont(name, " \t")))
2293- {
2294- len=(uint) (end - name);
2295- while (my_isspace(charset_info, *end))
2296- end++;
2297- if (!*end)
2298- end= 0; // no arguments to function
2299- }
2300- else
2301- len= (uint) strlen(name);
2302-
2303- int index= -1;
2304- if (real_binary_mode)
2305- {
2306- if (is_delimiter_command(name, len))
2307- index= delimiter_index;
2308- }
2309- else
2310- {
2311- /*
2312- All commands are in the first part of commands array and have a function
2313- to implement it.
2314- */
2315- for (uint i= 0; commands[i].func; i++)
2316- {
2317- if (!my_strnncoll(&my_charset_latin1, (uchar*) name, len,
2318- (uchar*) commands[i].name, len) &&
2319- (commands[i].name[len] == '\0') &&
2320- (!end || commands[i].takes_params))
2321- {
2322- index= i;
2323- break;
2324- }
2325- }
2326- }
2327-
2328- if (index >= 0)
2329- {
2330- DBUG_PRINT("exit", ("found command: %s", commands[index].name));
2331- DBUG_RETURN(&commands[index]);
2332- }
2333- DBUG_RETURN((COMMANDS *) 0);
2334-}
2335-
2336-
2337-static bool add_line(String &buffer, char *line, ulong line_length,
2338- char *in_string, bool *ml_comment, bool truncated)
2339-{
2340- uchar inchar;
2341- char buff[80], *pos, *out;
2342- COMMANDS *com;
2343- bool need_space= 0;
2344- bool ss_comment= 0;
2345- DBUG_ENTER("add_line");
2346-
2347- if (!line[0] && buffer.is_empty())
2348- DBUG_RETURN(0);
2349-#ifdef HAVE_READLINE
2350- if (status.add_to_history && line[0] && not_in_history(line))
2351- add_filtered_history(line);
2352-#endif
2353- char *end_of_line= line + line_length;
2354-
2355- for (pos= out= line; pos < end_of_line; pos++)
2356- {
2357- inchar= (uchar) *pos;
2358- if (!preserve_comments)
2359- {
2360- // Skip spaces at the beginning of a statement
2361- if (my_isspace(charset_info,inchar) && (out == line) &&
2362- buffer.is_empty())
2363- continue;
2364- }
2365-
2366-#ifdef USE_MB
2367- // Accept multi-byte characters as-is
2368- int length;
2369- if (use_mb(charset_info) &&
2370- (length= my_ismbchar(charset_info, pos, end_of_line)))
2371- {
2372- if (!*ml_comment || preserve_comments)
2373- {
2374- while (length--)
2375- *out++ = *pos++;
2376- pos--;
2377- }
2378- else
2379- pos+= length - 1;
2380- continue;
2381- }
2382-#endif
2383- if (!*ml_comment && inchar == '\\' &&
2384- !(*in_string &&
2385- (mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)))
2386- {
2387- // Found possbile one character command like \c
2388-
2389- if (!(inchar = (uchar) *++pos))
2390- break; // readline adds one '\'
2391- if (*in_string || inchar == 'N') // \N is short for NULL
2392- { // Don't allow commands in string
2393- *out++='\\';
2394- *out++= (char) inchar;
2395- continue;
2396- }
2397- if ((com= find_command((char) inchar)))
2398- {
2399- // Flush previously accepted characters
2400- if (out != line)
2401- {
2402- buffer.append(line, (uint) (out-line));
2403- out= line;
2404- }
2405-
2406- if ((*com->func)(&buffer,pos-1) > 0)
2407- DBUG_RETURN(1); // Quit
2408- if (com->takes_params)
2409- {
2410- if (ss_comment)
2411- {
2412- /*
2413- If a client-side macro appears inside a server-side comment,
2414- discard all characters in the comment after the macro (that is,
2415- until the end of the comment rather than the next delimiter)
2416- */
2417- for (pos++; *pos && (*pos != '*' || *(pos + 1) != '/'); pos++)
2418- ;
2419- pos--;
2420- }
2421- else
2422- {
2423- for (pos++ ;
2424- *pos && (*pos != *delimiter ||
2425- !is_prefix(pos + 1, delimiter + 1)) ; pos++)
2426- ; // Remove parameters
2427- if (!*pos)
2428- pos--;
2429- else
2430- pos+= delimiter_length - 1; // Point at last delim char
2431- }
2432- }
2433- }
2434- else
2435- {
2436- sprintf(buff,"Unknown command '\\%c'.",inchar);
2437- if (put_info(buff,INFO_ERROR) > 0)
2438- DBUG_RETURN(1);
2439- *out++='\\';
2440- *out++=(char) inchar;
2441- continue;
2442- }
2443- }
2444- else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter))
2445- {
2446- // Found a statement. Continue parsing after the delimiter
2447- pos+= delimiter_length;
2448-
2449- if (preserve_comments)
2450- {
2451- while (my_isspace(charset_info, *pos))
2452- *out++= *pos++;
2453- }
2454- // Flush previously accepted characters
2455- if (out != line)
2456- {
2457- buffer.append(line, (uint32) (out-line));
2458- out= line;
2459- }
2460-
2461- if (preserve_comments && ((*pos == '#') ||
2462- ((*pos == '-') &&
2463- (pos[1] == '-') &&
2464- my_isspace(charset_info, pos[2]))))
2465- {
2466- // Add trailing single line comments to this statement
2467- buffer.append(pos);
2468- pos+= strlen(pos);
2469- }
2470-
2471- pos--;
2472-
2473- if ((com= find_command(buffer.c_ptr())))
2474- {
2475-
2476- if ((*com->func)(&buffer, buffer.c_ptr()) > 0)
2477- DBUG_RETURN(1); // Quit
2478- }
2479- else
2480- {
2481- if (com_go(&buffer, 0) > 0) // < 0 is not fatal
2482- DBUG_RETURN(1);
2483- }
2484- buffer.length(0);
2485- }
2486- else if (!*ml_comment && (!*in_string && (inchar == '#' ||
2487- (inchar == '-' && pos[1] == '-' &&
2488- /*
2489- The third byte is either whitespace or is the
2490- end of the line -- which would occur only
2491- because of the user sending newline -- which is
2492- itself whitespace and should also match.
2493- */
2494- (my_isspace(charset_info,pos[2]) ||
2495- !pos[2])))))
2496- {
2497- // Flush previously accepted characters
2498- if (out != line)
2499- {
2500- buffer.append(line, (uint32) (out - line));
2501- out= line;
2502- }
2503-
2504- // comment to end of line
2505- if (preserve_comments)
2506- {
2507- bool started_with_nothing= !buffer.length();
2508-
2509- buffer.append(pos);
2510-
2511- /*
2512- A single-line comment by itself gets sent immediately so that
2513- client commands (delimiter, status, etc) will be interpreted on
2514- the next line.
2515- */
2516- if (started_with_nothing)
2517- {
2518- if (com_go(&buffer, 0) > 0) // < 0 is not fatal
2519- DBUG_RETURN(1);
2520- buffer.length(0);
2521- }
2522- }
2523-
2524- break;
2525- }
2526- else if (!*in_string && inchar == '/' && *(pos+1) == '*' &&
2527- *(pos+2) != '!')
2528- {
2529- if (preserve_comments)
2530- {
2531- *out++= *pos++; // copy '/'
2532- *out++= *pos; // copy '*'
2533- }
2534- else
2535- pos++;
2536- *ml_comment= 1;
2537- if (out != line)
2538- {
2539- buffer.append(line,(uint) (out-line));
2540- out=line;
2541- }
2542- }
2543- else if (*ml_comment && !ss_comment && inchar == '*' && *(pos + 1) == '/')
2544- {
2545- if (preserve_comments)
2546- {
2547- *out++= *pos++; // copy '*'
2548- *out++= *pos; // copy '/'
2549- }
2550- else
2551- pos++;
2552- *ml_comment= 0;
2553- if (out != line)
2554- {
2555- buffer.append(line, (uint32) (out - line));
2556- out= line;
2557- }
2558- // Consumed a 2 chars or more, and will add 1 at most,
2559- // so using the 'line' buffer to edit data in place is ok.
2560- need_space= 1;
2561- }
2562- else
2563- { // Add found char to buffer
2564- if (!*in_string && inchar == '/' && *(pos + 1) == '*' &&
2565- *(pos + 2) == '!')
2566- ss_comment= 1;
2567- else if (!*in_string && ss_comment && inchar == '*' && *(pos + 1) == '/')
2568- ss_comment= 0;
2569- if (inchar == *in_string)
2570- *in_string= 0;
2571- else if (!*ml_comment && !*in_string &&
2572- (inchar == '\'' || inchar == '"' || inchar == '`'))
2573- *in_string= (char) inchar;
2574- if (!*ml_comment || preserve_comments)
2575- {
2576- if (need_space && !my_isspace(charset_info, (char)inchar))
2577- *out++= ' ';
2578- need_space= 0;
2579- *out++= (char) inchar;
2580- }
2581- }
2582- }
2583- if (out != line || !buffer.is_empty())
2584- {
2585- uint length=(uint) (out-line);
2586-
2587- if (!truncated && (!is_delimiter_command(line, length) ||
2588- (*in_string || *ml_comment)))
2589- {
2590- /*
2591- Don't add a new line in case there's a DELIMITER command to be
2592- added to the glob buffer (e.g. on processing a line like
2593- "<command>;DELIMITER <non-eof>") : similar to how a new line is
2594- not added in the case when the DELIMITER is the first command
2595- entered with an empty glob buffer. However, if the delimiter is
2596- part of a string or a comment, the new line should be added. (e.g.
2597- SELECT '\ndelimiter\n';\n)
2598- */
2599- *out++='\n';
2600- length++;
2601- }
2602- if (buffer.length() + length >= buffer.alloced_length())
2603- buffer.realloc(buffer.length()+length+IO_SIZE);
2604- if ((!*ml_comment || preserve_comments) && buffer.append(line, length))
2605- DBUG_RETURN(1);
2606- }
2607- DBUG_RETURN(0);
2608-}
2609-
2610-/*****************************************************************
2611- Interface to Readline Completion
2612-******************************************************************/
2613-
2614-#ifdef HAVE_READLINE
2615-
2616-C_MODE_START
2617-static char *new_command_generator(const char *text, int);
2618-static char **new_mysql_completion(const char *text, int start, int end);
2619-C_MODE_END
2620-
2621-/*
2622- Tell the GNU Readline library how to complete. We want to try to complete
2623- on command names if this is the first word in the line, or on filenames
2624- if not.
2625-*/
2626-
2627-#if defined(USE_NEW_READLINE_INTERFACE)
2628-static int fake_magic_space(int, int);
2629-extern "C" char *no_completion(const char*,int)
2630-#elif defined(USE_LIBEDIT_INTERFACE)
2631-static int fake_magic_space(const char *, int);
2632-extern "C" int no_completion(const char*,int)
2633-#else
2634-extern "C" char *no_completion()
2635-#endif
2636-{
2637- return 0; /* No filename completion */
2638-}
2639-
2640-/* glues pieces of history back together if in pieces */
2641-static void fix_history(String *final_command)
2642-{
2643- int total_lines = 1;
2644- char *ptr = final_command->c_ptr();
2645- String fixed_buffer; /* Converted buffer */
2646- char str_char = '\0'; /* Character if we are in a string or not */
2647-
2648- /* find out how many lines we have and remove newlines */
2649- while (*ptr != '\0')
2650- {
2651- switch (*ptr) {
2652- /* string character */
2653- case '"':
2654- case '\'':
2655- case '`':
2656- if (str_char == '\0') /* open string */
2657- str_char = *ptr;
2658- else if (str_char == *ptr) /* close string */
2659- str_char = '\0';
2660- fixed_buffer.append(ptr,1);
2661- break;
2662- case '\n':
2663- /*
2664- not in string, change to space
2665- if in string, leave it alone
2666- */
2667- fixed_buffer.append(str_char == '\0' ? " " : "\n");
2668- total_lines++;
2669- break;
2670- case '\\':
2671- fixed_buffer.append('\\');
2672- /* need to see if the backslash is escaping anything */
2673- if (str_char)
2674- {
2675- ptr++;
2676- /* special characters that need escaping */
2677- if (*ptr == '\'' || *ptr == '"' || *ptr == '\\')
2678- fixed_buffer.append(ptr,1);
2679- else
2680- ptr--;
2681- }
2682- break;
2683-
2684- default:
2685- fixed_buffer.append(ptr,1);
2686- }
2687- ptr++;
2688- }
2689- if (total_lines > 1)
2690- add_filtered_history(fixed_buffer.ptr());
2691-}
2692-
2693-/*
2694- returns 0 if line matches the previous history entry
2695- returns 1 if the line doesn't match the previous history entry
2696-*/
2697-static int not_in_history(const char *line)
2698-{
2699- HIST_ENTRY *oldhist = history_get(history_length);
2700-
2701- if (oldhist == 0)
2702- return 1;
2703- if (strcmp(oldhist->line,line) == 0)
2704- return 0;
2705- return 1;
2706-}
2707-
2708-
2709-#if defined(USE_NEW_READLINE_INTERFACE)
2710-static int fake_magic_space(int, int)
2711-#else
2712-static int fake_magic_space(const char *, int)
2713-#endif
2714-{
2715- rl_insert(1, ' ');
2716- return 0;
2717-}
2718-
2719-
2720-static void initialize_readline (char *name)
2721-{
2722- /* Allow conditional parsing of the ~/.inputrc file. */
2723- rl_readline_name = name;
2724-
2725- /* Tell the completer that we want a crack first. */
2726-#if defined(USE_NEW_READLINE_INTERFACE)
2727- rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion;
2728- rl_completion_entry_function= (rl_compentry_func_t*)&no_completion;
2729-
2730- rl_add_defun("magic-space", (rl_command_func_t *)&fake_magic_space, -1);
2731-#elif defined(USE_LIBEDIT_INTERFACE)
2732-#ifdef HAVE_LOCALE_H
2733- setlocale(LC_ALL,""); /* so as libedit use isprint */
2734-#endif
2735- rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
2736- rl_completion_entry_function= &no_completion;
2737- rl_add_defun("magic-space", (Function*)&fake_magic_space, -1);
2738-#else
2739- rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
2740- rl_completion_entry_function= &no_completion;
2741-#endif
2742-}
2743-
2744-/*
2745- Attempt to complete on the contents of TEXT. START and END show the
2746- region of TEXT that contains the word to complete. We can use the
2747- entire line in case we want to do some simple parsing. Return the
2748- array of matches, or NULL if there aren't any.
2749-*/
2750-
2751-static char **new_mysql_completion(const char *text,
2752- int start __attribute__((unused)),
2753- int end __attribute__((unused)))
2754-{
2755- if (!status.batch && !quick)
2756-#if defined(USE_NEW_READLINE_INTERFACE)
2757- return rl_completion_matches(text, new_command_generator);
2758-#else
2759- return completion_matches((char *)text, (CPFunction *)new_command_generator);
2760-#endif
2761- else
2762- return (char**) 0;
2763-}
2764-
2765-static char *new_command_generator(const char *text,int state)
2766-{
2767- static int textlen;
2768- char *ptr;
2769- static Bucket *b;
2770- static entry *e;
2771- static uint i;
2772-
2773- if (!state)
2774- textlen=(uint) strlen(text);
2775-
2776- if (textlen>0)
2777- { /* lookup in the hash */
2778- if (!state)
2779- {
2780- uint len;
2781-
2782- b = find_all_matches(&ht,text,(uint) strlen(text),&len);
2783- if (!b)
2784- return NullS;
2785- e = b->pData;
2786- }
2787-
2788- if (e)
2789- {
2790- ptr= strdup(e->str);
2791- e = e->pNext;
2792- return ptr;
2793- }
2794- }
2795- else
2796- { /* traverse the entire hash, ugly but works */
2797-
2798- if (!state)
2799- {
2800- /* find the first used bucket */
2801- for (i=0 ; i < ht.nTableSize ; i++)
2802- {
2803- if (ht.arBuckets[i])
2804- {
2805- b = ht.arBuckets[i];
2806- e = b->pData;
2807- break;
2808- }
2809- }
2810- }
2811- ptr= NullS;
2812- while (e && !ptr)
2813- { /* find valid entry in bucket */
2814- if ((uint) strlen(e->str) == b->nKeyLength)
2815- ptr = strdup(e->str);
2816- /* find the next used entry */
2817- e = e->pNext;
2818- if (!e)
2819- { /* find the next used bucket */
2820- b = b->pNext;
2821- if (!b)
2822- {
2823- for (i++ ; i<ht.nTableSize; i++)
2824- {
2825- if (ht.arBuckets[i])
2826- {
2827- b = ht.arBuckets[i];
2828- e = b->pData;
2829- break;
2830- }
2831- }
2832- }
2833- else
2834- e = b->pData;
2835- }
2836- }
2837- if (ptr)
2838- return ptr;
2839- }
2840- return NullS;
2841-}
2842-
2843-
2844-/* Build up the completion hash */
2845-
2846-static void build_completion_hash(bool rehash, bool write_info)
2847-{
2848- COMMANDS *cmd=commands;
2849- MYSQL_RES *databases=0,*tables=0;
2850- MYSQL_RES *fields;
2851- static char ***field_names= 0;
2852- MYSQL_ROW database_row,table_row;
2853- MYSQL_FIELD *sql_field;
2854- char buf[NAME_LEN*2+2]; // table name plus field name plus 2
2855- int i,j,num_fields;
2856- DBUG_ENTER("build_completion_hash");
2857-
2858- if (status.batch || quick || !current_db)
2859- DBUG_VOID_RETURN; // We don't need completion in batches
2860- if (!rehash)
2861- DBUG_VOID_RETURN;
2862-
2863- /* Free old used memory */
2864- if (field_names)
2865- field_names=0;
2866- completion_hash_clean(&ht);
2867- free_root(&hash_mem_root,MYF(0));
2868-
2869- /* hash this file's known subset of SQL commands */
2870- while (cmd->name) {
2871- add_word(&ht,(char*) cmd->name);
2872- cmd++;
2873- }
2874-
2875- /* hash MySQL functions (to be implemented) */
2876-
2877- /* hash all database names */
2878- if (mysql_query(&mysql,"show databases") == 0)
2879- {
2880- if (!(databases = mysql_store_result(&mysql)))
2881- put_info(mysql_error(&mysql),INFO_INFO);
2882- else
2883- {
2884- while ((database_row=mysql_fetch_row(databases)))
2885- {
2886- char *str=strdup_root(&hash_mem_root, (char*) database_row[0]);
2887- if (str)
2888- add_word(&ht,(char*) str);
2889- }
2890- mysql_free_result(databases);
2891- }
2892- }
2893- /* hash all table names */
2894- if (mysql_query(&mysql,"show tables")==0)
2895- {
2896- if (!(tables = mysql_store_result(&mysql)))
2897- put_info(mysql_error(&mysql),INFO_INFO);
2898- else
2899- {
2900- if (mysql_num_rows(tables) > 0 && !opt_silent && write_info)
2901- {
2902- tee_fprintf(stdout, "\
2903-Reading table information for completion of table and column names\n\
2904-You can turn off this feature to get a quicker startup with -A\n\n");
2905- }
2906- while ((table_row=mysql_fetch_row(tables)))
2907- {
2908- char *str=strdup_root(&hash_mem_root, (char*) table_row[0]);
2909- if (str &&
2910- !completion_hash_exists(&ht,(char*) str, (uint) strlen(str)))
2911- add_word(&ht,str);
2912- }
2913- }
2914- }
2915-
2916- /* hash all field names, both with the table prefix and without it */
2917- if (!tables) /* no tables */
2918- {
2919- DBUG_VOID_RETURN;
2920- }
2921- mysql_data_seek(tables,0);
2922- if (!(field_names= (char ***) alloc_root(&hash_mem_root,sizeof(char **) *
2923- (uint) (mysql_num_rows(tables)+1))))
2924- {
2925- mysql_free_result(tables);
2926- DBUG_VOID_RETURN;
2927- }
2928- i=0;
2929- while ((table_row=mysql_fetch_row(tables)))
2930- {
2931- if ((fields=mysql_list_fields(&mysql,(const char*) table_row[0],NullS)))
2932- {
2933- num_fields=mysql_num_fields(fields);
2934- if (!(field_names[i] = (char **) alloc_root(&hash_mem_root,
2935- sizeof(char *) *
2936- (num_fields*2+1))))
2937- {
2938- mysql_free_result(fields);
2939- break;
2940- }
2941- field_names[i][num_fields*2]= NULL;
2942- j=0;
2943- while ((sql_field=mysql_fetch_field(fields)))
2944- {
2945- sprintf(buf,"%.64s.%.64s",table_row[0],sql_field->name);
2946- field_names[i][j] = strdup_root(&hash_mem_root,buf);
2947- add_word(&ht,field_names[i][j]);
2948- field_names[i][num_fields+j] = strdup_root(&hash_mem_root,
2949- sql_field->name);
2950- if (!completion_hash_exists(&ht,field_names[i][num_fields+j],
2951- (uint) strlen(field_names[i][num_fields+j])))
2952- add_word(&ht,field_names[i][num_fields+j]);
2953- j++;
2954- }
2955- mysql_free_result(fields);
2956- }
2957- else
2958- field_names[i]= 0;
2959-
2960- i++;
2961- }
2962- mysql_free_result(tables);
2963- field_names[i]=0; // End pointer
2964- DBUG_VOID_RETURN;
2965-}
2966-
2967- /* for gnu readline */
2968-
2969-#ifndef HAVE_INDEX
2970-extern "C" {
2971-extern char *index(const char *,int c),*rindex(const char *,int);
2972-
2973-char *index(const char *s,int c)
2974-{
2975- for (;;)
2976- {
2977- if (*s == (char) c) return (char*) s;
2978- if (!*s++) return NullS;
2979- }
2980-}
2981-
2982-char *rindex(const char *s,int c)
2983-{
2984- reg3 char *t;
2985-
2986- t = NullS;
2987- do if (*s == (char) c) t = (char*) s; while (*s++);
2988- return (char*) t;
2989-}
2990-}
2991-#endif
2992-
2993-/* Add the given line to mysql history. */
2994-static void add_filtered_history(const char *string)
2995-{
2996- if (!check_histignore(string))
2997- add_history(string);
2998-}
2999-
3000-
3001-/**
3002- Perform a check on the given string if it contains
3003- any of the histignore patterns.
3004-
3005- @param string [IN] String that needs to be checked.
3006-
3007- @return Operation status
3008- @retval 0 No match found
3009- @retval 1 Match found
3010-*/
3011-
3012-static
3013-my_bool check_histignore(const char *string)
3014-{
3015- uint i;
3016- int rc;
3017-
3018- LEX_STRING *tmp;
3019-
3020- DBUG_ENTER("check_histignore");
3021-
3022- for (i= 0; i < histignore_patterns.elements; i++)
3023- {
3024- tmp= dynamic_element(&histignore_patterns, i, LEX_STRING *);
3025- if ((rc= charset_info->coll->wildcmp(charset_info,
3026- string, string + strlen(string),
3027- tmp->str, tmp->str + tmp->length,
3028- wild_prefix, wild_one,
3029- wild_many)) == 0)
3030- DBUG_RETURN(1);
3031- }
3032- DBUG_RETURN(0);
3033-}
3034-
3035-
3036-/**
3037- Parse the histignore list into pattern tokens.
3038-
3039- @return Operation status
3040- @retval 0 Success
3041- @retval 1 Failure
3042-*/
3043-
3044-static
3045-my_bool parse_histignore()
3046-{
3047- LEX_STRING pattern;
3048-
3049- char *token;
3050- const char *search= ":";
3051-
3052- DBUG_ENTER("parse_histignore");
3053-
3054- if (init_hist_patterns())
3055- DBUG_RETURN(1);
3056-
3057- token= strtok(histignore_buffer.str, search);
3058-
3059- while(token != NULL)
3060- {
3061- pattern.str= token;
3062- pattern.length= strlen(pattern.str);
3063- insert_dynamic(&histignore_patterns, &pattern);
3064- token= strtok(NULL, search);
3065- }
3066- DBUG_RETURN(0);
3067-}
3068-
3069-static
3070-my_bool init_hist_patterns()
3071-{
3072- return my_init_dynamic_array(&histignore_patterns,
3073- sizeof(LEX_STRING), 50, 50);
3074-}
3075-
3076-static
3077-void free_hist_patterns()
3078-{
3079- delete_dynamic(&histignore_patterns);
3080-}
3081-#endif /* HAVE_READLINE */
3082-
3083-
3084-static int reconnect(void)
3085-{
3086- /* purecov: begin tested */
3087- if (opt_reconnect)
3088- {
3089- put_info("No connection. Trying to reconnect...",INFO_INFO);
3090- (void) com_connect((String *) 0, 0);
3091- if (opt_rehash)
3092- com_rehash(NULL, NULL);
3093- }
3094- if (!connected)
3095- return put_info("Can't connect to the server\n",INFO_ERROR);
3096- /* purecov: end */
3097- return 0;
3098-}
3099-
3100-static void get_current_db()
3101-{
3102- MYSQL_RES *res;
3103-
3104- /* If one_database is set, current_db is not supposed to change. */
3105- if (one_database)
3106- return;
3107-
3108- my_free(current_db);
3109- current_db= NULL;
3110- /* In case of error below current_db will be NULL */
3111- if (!mysql_query(&mysql, "SELECT DATABASE()") &&
3112- (res= mysql_use_result(&mysql)))
3113- {
3114- MYSQL_ROW row= mysql_fetch_row(res);
3115- if (row && row[0])
3116- current_db= my_strdup(row[0], MYF(MY_WME));
3117- mysql_free_result(res);
3118- }
3119-}
3120-
3121-/***************************************************************************
3122- The different commands
3123-***************************************************************************/
3124-
3125-int mysql_real_query_for_lazy(const char *buf, int length)
3126-{
3127- for (uint retry=0;; retry++)
3128- {
3129- int error;
3130- if (!mysql_real_query(&mysql,buf,length))
3131- return 0;
3132- error= put_error(&mysql);
3133- if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1 ||
3134- !opt_reconnect)
3135- return error;
3136- if (reconnect())
3137- return error;
3138- }
3139-}
3140-
3141-int mysql_store_result_for_lazy(MYSQL_RES **result)
3142-{
3143- if ((*result=mysql_store_result(&mysql)))
3144- return 0;
3145-
3146- if (mysql_error(&mysql)[0])
3147- return put_error(&mysql);
3148- return 0;
3149-}
3150-
3151-static void print_help_item(MYSQL_ROW *cur, int num_name, int num_cat, char *last_char)
3152-{
3153- char ccat= (*cur)[num_cat][0];
3154- if (*last_char != ccat)
3155- {
3156- put_info(ccat == 'Y' ? "categories:" : "topics:", INFO_INFO);
3157- *last_char= ccat;
3158- }
3159- tee_fprintf(PAGER, " %s\n", (*cur)[num_name]);
3160-}
3161-
3162-
3163-static int com_server_help(String *buffer __attribute__((unused)),
3164- char *line __attribute__((unused)), char *help_arg)
3165-{
3166- MYSQL_ROW cur;
3167- const char *server_cmd;
3168- char cmd_buf[100 + 1];
3169- MYSQL_RES *result;
3170- int error;
3171-
3172- if (help_arg[0] != '\'')
3173- {
3174- char *end_arg= strend(help_arg);
3175- if(--end_arg)
3176- {
3177- while (my_isspace(charset_info,*end_arg))
3178- end_arg--;
3179- *++end_arg= '\0';
3180- }
3181- (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS);
3182- }
3183- else
3184- (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help ", help_arg, NullS);
3185-
3186- server_cmd= cmd_buf;
3187-
3188- if (!status.batch)
3189- {
3190- old_buffer= *buffer;
3191- old_buffer.copy();
3192- }
3193-
3194- if (!connected && reconnect())
3195- return 1;
3196-
3197- if ((error= mysql_real_query_for_lazy(server_cmd,(int)strlen(server_cmd))) ||
3198- (error= mysql_store_result_for_lazy(&result)))
3199- return error;
3200-
3201- if (result)
3202- {
3203- unsigned int num_fields= mysql_num_fields(result);
3204- my_ulonglong num_rows= mysql_num_rows(result);
3205- mysql_fetch_fields(result);
3206- if (num_fields==3 && num_rows==1)
3207- {
3208- if (!(cur= mysql_fetch_row(result)))
3209- {
3210- error= -1;
3211- goto err;
3212- }
3213-
3214- init_pager();
3215- tee_fprintf(PAGER, "Name: \'%s\'\n", cur[0]);
3216- tee_fprintf(PAGER, "Description:\n%s", cur[1]);
3217- if (cur[2] && *((char*)cur[2]))
3218- tee_fprintf(PAGER, "Examples:\n%s", cur[2]);
3219- tee_fprintf(PAGER, "\n");
3220- end_pager();
3221- }
3222- else if (num_fields >= 2 && num_rows)
3223- {
3224- init_pager();
3225- char last_char= 0;
3226-
3227- int num_name= 0, num_cat= 0;
3228- LINT_INIT(num_name);
3229- LINT_INIT(num_cat);
3230-
3231- if (num_fields == 2)
3232- {
3233- put_info("Many help items for your request exist.", INFO_INFO);
3234- put_info("To make a more specific request, please type 'help <item>',\nwhere <item> is one of the following", INFO_INFO);
3235- num_name= 0;
3236- num_cat= 1;
3237- }
3238- else if ((cur= mysql_fetch_row(result)))
3239- {
3240- tee_fprintf(PAGER, "You asked for help about help category: \"%s\"\n", cur[0]);
3241- put_info("For more information, type 'help <item>', where <item> is one of the following", INFO_INFO);
3242- num_name= 1;
3243- num_cat= 2;
3244- print_help_item(&cur,1,2,&last_char);
3245- }
3246-
3247- while ((cur= mysql_fetch_row(result)))
3248- print_help_item(&cur,num_name,num_cat,&last_char);
3249- tee_fprintf(PAGER, "\n");
3250- end_pager();
3251- }
3252- else
3253- {
3254- put_info("\nNothing found", INFO_INFO);
3255- if (strncasecmp(server_cmd, "help 'contents'", 15) == 0)
3256- {
3257- put_info("\nPlease check if 'help tables' are loaded.\n", INFO_INFO);
3258- goto err;
3259- }
3260- put_info("Please try to run 'help contents' for a list of all accessible topics\n", INFO_INFO);
3261- }
3262- }
3263-
3264-err:
3265- mysql_free_result(result);
3266- return error;
3267-}
3268-
3269-static int
3270-com_help(String *buffer __attribute__((unused)),
3271- char *line __attribute__((unused)))
3272-{
3273- reg1 int i, j;
3274- char * help_arg= strchr(line,' '), buff[32], *end;
3275- if (help_arg)
3276- {
3277- while (my_isspace(charset_info,*help_arg))
3278- help_arg++;
3279- if (*help_arg)
3280- return com_server_help(buffer,line,help_arg);
3281- }
3282-
3283- put_info("\nFor information about MySQL products and services, visit:\n"
3284- " http://www.mysql.com/\n"
3285- "For developer information, including the MySQL Reference Manual, "
3286- "visit:\n"
3287- " http://dev.mysql.com/\n"
3288- "To buy MySQL Enterprise support, training, or other products, visit:\n"
3289- " https://shop.mysql.com/\n", INFO_INFO);
3290- put_info("List of all MySQL commands:", INFO_INFO);
3291- if (!named_cmds)
3292- put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
3293- for (i = 0; commands[i].name; i++)
3294- {
3295- end= strmov(buff, commands[i].name);
3296- for (j= (int)strlen(commands[i].name); j < 10; j++)
3297- end= strmov(end, " ");
3298- if (commands[i].func)
3299- tee_fprintf(stdout, "%s(\\%c) %s\n", buff,
3300- commands[i].cmd_char, commands[i].doc);
3301- }
3302- if (connected && mysql_get_server_version(&mysql) >= 40100)
3303- put_info("\nFor server side help, type 'help contents'\n", INFO_INFO);
3304- return 0;
3305-}
3306-
3307-
3308- /* ARGSUSED */
3309-static int
3310-com_clear(String *buffer,char *line __attribute__((unused)))
3311-{
3312-#ifdef HAVE_READLINE
3313- if (status.add_to_history)
3314- fix_history(buffer);
3315-#endif
3316- buffer->length(0);
3317- return 0;
3318-}
3319-
3320- /* ARGSUSED */
3321-static int
3322-com_charset(String *buffer __attribute__((unused)), char *line)
3323-{
3324- char buff[256], *param;
3325- const CHARSET_INFO *new_cs;
3326- strmake(buff, line, sizeof(buff) - 1);
3327- param= get_arg(buff, 0);
3328- if (!param || !*param)
3329- {
3330- return put_info("Usage: \\C charset_name | charset charset_name",
3331- INFO_ERROR, 0);
3332- }
3333- new_cs= get_charset_by_csname(param, MY_CS_PRIMARY, MYF(MY_WME));
3334- if (new_cs)
3335- {
3336- charset_info= new_cs;
3337- mysql_set_character_set(&mysql, charset_info->csname);
3338- default_charset= (char *)charset_info->csname;
3339- put_info("Charset changed", INFO_INFO);
3340- }
3341- else put_info("Charset is not found", INFO_INFO);
3342- return 0;
3343-}
3344-
3345-/*
3346- Execute command
3347- Returns: 0 if ok
3348- -1 if not fatal error
3349- 1 if fatal error
3350-*/
3351-
3352-
3353-static int
3354-com_go(String *buffer,char *line __attribute__((unused)))
3355-{
3356- char buff[200]; /* about 110 chars used so far */
3357- char time_buff[52+3+1]; /* time max + space&parens + NUL */
3358- MYSQL_RES *result;
3359- ulong timer, warnings= 0;
3360- uint error= 0;
3361- int err= 0;
3362-
3363- interrupted_query= 0;
3364- if (!status.batch)
3365- {
3366- old_buffer= *buffer; // Save for edit command
3367- old_buffer.copy();
3368- }
3369-
3370- /* Remove garbage for nicer messages */
3371- LINT_INIT(buff[0]);
3372- remove_cntrl(*buffer);
3373-
3374- if (buffer->is_empty())
3375- {
3376- if (status.batch) // Ignore empty quries
3377- return 0;
3378- return put_info("No query specified\n",INFO_ERROR);
3379-
3380- }
3381- if (!connected && reconnect())
3382- {
3383- buffer->length(0); // Remove query on error
3384- return opt_reconnect ? -1 : 1; // Fatal error
3385- }
3386- if (verbose)
3387- (void) com_print(buffer,0);
3388-
3389- if (skip_updates &&
3390- (buffer->length() < 4 || my_strnncoll(charset_info,
3391- (const uchar*)buffer->ptr(),4,
3392- (const uchar*)"SET ",4)))
3393- {
3394- (void) put_info("Ignoring query to other database",INFO_INFO);
3395- return 0;
3396- }
3397-
3398- timer=start_timer();
3399- executing_query= 1;
3400- error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length());
3401-
3402-#ifdef HAVE_READLINE
3403- if (status.add_to_history)
3404- {
3405- buffer->append(vertical ? "\\G" : delimiter);
3406- /* Append final command onto history */
3407- fix_history(buffer);
3408- }
3409-#endif
3410-
3411- buffer->length(0);
3412-
3413- if (error)
3414- goto end;
3415-
3416- do
3417- {
3418- char *pos;
3419- bool batchmode= (status.batch && verbose <= 1) ? TRUE : FALSE;
3420- buff[0]= 0;
3421-
3422- if (quick)
3423- {
3424- if (!(result=mysql_use_result(&mysql)) && mysql_field_count(&mysql))
3425- {
3426- error= put_error(&mysql);
3427- goto end;
3428- }
3429- }
3430- else
3431- {
3432- error= mysql_store_result_for_lazy(&result);
3433- if (error)
3434- goto end;
3435- }
3436-
3437- if (verbose >= 3 || !opt_silent)
3438- mysql_end_timer(timer,time_buff);
3439- else
3440- time_buff[0]= '\0';
3441-
3442- /* Every branch must truncate buff . */
3443- if (result)
3444- {
3445- if (!mysql_num_rows(result) && ! quick && !column_types_flag)
3446- {
3447- strmov(buff, "Empty set");
3448- if (opt_xml)
3449- {
3450- /*
3451- We must print XML header and footer
3452- to produce a well-formed XML even if
3453- the result set is empty (Bug#27608).
3454- */
3455- init_pager();
3456- print_table_data_xml(result);
3457- end_pager();
3458- }
3459- }
3460- else
3461- {
3462- init_pager();
3463- if (opt_html)
3464- print_table_data_html(result);
3465- else if (opt_xml)
3466- print_table_data_xml(result);
3467- else if (vertical || (auto_vertical_output && (terminal_width < get_result_width(result))))
3468- print_table_data_vertically(result);
3469- else if (opt_silent && verbose <= 2 && !output_tables)
3470- print_tab_data(result);
3471- else
3472- print_table_data(result);
3473- if( !batchmode )
3474- sprintf(buff,"%lld %s in set",
3475- mysql_num_rows(result),
3476- mysql_num_rows(result) == 1LL ? "row" : "rows");
3477- end_pager();
3478- if (mysql_errno(&mysql))
3479- error= put_error(&mysql);
3480- }
3481- }
3482- else if (mysql_affected_rows(&mysql) == ~(ulonglong) 0)
3483- strmov(buff,"Query OK");
3484- else if( !batchmode )
3485- sprintf(buff,"Query OK, %lld %s affected",
3486- mysql_affected_rows(&mysql),
3487- mysql_affected_rows(&mysql) == 1LL ? "row" : "rows");
3488-
3489- pos=strend(buff);
3490- if ((warnings= mysql_warning_count(&mysql)) && !batchmode)
3491- {
3492- *pos++= ',';
3493- *pos++= ' ';
3494- pos=int10_to_str(warnings, pos, 10);
3495- pos=strmov(pos, " warning");
3496- if (warnings != 1)
3497- *pos++= 's';
3498- }
3499- strmov(pos, time_buff);
3500- put_info(buff,INFO_RESULT);
3501- if (mysql_info(&mysql))
3502- put_info(mysql_info(&mysql),INFO_RESULT);
3503- put_info("",INFO_RESULT); // Empty row
3504-
3505- if (result && !mysql_eof(result)) /* Something wrong when using quick */
3506- error= put_error(&mysql);
3507- else if (unbuffered)
3508- fflush(stdout);
3509- mysql_free_result(result);
3510- } while (!(err= mysql_next_result(&mysql)));
3511- if (err >= 1)
3512- error= put_error(&mysql);
3513-
3514-end:
3515-
3516- /* Show warnings if any or error occured */
3517- if (show_warnings == 1 && (warnings >= 1 || error))
3518- print_warnings();
3519-
3520- if (!error && !status.batch &&
3521- (mysql.server_status & SERVER_STATUS_DB_DROPPED))
3522- get_current_db();
3523-
3524- executing_query= 0;
3525- return error; /* New command follows */
3526-}
3527-
3528-
3529-static void init_pager()
3530-{
3531-#ifdef USE_POPEN
3532- if (!opt_nopager)
3533- {
3534- if (!(PAGER= popen(pager, "w")))
3535- {
3536- tee_fprintf(stdout, "popen() failed! defaulting PAGER to stdout!\n");
3537- PAGER= stdout;
3538- }
3539- }
3540- else
3541-#endif
3542- PAGER= stdout;
3543-}
3544-
3545-static void end_pager()
3546-{
3547-#ifdef USE_POPEN
3548- if (!opt_nopager)
3549- pclose(PAGER);
3550-#endif
3551-}
3552-
3553-
3554-static void init_tee(const char *file_name)
3555-{
3556- FILE* new_outfile;
3557- if (opt_outfile)
3558- end_tee();
3559- if (!(new_outfile= my_fopen(file_name, O_APPEND | O_WRONLY, MYF(MY_WME))))
3560- {
3561- tee_fprintf(stdout, "Error logging to file '%s'\n", file_name);
3562- return;
3563- }
3564- OUTFILE = new_outfile;
3565- strmake(outfile, file_name, FN_REFLEN-1);
3566- tee_fprintf(stdout, "Logging to file '%s'\n", file_name);
3567- opt_outfile= 1;
3568- return;
3569-}
3570-
3571-
3572-static void end_tee()
3573-{
3574- my_fclose(OUTFILE, MYF(0));
3575- OUTFILE= 0;
3576- opt_outfile= 0;
3577- return;
3578-}
3579-
3580-
3581-static int
3582-com_ego(String *buffer,char *line)
3583-{
3584- int result;
3585- bool oldvertical=vertical;
3586- vertical=1;
3587- result=com_go(buffer,line);
3588- vertical=oldvertical;
3589- return result;
3590-}
3591-
3592-
3593-static const char *fieldtype2str(enum enum_field_types type)
3594-{
3595- switch (type) {
3596- case MYSQL_TYPE_BIT: return "BIT";
3597- case MYSQL_TYPE_BLOB: return "BLOB";
3598- case MYSQL_TYPE_DATE: return "DATE";
3599- case MYSQL_TYPE_DATETIME: return "DATETIME";
3600- case MYSQL_TYPE_NEWDECIMAL: return "NEWDECIMAL";
3601- case MYSQL_TYPE_DECIMAL: return "DECIMAL";
3602- case MYSQL_TYPE_DOUBLE: return "DOUBLE";
3603- case MYSQL_TYPE_ENUM: return "ENUM";
3604- case MYSQL_TYPE_FLOAT: return "FLOAT";
3605- case MYSQL_TYPE_GEOMETRY: return "GEOMETRY";
3606- case MYSQL_TYPE_INT24: return "INT24";
3607- case MYSQL_TYPE_LONG: return "LONG";
3608- case MYSQL_TYPE_LONGLONG: return "LONGLONG";
3609- case MYSQL_TYPE_LONG_BLOB: return "LONG_BLOB";
3610- case MYSQL_TYPE_MEDIUM_BLOB: return "MEDIUM_BLOB";
3611- case MYSQL_TYPE_NEWDATE: return "NEWDATE";
3612- case MYSQL_TYPE_NULL: return "NULL";
3613- case MYSQL_TYPE_SET: return "SET";
3614- case MYSQL_TYPE_SHORT: return "SHORT";
3615- case MYSQL_TYPE_STRING: return "STRING";
3616- case MYSQL_TYPE_TIME: return "TIME";
3617- case MYSQL_TYPE_TIMESTAMP: return "TIMESTAMP";
3618- case MYSQL_TYPE_TINY: return "TINY";
3619- case MYSQL_TYPE_TINY_BLOB: return "TINY_BLOB";
3620- case MYSQL_TYPE_VAR_STRING: return "VAR_STRING";
3621- case MYSQL_TYPE_YEAR: return "YEAR";
3622- default: return "?-unknown-?";
3623- }
3624-}
3625-
3626-static char *fieldflags2str(uint f) {
3627- static char buf[1024];
3628- char *s=buf;
3629- *s=0;
3630-#define ff2s_check_flag(X) \
3631- if (f & X ## _FLAG) { s=strmov(s, # X " "); f &= ~ X ## _FLAG; }
3632- ff2s_check_flag(NOT_NULL);
3633- ff2s_check_flag(PRI_KEY);
3634- ff2s_check_flag(UNIQUE_KEY);
3635- ff2s_check_flag(MULTIPLE_KEY);
3636- ff2s_check_flag(BLOB);
3637- ff2s_check_flag(UNSIGNED);
3638- ff2s_check_flag(ZEROFILL);
3639- ff2s_check_flag(BINARY);
3640- ff2s_check_flag(ENUM);
3641- ff2s_check_flag(AUTO_INCREMENT);
3642- ff2s_check_flag(TIMESTAMP);
3643- ff2s_check_flag(SET);
3644- ff2s_check_flag(NO_DEFAULT_VALUE);
3645- ff2s_check_flag(NUM);
3646- ff2s_check_flag(PART_KEY);
3647- ff2s_check_flag(GROUP);
3648- ff2s_check_flag(UNIQUE);
3649- ff2s_check_flag(BINCMP);
3650- ff2s_check_flag(ON_UPDATE_NOW);
3651-#undef ff2s_check_flag
3652- if (f)
3653- sprintf(s, " unknows=0x%04x", f);
3654- return buf;
3655-}
3656-
3657-static void
3658-print_field_types(MYSQL_RES *result)
3659-{
3660- MYSQL_FIELD *field;
3661- uint i=0;
3662-
3663- while ((field = mysql_fetch_field(result)))
3664- {
3665- tee_fprintf(PAGER, "Field %3u: `%s`\n"
3666- "Catalog: `%s`\n"
3667- "Database: `%s`\n"
3668- "Table: `%s`\n"
3669- "Org_table: `%s`\n"
3670- "Type: %s\n"
3671- "Collation: %s (%u)\n"
3672- "Length: %lu\n"
3673- "Max_length: %lu\n"
3674- "Decimals: %u\n"
3675- "Flags: %s\n\n",
3676- ++i,
3677- field->name, field->catalog, field->db, field->table,
3678- field->org_table, fieldtype2str(field->type),
3679- get_charset_name(field->charsetnr), field->charsetnr,
3680- field->length, field->max_length, field->decimals,
3681- fieldflags2str(field->flags));
3682- }
3683- tee_puts("", PAGER);
3684-}
3685-
3686-
3687-static void
3688-print_table_data(MYSQL_RES *result)
3689-{
3690- String separator(256);
3691- MYSQL_ROW cur;
3692- MYSQL_FIELD *field;
3693- bool *num_flag;
3694- size_t sz;
3695-
3696- sz= sizeof(bool) * mysql_num_fields(result);
3697- num_flag= (bool *) my_safe_alloca(sz, MAX_ALLOCA_SIZE);
3698- if (column_types_flag)
3699- {
3700- print_field_types(result);
3701- if (!mysql_num_rows(result))
3702- return;
3703- mysql_field_seek(result,0);
3704- }
3705- separator.copy("+",1,charset_info);
3706- while ((field = mysql_fetch_field(result)))
3707- {
3708- uint length= column_names ? field->name_length : 0;
3709- if (quick)
3710- length= max<size_t>(length, field->length);
3711- else
3712- length= max<size_t>(length, field->max_length);
3713- if (length < 4 && !IS_NOT_NULL(field->flags))
3714- length=4; // Room for "NULL"
3715- field->max_length=length;
3716- separator.fill(separator.length()+length+2,'-');
3717- separator.append('+');
3718- }
3719- separator.append('\0'); // End marker for \0
3720- tee_puts((char*) separator.ptr(), PAGER);
3721- if (column_names)
3722- {
3723- mysql_field_seek(result,0);
3724- (void) tee_fputs("|", PAGER);
3725- for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
3726- {
3727- uint name_length= (uint) strlen(field->name);
3728- uint numcells= charset_info->cset->numcells(charset_info,
3729- field->name,
3730- field->name + name_length);
3731- uint display_length= field->max_length + name_length - numcells;
3732- tee_fprintf(PAGER, " %-*s |",
3733- min<int>(display_length, MAX_COLUMN_LENGTH),
3734- field->name);
3735- num_flag[off]= IS_NUM(field->type);
3736- }
3737- (void) tee_fputs("\n", PAGER);
3738- tee_puts((char*) separator.ptr(), PAGER);
3739- }
3740-
3741- while ((cur= mysql_fetch_row(result)))
3742- {
3743- if (interrupted_query)
3744- break;
3745- ulong *lengths= mysql_fetch_lengths(result);
3746- (void) tee_fputs("| ", PAGER);
3747- mysql_field_seek(result, 0);
3748- for (uint off= 0; off < mysql_num_fields(result); off++)
3749- {
3750- const char *buffer;
3751- uint data_length;
3752- uint field_max_length;
3753- uint visible_length;
3754- uint extra_padding;
3755-
3756- if (off)
3757- (void) tee_fputs(" ", PAGER);
3758-
3759- if (cur[off] == NULL)
3760- {
3761- buffer= "NULL";
3762- data_length= 4;
3763- }
3764- else
3765- {
3766- buffer= cur[off];
3767- data_length= (uint) lengths[off];
3768- }
3769-
3770- field= mysql_fetch_field(result);
3771- field_max_length= field->max_length;
3772-
3773- /*
3774- How many text cells on the screen will this string span? If it contains
3775- multibyte characters, then the number of characters we occupy on screen
3776- will be fewer than the number of bytes we occupy in memory.
3777-
3778- We need to find how much screen real-estate we will occupy to know how
3779- many extra padding-characters we should send with the printing function.
3780- */
3781- visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
3782- extra_padding= data_length - visible_length;
3783-
3784- if (field_max_length > MAX_COLUMN_LENGTH)
3785- tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE);
3786- else
3787- {
3788- if (num_flag[off] != 0) /* if it is numeric, we right-justify it */
3789- tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, TRUE);
3790- else
3791- tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, FALSE);
3792- }
3793- tee_fputs(" |", PAGER);
3794- }
3795- (void) tee_fputs("\n", PAGER);
3796- }
3797- tee_puts((char*) separator.ptr(), PAGER);
3798- my_safe_afree((bool *) num_flag, sz, MAX_ALLOCA_SIZE);
3799-}
3800-
3801-/**
3802- Return the length of a field after it would be rendered into text.
3803-
3804- This doesn't know or care about multibyte characters. Assume we're
3805- using such a charset. We can't know that all of the upcoming rows
3806- for this column will have bytes that each render into some fraction
3807- of a character. It's at least possible that a row has bytes that
3808- all render into one character each, and so the maximum length is
3809- still the number of bytes. (Assumption 1: This can't be better
3810- because we can never know the number of characters that the DB is
3811- going to send -- only the number of bytes. 2: Chars <= Bytes.)
3812-
3813- @param field Pointer to a field to be inspected
3814-
3815- @returns number of character positions to be used, at most
3816-*/
3817-static int get_field_disp_length(MYSQL_FIELD *field)
3818-{
3819- uint length= column_names ? field->name_length : 0;
3820-
3821- if (quick)
3822- length= max<uint>(length, field->length);
3823- else
3824- length= max<uint>(length, field->max_length);
3825-
3826- if (length < 4 && !IS_NOT_NULL(field->flags))
3827- length= 4; /* Room for "NULL" */
3828-
3829- return length;
3830-}
3831-
3832-/**
3833- For a new result, return the max number of characters that any
3834- upcoming row may return.
3835-
3836- @param result Pointer to the result to judge
3837-
3838- @returns The max number of characters in any row of this result
3839-*/
3840-static int get_result_width(MYSQL_RES *result)
3841-{
3842- unsigned int len= 0;
3843- MYSQL_FIELD *field;
3844- MYSQL_FIELD_OFFSET offset;
3845-
3846-#ifndef DBUG_OFF
3847- offset= mysql_field_tell(result);
3848- DBUG_ASSERT(offset == 0);
3849-#else
3850- offset= 0;
3851-#endif
3852-
3853- while ((field= mysql_fetch_field(result)) != NULL)
3854- len+= get_field_disp_length(field) + 3; /* plus bar, space, & final space */
3855-
3856- (void) mysql_field_seek(result, offset);
3857-
3858- return len + 1; /* plus final bar. */
3859-}
3860-
3861-static void
3862-tee_print_sized_data(const char *data, unsigned int data_length, unsigned int total_bytes_to_send, bool right_justified)
3863-{
3864- /*
3865- For '\0's print ASCII spaces instead, as '\0' is eaten by (at
3866- least my) console driver, and that messes up the pretty table
3867- grid. (The \0 is also the reason we can't use fprintf() .)
3868- */
3869- unsigned int i;
3870-
3871- if (right_justified)
3872- for (i= data_length; i < total_bytes_to_send; i++)
3873- tee_putc((int)' ', PAGER);
3874-
3875- tee_write(PAGER, data, data_length, MY_PRINT_SPS_0 | MY_PRINT_MB);
3876-
3877- if (! right_justified)
3878- for (i= data_length; i < total_bytes_to_send; i++)
3879- tee_putc((int)' ', PAGER);
3880-}
3881-
3882-
3883-
3884-static void
3885-print_table_data_html(MYSQL_RES *result)
3886-{
3887- MYSQL_ROW cur;
3888- MYSQL_FIELD *field;
3889-
3890- mysql_field_seek(result,0);
3891- (void) tee_fputs("<TABLE BORDER=1><TR>", PAGER);
3892- if (column_names)
3893- {
3894- while((field = mysql_fetch_field(result)))
3895- {
3896- tee_fputs("<TH>", PAGER);
3897- if (field->name && field->name[0])
3898- xmlencode_print(field->name, field->name_length);
3899- else
3900- tee_fputs(field->name ? " &nbsp; " : "NULL", PAGER);
3901- tee_fputs("</TH>", PAGER);
3902- }
3903- (void) tee_fputs("</TR>", PAGER);
3904- }
3905- while ((cur = mysql_fetch_row(result)))
3906- {
3907- if (interrupted_query)
3908- break;
3909- ulong *lengths=mysql_fetch_lengths(result);
3910- (void) tee_fputs("<TR>", PAGER);
3911- for (uint i=0; i < mysql_num_fields(result); i++)
3912- {
3913- (void) tee_fputs("<TD>", PAGER);
3914- xmlencode_print(cur[i], lengths[i]);
3915- (void) tee_fputs("</TD>", PAGER);
3916- }
3917- (void) tee_fputs("</TR>", PAGER);
3918- }
3919- (void) tee_fputs("</TABLE>", PAGER);
3920-}
3921-
3922-
3923-static void
3924-print_table_data_xml(MYSQL_RES *result)
3925-{
3926- MYSQL_ROW cur;
3927- MYSQL_FIELD *fields;
3928-
3929- mysql_field_seek(result,0);
3930-
3931- tee_fputs("<?xml version=\"1.0\"?>\n\n<resultset statement=\"", PAGER);
3932- xmlencode_print(glob_buffer.ptr(), (int)strlen(glob_buffer.ptr()));
3933- tee_fputs("\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">",
3934- PAGER);
3935-
3936- fields = mysql_fetch_fields(result);
3937- while ((cur = mysql_fetch_row(result)))
3938- {
3939- if (interrupted_query)
3940- break;
3941- ulong *lengths=mysql_fetch_lengths(result);
3942- (void) tee_fputs("\n <row>\n", PAGER);
3943- for (uint i=0; i < mysql_num_fields(result); i++)
3944- {
3945- tee_fprintf(PAGER, "\t<field name=\"");
3946- xmlencode_print(fields[i].name, (uint) strlen(fields[i].name));
3947- if (cur[i])
3948- {
3949- tee_fprintf(PAGER, "\">");
3950- xmlencode_print(cur[i], lengths[i]);
3951- tee_fprintf(PAGER, "</field>\n");
3952- }
3953- else
3954- tee_fprintf(PAGER, "\" xsi:nil=\"true\" />\n");
3955- }
3956- (void) tee_fputs(" </row>\n", PAGER);
3957- }
3958- (void) tee_fputs("</resultset>\n", PAGER);
3959-}
3960-
3961-
3962-static void
3963-print_table_data_vertically(MYSQL_RES *result)
3964-{
3965- MYSQL_ROW cur;
3966- uint max_length=0;
3967- MYSQL_FIELD *field;
3968-
3969- while ((field = mysql_fetch_field(result)))
3970- {
3971- uint length= field->name_length;
3972- if (length > max_length)
3973- max_length= length;
3974- field->max_length=length;
3975- }
3976-
3977- mysql_field_seek(result,0);
3978- for (uint row_count=1; (cur= mysql_fetch_row(result)); row_count++)
3979- {
3980- if (interrupted_query)
3981- break;
3982- mysql_field_seek(result,0);
3983- tee_fprintf(PAGER,
3984- "*************************** %d. row ***************************\n", row_count);
3985-
3986- ulong *lengths= mysql_fetch_lengths(result);
3987-
3988- for (uint off=0; off < mysql_num_fields(result); off++)
3989- {
3990- field= mysql_fetch_field(result);
3991- if (column_names)
3992- tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
3993- if (cur[off])
3994- {
3995- tee_write(PAGER, cur[off], lengths[off], MY_PRINT_SPS_0 | MY_PRINT_MB);
3996- tee_putc('\n', PAGER);
3997- }
3998- else
3999- tee_fprintf(PAGER, "NULL\n");
4000- }
4001- }
4002-}
4003-
4004-
4005-/* print_warnings should be called right after executing a statement */
4006-
4007-static void print_warnings()
4008-{
4009- const char *query;
4010- MYSQL_RES *result;
4011- MYSQL_ROW cur;
4012- my_ulonglong num_rows;
4013-
4014- /* Save current error before calling "show warnings" */
4015- uint error= mysql_errno(&mysql);
4016-
4017- /* Get the warnings */
4018- query= "show warnings";
4019- mysql_real_query_for_lazy(query, strlen(query));
4020- mysql_store_result_for_lazy(&result);
4021-
4022- /* Bail out when no warnings */
4023- if (!result || !(num_rows= mysql_num_rows(result)))
4024- goto end;
4025-
4026- cur= mysql_fetch_row(result);
4027-
4028- /*
4029- Don't print a duplicate of the current error. It is possible for SHOW
4030- WARNINGS to return multiple errors with the same code, but different
4031- messages. To be safe, skip printing the duplicate only if it is the only
4032- warning.
4033- */
4034- if (!cur || (num_rows == 1 && error == (uint) strtoul(cur[1], NULL, 10)))
4035- goto end;
4036-
4037- /* Print the warnings */
4038- init_pager();
4039- do
4040- {
4041- tee_fprintf(PAGER, "%s (Code %s): %s\n", cur[0], cur[1], cur[2]);
4042- } while ((cur= mysql_fetch_row(result)));
4043- end_pager();
4044-
4045-end:
4046- mysql_free_result(result);
4047-}
4048-
4049-
4050-static const char *array_value(const char **array, char key)
4051-{
4052- for (; *array; array+= 2)
4053- if (**array == key)
4054- return array[1];
4055- return 0;
4056-}
4057-
4058-
4059-static void
4060-xmlencode_print(const char *src, uint length)
4061-{
4062- if (!src)
4063- tee_fputs("NULL", PAGER);
4064- else
4065- tee_write(PAGER, src, length, MY_PRINT_XML | MY_PRINT_MB);
4066-}
4067-
4068-
4069-static void
4070-safe_put_field(const char *pos,ulong length)
4071-{
4072- if (!pos)
4073- tee_fputs("NULL", PAGER);
4074- else
4075- {
4076- int flags= MY_PRINT_MB | (opt_raw_data ? 0 : (MY_PRINT_ESC_0 | MY_PRINT_CTRL));
4077- /* Can't use tee_fputs(), it stops with NUL characters. */
4078- tee_write(PAGER, pos, length, flags);
4079- }
4080-}
4081-
4082-
4083-static void
4084-print_tab_data(MYSQL_RES *result)
4085-{
4086- MYSQL_ROW cur;
4087- MYSQL_FIELD *field;
4088- ulong *lengths;
4089-
4090- if (opt_silent < 2 && column_names)
4091- {
4092- int first=0;
4093- while ((field = mysql_fetch_field(result)))
4094- {
4095- if (first++)
4096- (void) tee_fputs("\t", PAGER);
4097- (void) tee_fputs(field->name, PAGER);
4098- }
4099- (void) tee_fputs("\n", PAGER);
4100- }
4101- while ((cur = mysql_fetch_row(result)))
4102- {
4103- lengths=mysql_fetch_lengths(result);
4104- safe_put_field(cur[0],lengths[0]);
4105- for (uint off=1 ; off < mysql_num_fields(result); off++)
4106- {
4107- (void) tee_fputs("\t", PAGER);
4108- safe_put_field(cur[off], lengths[off]);
4109- }
4110- (void) tee_fputs("\n", PAGER);
4111- }
4112-}
4113-
4114-static int
4115-com_tee(String *buffer __attribute__((unused)),
4116- char *line __attribute__((unused)))
4117-{
4118- char file_name[FN_REFLEN], *end, *param;
4119-
4120- while (my_isspace(charset_info,*line))
4121- line++;
4122- if (!(param = strchr(line, ' '))) // if outfile wasn't given, use the default
4123- {
4124- if (!strlen(outfile))
4125- {
4126- printf("No previous outfile available, you must give a filename!\n");
4127- return 0;
4128- }
4129- else if (opt_outfile)
4130- {
4131- tee_fprintf(stdout, "Currently logging to file '%s'\n", outfile);
4132- return 0;
4133- }
4134- else
4135- param = outfile; //resume using the old outfile
4136- }
4137-
4138- /* eliminate the spaces before the parameters */
4139- while (my_isspace(charset_info,*param))
4140- param++;
4141- end= strmake(file_name, param, sizeof(file_name) - 1);
4142- /* remove end space from command line */
4143- while (end > file_name && (my_isspace(charset_info,end[-1]) ||
4144- my_iscntrl(charset_info,end[-1])))
4145- end--;
4146- end[0]= 0;
4147- if (end == file_name)
4148- {
4149- printf("No outfile specified!\n");
4150- return 0;
4151- }
4152- init_tee(file_name);
4153- return 0;
4154-}
4155-
4156-
4157-static int
4158-com_notee(String *buffer __attribute__((unused)),
4159- char *line __attribute__((unused)))
4160-{
4161- if (opt_outfile)
4162- end_tee();
4163- tee_fprintf(stdout, "Outfile disabled.\n");
4164- return 0;
4165-}
4166-
4167-/*
4168- Sorry, this command is not available in Windows.
4169-*/
4170-
4171-#ifdef USE_POPEN
4172-static int
4173-com_pager(String *buffer __attribute__((unused)),
4174- char *line __attribute__((unused)))
4175-{
4176- char pager_name[FN_REFLEN], *end, *param;
4177-
4178- if (status.batch)
4179- return 0;
4180- /* Skip spaces in front of the pager command */
4181- while (my_isspace(charset_info, *line))
4182- line++;
4183- /* Skip the pager command */
4184- param= strchr(line, ' ');
4185- /* Skip the spaces between the command and the argument */
4186- while (param && my_isspace(charset_info, *param))
4187- param++;
4188- if (!param || !strlen(param)) // if pager was not given, use the default
4189- {
4190- if (!default_pager_set)
4191- {
4192- tee_fprintf(stdout, "Default pager wasn't set, using stdout.\n");
4193- opt_nopager=1;
4194- strmov(pager, "stdout");
4195- PAGER= stdout;
4196- return 0;
4197- }
4198- strmov(pager, default_pager);
4199- }
4200- else
4201- {
4202- end= strmake(pager_name, param, sizeof(pager_name)-1);
4203- while (end > pager_name && (my_isspace(charset_info,end[-1]) ||
4204- my_iscntrl(charset_info,end[-1])))
4205- end--;
4206- end[0]=0;
4207- strmov(pager, pager_name);
4208- strmov(default_pager, pager_name);
4209- }
4210- opt_nopager=0;
4211- tee_fprintf(stdout, "PAGER set to '%s'\n", pager);
4212- return 0;
4213-}
4214-
4215-
4216-static int
4217-com_nopager(String *buffer __attribute__((unused)),
4218- char *line __attribute__((unused)))
4219-{
4220- strmov(pager, "stdout");
4221- opt_nopager=1;
4222- PAGER= stdout;
4223- tee_fprintf(stdout, "PAGER set to stdout\n");
4224- return 0;
4225-}
4226-#endif
4227-
4228-
4229-/*
4230- Sorry, you can't send the result to an editor in Win32
4231-*/
4232-
4233-#ifdef USE_POPEN
4234-static int
4235-com_edit(String *buffer,char *line __attribute__((unused)))
4236-{
4237- char filename[FN_REFLEN],buff[160];
4238- int fd,tmp;
4239- const char *editor;
4240-
4241- if ((fd=create_temp_file(filename,NullS,"sql", O_CREAT | O_WRONLY,
4242- MYF(MY_WME))) < 0)
4243- goto err;
4244- if (buffer->is_empty() && !old_buffer.is_empty())
4245- (void) my_write(fd,(uchar*) old_buffer.ptr(),old_buffer.length(),
4246- MYF(MY_WME));
4247- else
4248- (void) my_write(fd,(uchar*) buffer->ptr(),buffer->length(),MYF(MY_WME));
4249- (void) my_close(fd,MYF(0));
4250-
4251- if (!(editor = (char *)getenv("EDITOR")) &&
4252- !(editor = (char *)getenv("VISUAL")))
4253- editor = "vi";
4254- strxmov(buff,editor," ",filename,NullS);
4255- if(system(buff) == -1)
4256- goto err;
4257-
4258- MY_STAT stat_arg;
4259- if (!my_stat(filename,&stat_arg,MYF(MY_WME)))
4260- goto err;
4261- if ((fd = my_open(filename,O_RDONLY, MYF(MY_WME))) < 0)
4262- goto err;
4263- (void) buffer->alloc((uint) stat_arg.st_size);
4264- if ((tmp=read(fd,(char*) buffer->ptr(),buffer->alloced_length())) >= 0L)
4265- buffer->length((uint) tmp);
4266- else
4267- buffer->length(0);
4268- (void) my_close(fd,MYF(0));
4269- (void) my_delete(filename,MYF(MY_WME));
4270-err:
4271- return 0;
4272-}
4273-#endif
4274-
4275-
4276-/* If arg is given, exit without errors. This happens on command 'quit' */
4277-
4278-static int
4279-com_quit(String *buffer __attribute__((unused)),
4280- char *line __attribute__((unused)))
4281-{
4282- status.exit_status=0;
4283- return 1;
4284-}
4285-
4286-static int
4287-com_rehash(String *buffer __attribute__((unused)),
4288- char *line __attribute__((unused)))
4289-{
4290-#ifdef HAVE_READLINE
4291- build_completion_hash(1, 0);
4292-#endif
4293- return 0;
4294-}
4295-
4296-
4297-#ifdef USE_POPEN
4298-static int
4299-com_shell(String *buffer __attribute__((unused)),
4300- char *line __attribute__((unused)))
4301-{
4302- char *shell_cmd;
4303-
4304- /* Skip space from line begin */
4305- while (my_isspace(charset_info, *line))
4306- line++;
4307- if (!(shell_cmd = strchr(line, ' ')))
4308- {
4309- put_info("Usage: \\! shell-command", INFO_ERROR);
4310- return -1;
4311- }
4312- /*
4313- The output of the shell command does not
4314- get directed to the pager or the outfile
4315- */
4316- if (system(shell_cmd) == -1)
4317- {
4318- put_info(strerror(errno), INFO_ERROR, errno);
4319- return -1;
4320- }
4321- return 0;
4322-}
4323-#endif
4324-
4325-
4326-static int
4327-com_print(String *buffer,char *line __attribute__((unused)))
4328-{
4329- tee_puts("--------------", stdout);
4330- (void) tee_fputs(buffer->c_ptr(), stdout);
4331- if (!buffer->length() || (*buffer)[buffer->length()-1] != '\n')
4332- tee_putc('\n', stdout);
4333- tee_puts("--------------\n", stdout);
4334- return 0; /* If empty buffer */
4335-}
4336-
4337- /* ARGSUSED */
4338-static int
4339-com_connect(String *buffer, char *line)
4340-{
4341- char *tmp, buff[256];
4342- bool save_rehash= opt_rehash;
4343- int error;
4344-
4345- memset(buff, 0, sizeof(buff));
4346- if (buffer)
4347- {
4348- /*
4349- Two null bytes are needed in the end of buff to allow
4350- get_arg to find end of string the second time it's called.
4351- */
4352- tmp= strmake(buff, line, sizeof(buff)-2);
4353-#ifdef EXTRA_DEBUG
4354- tmp[1]= 0;
4355-#endif
4356- tmp= get_arg(buff, 0);
4357- if (tmp && *tmp)
4358- {
4359- my_free(current_db);
4360- current_db= my_strdup(tmp, MYF(MY_WME));
4361- tmp= get_arg(buff, 1);
4362- if (tmp)
4363- {
4364- my_free(current_host);
4365- current_host=my_strdup(tmp,MYF(MY_WME));
4366- }
4367- }
4368- else
4369- {
4370- /* Quick re-connect */
4371- opt_rehash= 0; /* purecov: tested */
4372- }
4373- buffer->length(0); // command used
4374- }
4375- else
4376- opt_rehash= 0;
4377- error=sql_connect(current_host,current_db,current_user,opt_password,0);
4378- opt_rehash= save_rehash;
4379-
4380- if (connected)
4381- {
4382- sprintf(buff,"Connection id: %lu",mysql_thread_id(&mysql));
4383- put_info(buff,INFO_INFO);
4384- sprintf(buff,"Current database: %.128s\n",
4385- current_db ? current_db : "*** NONE ***");
4386- put_info(buff,INFO_INFO);
4387- }
4388- return error;
4389-}
4390-
4391-
4392-static int com_source(String *buffer __attribute__((unused)),
4393- char *line)
4394-{
4395- char source_name[FN_REFLEN], *end, *param;
4396- LINE_BUFFER *line_buff;
4397- int error;
4398- STATUS old_status;
4399- FILE *sql_file;
4400-
4401- /* Skip space from file name */
4402- while (my_isspace(charset_info,*line))
4403- line++;
4404- if (!(param = strchr(line, ' '))) // Skip command name
4405- return put_info("Usage: \\. <filename> | source <filename>",
4406- INFO_ERROR, 0);
4407- while (my_isspace(charset_info,*param))
4408- param++;
4409- end=strmake(source_name,param,sizeof(source_name)-1);
4410- while (end > source_name && (my_isspace(charset_info,end[-1]) ||
4411- my_iscntrl(charset_info,end[-1])))
4412- end--;
4413- end[0]=0;
4414- unpack_filename(source_name,source_name);
4415- /* open file name */
4416- if (!(sql_file = my_fopen(source_name, O_RDONLY | O_BINARY,MYF(0))))
4417- {
4418- char buff[FN_REFLEN+60];
4419- sprintf(buff,"Failed to open file '%s', error: %d", source_name,errno);
4420- return put_info(buff, INFO_ERROR, 0);
4421- }
4422-
4423- if (!(line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, sql_file)))
4424- {
4425- my_fclose(sql_file,MYF(0));
4426- return put_info("Can't initialize batch_readline", INFO_ERROR, 0);
4427- }
4428-
4429- /* Save old status */
4430- old_status=status;
4431- memset(&status, 0, sizeof(status));
4432-
4433- status.batch=old_status.batch; // Run in batch mode
4434- status.line_buff=line_buff;
4435- status.file_name=source_name;
4436- glob_buffer.length(0); // Empty command buffer
4437- error= read_and_execute(false);
4438- status=old_status; // Continue as before
4439- my_fclose(sql_file,MYF(0));
4440- batch_readline_end(line_buff);
4441- return error;
4442-}
4443-
4444-
4445- /* ARGSUSED */
4446-static int
4447-com_delimiter(String *buffer __attribute__((unused)), char *line)
4448-{
4449- char buff[256], *tmp;
4450-
4451- strmake(buff, line, sizeof(buff) - 1);
4452- tmp= get_arg(buff, 0);
4453-
4454- if (!tmp || !*tmp)
4455- {
4456- put_info("DELIMITER must be followed by a 'delimiter' character or string",
4457- INFO_ERROR);
4458- return 0;
4459- }
4460- else
4461- {
4462- if (strstr(tmp, "\\"))
4463- {
4464- put_info("DELIMITER cannot contain a backslash character", INFO_ERROR);
4465- return 0;
4466- }
4467- }
4468- strmake(delimiter, tmp, sizeof(delimiter) - 1);
4469- delimiter_length= (int)strlen(delimiter);
4470- delimiter_str= delimiter;
4471- return 0;
4472-}
4473-
4474- /* ARGSUSED */
4475-static int
4476-com_use(String *buffer __attribute__((unused)), char *line)
4477-{
4478- char *tmp, buff[FN_REFLEN + 1];
4479- int select_db;
4480-
4481- memset(buff, 0, sizeof(buff));
4482-
4483- /*
4484- In case number of quotes exceed 2, we try to get
4485- the normalized db name.
4486- */
4487- if (get_quote_count(line) > 2)
4488- {
4489- if (normalize_dbname(line, buff, sizeof(buff)))
4490- return put_error(&mysql);
4491- tmp= buff;
4492- }
4493- else
4494- {
4495- strmake(buff, line, sizeof(buff) - 1);
4496- tmp= get_arg(buff, 0);
4497- }
4498-
4499- if (!tmp || !*tmp)
4500- {
4501- put_info("USE must be followed by a database name", INFO_ERROR);
4502- return 0;
4503- }
4504- /*
4505- We need to recheck the current database, because it may change
4506- under our feet, for example if DROP DATABASE or RENAME DATABASE
4507- (latter one not yet available by the time the comment was written)
4508- */
4509- get_current_db();
4510-
4511- if (!current_db || cmp_database(charset_info, current_db,tmp))
4512- {
4513- if (one_database)
4514- {
4515- skip_updates= 1;
4516- select_db= 0; // don't do mysql_select_db()
4517- }
4518- else
4519- select_db= 2; // do mysql_select_db() and build_completion_hash()
4520- }
4521- else
4522- {
4523- /*
4524- USE to the current db specified.
4525- We do need to send mysql_select_db() to make server
4526- update database level privileges, which might
4527- change since last USE (see bug#10979).
4528- For performance purposes, we'll skip rebuilding of completion hash.
4529- */
4530- skip_updates= 0;
4531- select_db= 1; // do only mysql_select_db(), without completion
4532- }
4533-
4534- if (select_db)
4535- {
4536- /*
4537- reconnect once if connection is down or if connection was found to
4538- be down during query
4539- */
4540- if (!connected && reconnect())
4541- return opt_reconnect ? -1 : 1; // Fatal error
4542- if (mysql_select_db(&mysql,tmp))
4543- {
4544- if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR)
4545- return put_error(&mysql);
4546-
4547- if (reconnect())
4548- return opt_reconnect ? -1 : 1; // Fatal error
4549- if (mysql_select_db(&mysql,tmp))
4550- return put_error(&mysql);
4551- }
4552- my_free(current_db);
4553- current_db=my_strdup(tmp,MYF(MY_WME));
4554-#ifdef HAVE_READLINE
4555- if (select_db > 1)
4556- build_completion_hash(opt_rehash, 1);
4557-#endif
4558- }
4559-
4560- put_info("Database changed",INFO_INFO);
4561- return 0;
4562-}
4563-
4564-/**
4565- Normalize database name.
4566-
4567- @param line [IN] The command.
4568- @param buff [OUT] Normalized db name.
4569- @param buff_size [IN] Buffer size.
4570-
4571- @return Operation status
4572- @retval 0 Success
4573- @retval 1 Failure
4574-
4575- @note Sometimes server normilizes the database names
4576- & APIs like mysql_select_db() expect normalized
4577- database names. Since it is difficult to perform
4578- the name conversion/normalization on the client
4579- side, this function tries to get the normalized
4580- dbname (indirectly) from the server.
4581-*/
4582-
4583-static int
4584-normalize_dbname(const char *line, char *buff, uint buff_size)
4585-{
4586- MYSQL_RES *res= NULL;
4587-
4588- /* Send the "USE db" commmand to the server. */
4589- if (mysql_query(&mysql, line))
4590- return 1;
4591-
4592- /*
4593- Now, get the normalized database name and store it
4594- into the buff.
4595- */
4596- if (!mysql_query(&mysql, "SELECT DATABASE()") &&
4597- (res= mysql_use_result(&mysql)))
4598- {
4599- MYSQL_ROW row= mysql_fetch_row(res);
4600- if (row && row[0])
4601- {
4602- size_t len= strlen(row[0]);
4603- /* Make sure there is enough room to store the dbname. */
4604- if ((len > buff_size) || ! memcpy(buff, row[0], len))
4605- {
4606- mysql_free_result(res);
4607- return 1;
4608- }
4609- }
4610- mysql_free_result(res);
4611- }
4612-
4613- /* Restore the original database. */
4614- if (current_db && mysql_select_db(&mysql, current_db))
4615- return 1;
4616-
4617- return 0;
4618-}
4619-
4620-static int
4621-com_warnings(String *buffer __attribute__((unused)),
4622- char *line __attribute__((unused)))
4623-{
4624- show_warnings = 1;
4625- put_info("Show warnings enabled.",INFO_INFO);
4626- return 0;
4627-}
4628-
4629-static int
4630-com_nowarnings(String *buffer __attribute__((unused)),
4631- char *line __attribute__((unused)))
4632-{
4633- show_warnings = 0;
4634- put_info("Show warnings disabled.",INFO_INFO);
4635- return 0;
4636-}
4637-
4638-/*
4639- Gets argument from a command on the command line. If get_next_arg is
4640- not defined, skips the command and returns the first argument. The
4641- line is modified by adding zero to the end of the argument. If
4642- get_next_arg is defined, then the function searches for end of string
4643- first, after found, returns the next argument and adds zero to the
4644- end. If you ever wish to use this feature, remember to initialize all
4645- items in the array to zero first.
4646-*/
4647-
4648-char *get_arg(char *line, my_bool get_next_arg)
4649-{
4650- char *ptr, *start;
4651- my_bool quoted= 0, valid_arg= 0;
4652- char qtype= 0;
4653-
4654- ptr= line;
4655- if (get_next_arg)
4656- {
4657- for (; *ptr; ptr++) ;
4658- if (*(ptr + 1))
4659- ptr++;
4660- }
4661- else
4662- {
4663- /* skip leading white spaces */
4664- while (my_isspace(charset_info, *ptr))
4665- ptr++;
4666- if (*ptr == '\\') // short command was used
4667- ptr+= 2;
4668- else
4669- while (*ptr &&!my_isspace(charset_info, *ptr)) // skip command
4670- ptr++;
4671- }
4672- if (!*ptr)
4673- return NullS;
4674- while (my_isspace(charset_info, *ptr))
4675- ptr++;
4676- if (*ptr == '\'' || *ptr == '\"' || *ptr == '`')
4677- {
4678- qtype= *ptr;
4679- quoted= 1;
4680- ptr++;
4681- }
4682- for (start=ptr ; *ptr; ptr++)
4683- {
4684- if (*ptr == '\\' && ptr[1]) // escaped character
4685- {
4686- // Remove the backslash
4687- strmov_overlapp(ptr, ptr+1);
4688- }
4689- else if ((!quoted && *ptr == ' ') || (quoted && *ptr == qtype))
4690- {
4691- *ptr= 0;
4692- break;
4693- }
4694- }
4695- valid_arg= ptr != start;
4696- return valid_arg ? start : NullS;
4697-}
4698-
4699-/*
4700- Number of quotes present in the command's argument.
4701-*/
4702-static int
4703-get_quote_count(const char *line)
4704-{
4705- int quote_count;
4706- const char *ptr= line;
4707-
4708- for(quote_count= 0; ptr ++ && *ptr; ptr= strpbrk(ptr, "\"\'`"))
4709- quote_count ++;
4710-
4711- return quote_count;
4712-}
4713-
4714-static int
4715-sql_real_connect(char *host,char *database,char *user,char *password,
4716- uint silent)
4717-{
4718- my_bool handle_expired= (opt_connect_expired_password || !status.batch) ?
4719- TRUE : FALSE;
4720-
4721- if (connected)
4722- {
4723- connected= 0;
4724- mysql_close(&mysql);
4725- }
4726- mysql_init(&mysql);
4727- if (opt_init_command)
4728- mysql_options(&mysql, MYSQL_INIT_COMMAND, opt_init_command);
4729- if (opt_connect_timeout)
4730- {
4731- uint timeout=opt_connect_timeout;
4732- mysql_options(&mysql,MYSQL_OPT_CONNECT_TIMEOUT,
4733- (char*) &timeout);
4734- }
4735- if (opt_bind_addr)
4736- mysql_options(&mysql, MYSQL_OPT_BIND, opt_bind_addr);
4737- if (opt_compress)
4738- mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
4739- if (!opt_secure_auth)
4740- mysql_options(&mysql, MYSQL_SECURE_AUTH, (char *) &opt_secure_auth);
4741- if (using_opt_local_infile)
4742- mysql_options(&mysql,MYSQL_OPT_LOCAL_INFILE, (char*) &opt_local_infile);
4743-#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
4744- if (opt_use_ssl)
4745- {
4746- mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
4747- opt_ssl_capath, opt_ssl_cipher);
4748- mysql_options(&mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl);
4749- mysql_options(&mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath);
4750- }
4751- mysql_options(&mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
4752- (char*)&opt_ssl_verify_server_cert);
4753-#endif
4754- if (opt_protocol)
4755- mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol);
4756-#ifdef HAVE_SMEM
4757- if (shared_memory_base_name)
4758- mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
4759-#endif
4760- if (safe_updates)
4761- {
4762- char init_command[100];
4763- sprintf(init_command,
4764- "SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=%lu,MAX_JOIN_SIZE=%lu",
4765- select_limit,max_join_size);
4766- mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command);
4767- }
4768-
4769- mysql_set_character_set(&mysql, default_charset);
4770-#ifdef __WIN__
4771- uint cnv_errors;
4772- String converted_database, converted_user;
4773- if (!my_charset_same(&my_charset_utf8mb4_bin, mysql.charset))
4774- {
4775- /* Convert user and database from UTF8MB4 to connection character set */
4776- if (user)
4777- {
4778- converted_user.copy(user, strlen(user) + 1,
4779- &my_charset_utf8mb4_bin, mysql.charset,
4780- &cnv_errors);
4781- user= (char *) converted_user.ptr();
4782- }
4783- if (database)
4784- {
4785- converted_database.copy(database, strlen(database) + 1,
4786- &my_charset_utf8mb4_bin, mysql.charset,
4787- &cnv_errors);
4788- database= (char *) converted_database.ptr();
4789- }
4790- }
4791-#endif
4792-
4793- if (opt_plugin_dir && *opt_plugin_dir)
4794- mysql_options(&mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
4795-
4796- if (opt_default_auth && *opt_default_auth)
4797- mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
4798-
4799-#if !defined(HAVE_YASSL)
4800- if (opt_server_public_key && *opt_server_public_key)
4801- mysql_options(&mysql, MYSQL_SERVER_PUBLIC_KEY, opt_server_public_key);
4802-#endif
4803-
4804- if (using_opt_enable_cleartext_plugin)
4805- mysql_options(&mysql, MYSQL_ENABLE_CLEARTEXT_PLUGIN,
4806- (char*) &opt_enable_cleartext_plugin);
4807-
4808- mysql_options(&mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
4809- mysql_options4(&mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
4810- "program_name", "mysql");
4811- mysql_options(&mysql, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, &handle_expired);
4812-
4813- if (!mysql_real_connect(&mysql, host, user, password,
4814- database, opt_mysql_port, opt_mysql_unix_port,
4815- connect_flag | CLIENT_MULTI_STATEMENTS))
4816- {
4817- if (!silent ||
4818- (mysql_errno(&mysql) != CR_CONN_HOST_ERROR &&
4819- mysql_errno(&mysql) != CR_CONNECTION_ERROR))
4820- {
4821- (void) put_error(&mysql);
4822- (void) fflush(stdout);
4823- return ignore_errors ? -1 : 1; // Abort
4824- }
4825- return -1; // Retryable
4826- }
4827-
4828-#ifdef __WIN__
4829- /* Convert --execute buffer from UTF8MB4 to connection character set */
4830- if (!execute_buffer_conversion_done++ &&
4831- status.line_buff &&
4832- !status.line_buff->file && /* Convert only -e buffer, not real file */
4833- status.line_buff->buffer < status.line_buff->end && /* Non-empty */
4834- !my_charset_same(&my_charset_utf8mb4_bin, mysql.charset))
4835- {
4836- String tmp;
4837- size_t len= status.line_buff->end - status.line_buff->buffer;
4838- uint dummy_errors;
4839- /*
4840- Don't convert trailing '\n' character - it was appended during
4841- last batch_readline_command() call.
4842- Oherwise we'll get an extra line, which makes some tests fail.
4843- */
4844- if (status.line_buff->buffer[len - 1] == '\n')
4845- len--;
4846- if (tmp.copy(status.line_buff->buffer, len,
4847- &my_charset_utf8mb4_bin, mysql.charset, &dummy_errors))
4848- return 1;
4849-
4850- /* Free the old line buffer */
4851- batch_readline_end(status.line_buff);
4852-
4853- /* Re-initialize line buffer from the converted string */
4854- if (!(status.line_buff= batch_readline_command(NULL, (char *) tmp.c_ptr_safe())))
4855- return 1;
4856- }
4857-#endif /* __WIN__ */
4858-
4859- charset_info= mysql.charset;
4860-
4861- connected=1;
4862-#ifndef EMBEDDED_LIBRARY
4863- mysql.reconnect= debug_info_flag; // We want to know if this happens
4864-#else
4865- mysql.reconnect= 1;
4866-#endif
4867-#ifdef HAVE_READLINE
4868- build_completion_hash(opt_rehash, 1);
4869-#endif
4870- return 0;
4871-}
4872-
4873-
4874-static int
4875-sql_connect(char *host,char *database,char *user,char *password,uint silent)
4876-{
4877- bool message=0;
4878- uint count=0;
4879- int error;
4880- for (;;)
4881- {
4882- if ((error=sql_real_connect(host,database,user,password,wait_flag)) >= 0)
4883- {
4884- if (count)
4885- {
4886- tee_fputs("\n", stderr);
4887- (void) fflush(stderr);
4888- }
4889- return error;
4890- }
4891- if (!wait_flag)
4892- return ignore_errors ? -1 : 1;
4893- if (!message && !silent)
4894- {
4895- message=1;
4896- tee_fputs("Waiting",stderr); (void) fflush(stderr);
4897- }
4898- (void) sleep(wait_time);
4899- if (!silent)
4900- {
4901- putc('.',stderr); (void) fflush(stderr);
4902- count++;
4903- }
4904- }
4905-}
4906-
4907-
4908-
4909-static int
4910-com_status(String *buffer __attribute__((unused)),
4911- char *line __attribute__((unused)))
4912-{
4913- const char *status_str;
4914- char buff[40];
4915- ulonglong id;
4916- MYSQL_RES *result;
4917- LINT_INIT(result);
4918-
4919- if (mysql_real_query_for_lazy(
4920- C_STRING_WITH_LEN("select DATABASE(), USER() limit 1")))
4921- return 0;
4922-
4923- tee_puts("--------------", stdout);
4924- usage(1); /* Print version */
4925- tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql));
4926- /*
4927- Don't remove "limit 1",
4928- it is protection againts SQL_SELECT_LIMIT=0
4929- */
4930- if (!mysql_store_result_for_lazy(&result))
4931- {
4932- MYSQL_ROW cur=mysql_fetch_row(result);
4933- if (cur)
4934- {
4935- tee_fprintf(stdout, "Current database:\t%s\n", cur[0] ? cur[0] : "");
4936- tee_fprintf(stdout, "Current user:\t\t%s\n", cur[1]);
4937- }
4938- mysql_free_result(result);
4939- }
4940-
4941-#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
4942- if ((status_str= mysql_get_ssl_cipher(&mysql)))
4943- tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
4944- status_str);
4945- else
4946-#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
4947- tee_puts("SSL:\t\t\tNot in use", stdout);
4948-
4949- if (skip_updates)
4950- {
4951- vidattr(A_BOLD);
4952- tee_fprintf(stdout, "\nAll updates ignored to this database\n");
4953- vidattr(A_NORMAL);
4954- }
4955-#ifdef USE_POPEN
4956- tee_fprintf(stdout, "Current pager:\t\t%s\n", pager);
4957- tee_fprintf(stdout, "Using outfile:\t\t'%s'\n", opt_outfile ? outfile : "");
4958-#endif
4959- tee_fprintf(stdout, "Using delimiter:\t%s\n", delimiter);
4960- tee_fprintf(stdout, "Server version:\t\t%s\n", server_version_string(&mysql));
4961- tee_fprintf(stdout, "Protocol version:\t%d\n", mysql_get_proto_info(&mysql));
4962- tee_fprintf(stdout, "Connection:\t\t%s\n", mysql_get_host_info(&mysql));
4963- if ((id= mysql_insert_id(&mysql)))
4964- tee_fprintf(stdout, "Insert id:\t\t%s\n", llstr(id, buff));
4965-
4966- /* "limit 1" is protection against SQL_SELECT_LIMIT=0 */
4967- if (mysql_real_query_for_lazy(C_STRING_WITH_LEN(
4968- "select @@character_set_client, @@character_set_connection, "
4969- "@@character_set_server, @@character_set_database limit 1")))
4970- {
4971- if (mysql_errno(&mysql) == CR_SERVER_GONE_ERROR)
4972- return 0;
4973- }
4974- if (!mysql_store_result_for_lazy(&result))
4975- {
4976- MYSQL_ROW cur=mysql_fetch_row(result);
4977- if (cur)
4978- {
4979- tee_fprintf(stdout, "Server characterset:\t%s\n", cur[2] ? cur[2] : "");
4980- tee_fprintf(stdout, "Db characterset:\t%s\n", cur[3] ? cur[3] : "");
4981- tee_fprintf(stdout, "Client characterset:\t%s\n", cur[0] ? cur[0] : "");
4982- tee_fprintf(stdout, "Conn. characterset:\t%s\n", cur[1] ? cur[1] : "");
4983- }
4984- mysql_free_result(result);
4985- }
4986- else
4987- {
4988- /* Probably pre-4.1 server */
4989- tee_fprintf(stdout, "Client characterset:\t%s\n", charset_info->csname);
4990- tee_fprintf(stdout, "Server characterset:\t%s\n", mysql.charset->csname);
4991- }
4992-
4993-#ifndef EMBEDDED_LIBRARY
4994- if (strstr(mysql_get_host_info(&mysql),"TCP/IP") || ! mysql.unix_socket)
4995- tee_fprintf(stdout, "TCP port:\t\t%d\n", mysql.port);
4996- else
4997- tee_fprintf(stdout, "UNIX socket:\t\t%s\n", mysql.unix_socket);
4998- if (mysql.net.compress)
4999- tee_fprintf(stdout, "Protocol:\t\tCompressed\n");
5000-#endif
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: