mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0 client/mysql.cc: Auto merged client/mysql_upgrade.c: Auto merged client/mysqltest.c: Auto merged extra/yassl/include/yassl_imp.hpp: Auto merged extra/yassl/include/yassl_int.hpp: Auto merged extra/yassl/taocrypt/include/algebra.hpp: Auto merged extra/yassl/taocrypt/include/des.hpp: Auto merged extra/yassl/taocrypt/include/modes.hpp: Auto merged extra/yassl/taocrypt/src/aes.cpp: Auto merged extra/yassl/taocrypt/src/algebra.cpp: Auto merged extra/yassl/taocrypt/test/test.cpp: Auto merged include/my_sys.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_open.c: Auto merged myisam/myisampack.c: Auto merged mysql-test/r/mysqltest.result: Auto merged mysql-test/t/mysqltest.test: Auto merged ndb/src/common/util/File.cpp: Auto merged ndb/src/common/util/socket_io.cpp: Auto merged ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: Auto merged ndb/src/kernel/blocks/dbdict/Dbdict.cpp: Auto merged ndb/src/kernel/blocks/dbdih/Dbdih.hpp: Auto merged ndb/src/kernel/blocks/dblqh/Dblqh.hpp: Auto merged ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: Auto merged ndb/src/kernel/blocks/dbtc/Dbtc.hpp: Auto merged ndb/src/kernel/blocks/dbtup/Dbtup.hpp: Auto merged ndb/src/mgmsrv/Services.cpp: Auto merged ndb/tools/ndb_config.cpp: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_subselect.h: Auto merged sql/item_sum.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_load.cc: Auto merged sql-common/my_time.c: Auto merged sql/sql_string.h: Auto merged sql/sql_table.cc: Auto merged sql/sql_trigger.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.cc: Auto merged strings/strtod.c: Auto merged tests/mysql_client_test.c: Auto merged extra/yassl/taocrypt/include/rsa.hpp: manual merge mysql-test/t/mysql.test: manual merge sql/sql_parse.cc: manual merge
This commit is contained in:
@ -132,7 +132,7 @@ typedef enum enum_info_type INFO_TYPE;
|
||||
static MYSQL mysql; /* The connection */
|
||||
static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
|
||||
connected=0,opt_raw_data=0,unbuffered=0,output_tables=0,
|
||||
rehash=1,skip_updates=0,safe_updates=0,one_database=0,
|
||||
opt_rehash=1,skip_updates=0,safe_updates=0,one_database=0,
|
||||
opt_compress=0, using_opt_local_infile=0,
|
||||
vertical=0, line_numbers=1, column_names=1,opt_html=0,
|
||||
opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
|
||||
@ -586,7 +586,8 @@ static struct my_option my_long_options[] =
|
||||
#endif
|
||||
{"auto-rehash", OPT_AUTO_REHASH,
|
||||
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
|
||||
(gptr*) &rehash, (gptr*) &rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
|
||||
(gptr*) &opt_rehash, (gptr*) &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
|
||||
0, 0},
|
||||
{"no-auto-rehash", 'A',
|
||||
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
@ -889,7 +890,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
}
|
||||
break;
|
||||
case 'A':
|
||||
rehash= 0;
|
||||
opt_rehash= 0;
|
||||
break;
|
||||
case 'N':
|
||||
column_names= 0;
|
||||
@ -1769,15 +1770,17 @@ char *rindex(const char *s,int c)
|
||||
|
||||
static int reconnect(void)
|
||||
{
|
||||
/* purecov: begin tested */
|
||||
if (opt_reconnect)
|
||||
{
|
||||
put_info("No connection. Trying to reconnect...",INFO_INFO);
|
||||
(void) com_connect((String *) 0, 0);
|
||||
if (rehash)
|
||||
if (opt_rehash)
|
||||
com_rehash(NULL, NULL);
|
||||
}
|
||||
if (!connected)
|
||||
return put_info("Can't connect to the server\n",INFO_ERROR);
|
||||
/* purecov: end */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2942,7 +2945,7 @@ static int
|
||||
com_connect(String *buffer, char *line)
|
||||
{
|
||||
char *tmp, buff[256];
|
||||
bool save_rehash= rehash;
|
||||
bool save_rehash= opt_rehash;
|
||||
int error;
|
||||
|
||||
bzero(buff, sizeof(buff));
|
||||
@ -2966,13 +2969,16 @@ com_connect(String *buffer, char *line)
|
||||
}
|
||||
}
|
||||
else
|
||||
rehash= 0; // Quick re-connect
|
||||
{
|
||||
/* Quick re-connect */
|
||||
opt_rehash= 0; /* purecov: tested */
|
||||
}
|
||||
buffer->length(0); // command used
|
||||
}
|
||||
else
|
||||
rehash= 0;
|
||||
opt_rehash= 0;
|
||||
error=sql_connect(current_host,current_db,current_user,opt_password,0);
|
||||
rehash= save_rehash;
|
||||
opt_rehash= save_rehash;
|
||||
|
||||
if (connected)
|
||||
{
|
||||
@ -3134,7 +3140,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
|
||||
current_db=my_strdup(tmp,MYF(MY_WME));
|
||||
#ifdef HAVE_READLINE
|
||||
if (select_db > 1)
|
||||
build_completion_hash(rehash, 1);
|
||||
build_completion_hash(opt_rehash, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -3288,7 +3294,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
|
||||
mysql.reconnect= 1;
|
||||
#endif
|
||||
#ifdef HAVE_READLINE
|
||||
build_completion_hash(rehash, 1);
|
||||
build_completion_hash(opt_rehash, 1);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -3333,8 +3339,8 @@ static int
|
||||
com_status(String *buffer __attribute__((unused)),
|
||||
char *line __attribute__((unused)))
|
||||
{
|
||||
const char *status;
|
||||
char buff[22];
|
||||
const char *status_str;
|
||||
char buff[40];
|
||||
ulonglong id;
|
||||
MYSQL_RES *result;
|
||||
LINT_INIT(result);
|
||||
@ -3360,9 +3366,9 @@ com_status(String *buffer __attribute__((unused)),
|
||||
mysql_free_result(result);
|
||||
}
|
||||
#ifdef HAVE_OPENSSL
|
||||
if ((status= mysql_get_ssl_cipher(&mysql)))
|
||||
if ((status_str= mysql_get_ssl_cipher(&mysql)))
|
||||
tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
|
||||
status);
|
||||
status_str);
|
||||
else
|
||||
#endif /* HAVE_OPENSSL */
|
||||
tee_puts("SSL:\t\t\tNot in use", stdout);
|
||||
@ -3421,23 +3427,20 @@ com_status(String *buffer __attribute__((unused)),
|
||||
tee_fprintf(stdout, "Protocol:\t\tCompressed\n");
|
||||
#endif
|
||||
|
||||
if ((status=mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
|
||||
if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
|
||||
{
|
||||
ulong sec;
|
||||
char buff[40];
|
||||
const char *pos= strchr(status,' ');
|
||||
const char *pos= strchr(status_str,' ');
|
||||
/* print label */
|
||||
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status), status);
|
||||
if ((status=str2int(pos,10,0,LONG_MAX,(long*) &sec)))
|
||||
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status_str), status_str);
|
||||
if ((status_str= str2int(pos,10,0,LONG_MAX,(long*) &sec)))
|
||||
{
|
||||
nice_time((double) sec,buff,0);
|
||||
tee_puts(buff, stdout); /* print nice time */
|
||||
while (*status == ' ') status++; /* to next info */
|
||||
}
|
||||
if (status)
|
||||
{
|
||||
while (*status_str == ' ')
|
||||
status_str++; /* to next info */
|
||||
tee_putc('\n', stdout);
|
||||
tee_puts(status, stdout);
|
||||
tee_puts(status_str, stdout);
|
||||
}
|
||||
}
|
||||
if (safe_updates)
|
||||
@ -3457,7 +3460,7 @@ select_limit, max_join_size);
|
||||
}
|
||||
|
||||
static const char *
|
||||
server_version_string(MYSQL *mysql)
|
||||
server_version_string(MYSQL *con)
|
||||
{
|
||||
static char buf[MAX_SERVER_VERSION_LENGTH] = "";
|
||||
|
||||
@ -3467,11 +3470,11 @@ server_version_string(MYSQL *mysql)
|
||||
char *bufp = buf;
|
||||
MYSQL_RES *result;
|
||||
|
||||
bufp = strnmov(buf, mysql_get_server_info(mysql), sizeof buf);
|
||||
bufp= strnmov(buf, mysql_get_server_info(con), sizeof buf);
|
||||
|
||||
/* "limit 1" is protection against SQL_SELECT_LIMIT=0 */
|
||||
if (!mysql_query(mysql, "select @@version_comment limit 1") &&
|
||||
(result = mysql_use_result(mysql)))
|
||||
if (!mysql_query(con, "select @@version_comment limit 1") &&
|
||||
(result = mysql_use_result(con)))
|
||||
{
|
||||
MYSQL_ROW cur = mysql_fetch_row(result);
|
||||
if (cur && cur[0])
|
||||
@ -3561,10 +3564,10 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
|
||||
|
||||
|
||||
static int
|
||||
put_error(MYSQL *mysql)
|
||||
put_error(MYSQL *con)
|
||||
{
|
||||
return put_info(mysql_error(mysql), INFO_ERROR, mysql_errno(mysql),
|
||||
mysql_sqlstate(mysql));
|
||||
return put_info(mysql_error(con), INFO_ERROR, mysql_errno(con),
|
||||
mysql_sqlstate(con));
|
||||
}
|
||||
|
||||
|
||||
@ -3823,8 +3826,6 @@ static const char* construct_prompt()
|
||||
break;
|
||||
case 'D':
|
||||
char* dateTime;
|
||||
time_t lclock;
|
||||
lclock = time(NULL);
|
||||
dateTime = ctime(&lclock);
|
||||
processed_prompt.append(strtok(dateTime,"\n"));
|
||||
break;
|
||||
|
Reference in New Issue
Block a user