mysql.cc | mysql.cc | |||
---|---|---|---|---|
skipping to change at line 100 | skipping to change at line 100 | |||
#undef SYSV // hack to avoid syntax error | #undef SYSV // hack to avoid syntax error | |||
#ifdef HAVE_TERM_H | #ifdef HAVE_TERM_H | |||
#include <term.h> | #include <term.h> | |||
#endif | #endif | |||
#endif | #endif | |||
#endif | #endif | |||
#if defined(__WIN__) | #if defined(__WIN__) | |||
#include <conio.h> | #include <conio.h> | |||
#else | #else | |||
#include <readline/readline.h> | #include <readline.h> | |||
#define HAVE_READLINE | #define HAVE_READLINE | |||
#define USE_POPEN | #define USE_POPEN | |||
#endif | #endif | |||
//int vidattr(long unsigned int attrs); // Was missing in sun curses | //int vidattr(long unsigned int attrs); // Was missing in sun curses | |||
} | } | |||
#if !defined(HAVE_VIDATTR) | #if !defined(HAVE_VIDATTR) | |||
#undef vidattr | #undef vidattr | |||
#define vidattr(A) {} // Can't get this to work | #define vidattr(A) {} // Can't get this to work | |||
#endif | #endif | |||
skipping to change at line 166 | skipping to change at line 166 | |||
static my_bool preserve_comments= 0; | static my_bool preserve_comments= 0; | |||
static ulong opt_max_allowed_packet, opt_net_buffer_length; | static ulong opt_max_allowed_packet, opt_net_buffer_length; | |||
static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0; | static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0; | |||
static uint opt_enable_cleartext_plugin= 0; | static uint opt_enable_cleartext_plugin= 0; | |||
static my_bool using_opt_enable_cleartext_plugin= 0; | static my_bool using_opt_enable_cleartext_plugin= 0; | |||
static uint my_end_arg; | static uint my_end_arg; | |||
static char * opt_mysql_unix_port=0; | static char * opt_mysql_unix_port=0; | |||
static char *opt_bind_addr = NULL; | static char *opt_bind_addr = NULL; | |||
static int connect_flag=CLIENT_INTERACTIVE; | static int connect_flag=CLIENT_INTERACTIVE; | |||
static my_bool opt_binary_mode= FALSE; | static my_bool opt_binary_mode= FALSE; | |||
static my_bool opt_connect_expired_password= FALSE; | ||||
static char *current_host,*current_db,*current_user=0,*opt_password=0, | static char *current_host,*current_db,*current_user=0,*opt_password=0, | |||
*current_prompt=0, *delimiter_str= 0, | *current_prompt=0, *delimiter_str= 0, | |||
*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME, | *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME, | |||
*opt_init_command= 0; | *opt_init_command= 0; | |||
static char *histfile; | static char *histfile; | |||
static char *histfile_tmp; | static char *histfile_tmp; | |||
static char *opt_histignore= NULL; | static char *opt_histignore= NULL; | |||
DYNAMIC_STRING histignore_buffer; | DYNAMIC_STRING histignore_buffer; | |||
static String glob_buffer,old_buffer; | static String glob_buffer,old_buffer; | |||
static String processed_prompt; | static String processed_prompt; | |||
skipping to change at line 1767 | skipping to change at line 1768 | |||
"commands except \\C and DELIMITER, in non-interactive mode (for input " | "commands except \\C and DELIMITER, in non-interactive mode (for input " | |||
"piped to mysql or loaded using the 'source' command). This is necessary " | "piped to mysql or loaded using the 'source' command). This is necessary " | |||
"when processing output from mysqlbinlog that may contain blobs.", | "when processing output from mysqlbinlog that may contain blobs.", | |||
&opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, | &opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, | |||
#if !defined(HAVE_YASSL) | #if !defined(HAVE_YASSL) | |||
{"server-public-key-path", OPT_SERVER_PUBLIC_KEY, | {"server-public-key-path", OPT_SERVER_PUBLIC_KEY, | |||
"File path to the server public RSA key in PEM format.", | "File path to the server public RSA key in PEM format.", | |||
&opt_server_public_key, &opt_server_public_key, 0, | &opt_server_public_key, &opt_server_public_key, 0, | |||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, | GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, | |||
#endif | #endif | |||
{"connect-expired-password", 0, | ||||
"Notify the server that this client is prepared to handle expired " | ||||
"password sandbox mode.", | ||||
&opt_connect_expired_password, &opt_connect_expired_password, 0, GET_BOO | ||||
L, | ||||
NO_ARG, 0, 0, 0, 0, 0, 0}, | ||||
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} | { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} | |||
}; | }; | |||
static void usage(int version) | static void usage(int version) | |||
{ | { | |||
#if defined(USE_LIBEDIT_INTERFACE) | #if defined(USE_LIBEDIT_INTERFACE) | |||
const char* readline= ""; | const char* readline= ""; | |||
#else | #else | |||
const char* readline= "readline"; | const char* readline= "readline"; | |||
#endif | #endif | |||
skipping to change at line 2033 | skipping to change at line 2039 | |||
return(0); | return(0); | |||
} | } | |||
static int read_and_execute(bool interactive) | static int read_and_execute(bool interactive) | |||
{ | { | |||
#if defined(__WIN__) | #if defined(__WIN__) | |||
String tmpbuf; | String tmpbuf; | |||
String buffer; | String buffer; | |||
#endif | #endif | |||
char *line; | char *line= NULL; | |||
char in_string=0; | char in_string=0; | |||
ulong line_number=0; | ulong line_number=0; | |||
bool ml_comment= 0; | bool ml_comment= 0; | |||
COMMANDS *com; | COMMANDS *com; | |||
ulong line_length= 0; | ulong line_length= 0; | |||
status.exit_status=1; | status.exit_status=1; | |||
real_binary_mode= !interactive && opt_binary_mode; | real_binary_mode= !interactive && opt_binary_mode; | |||
for (;;) | for (;;) | |||
{ | { | |||
skipping to change at line 2119 | skipping to change at line 2125 | |||
if (!tmpbuf.is_alloced()) | if (!tmpbuf.is_alloced()) | |||
tmpbuf.alloc(65535); | tmpbuf.alloc(65535); | |||
tmpbuf.length(0); | tmpbuf.length(0); | |||
buffer.length(0); | buffer.length(0); | |||
line= my_win_console_readline(charset_info, | line= my_win_console_readline(charset_info, | |||
(char *) tmpbuf.ptr(), | (char *) tmpbuf.ptr(), | |||
tmpbuf.alloced_length()); | tmpbuf.alloced_length()); | |||
#else | #else | |||
if (opt_outfile) | if (opt_outfile) | |||
fputs(prompt, OUTFILE); | fputs(prompt, OUTFILE); | |||
/* | ||||
free the previous entered line. | ||||
Note: my_free() cannot be used here as the memory was allocated und | ||||
er | ||||
the readline/libedit library. | ||||
*/ | ||||
if (line) | ||||
free(line); | ||||
line= readline(prompt); | line= readline(prompt); | |||
#endif /* defined(__WIN__) */ | #endif /* defined(__WIN__) */ | |||
/* | /* | |||
When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS | When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS | |||
which may cause coredump. | which may cause coredump. | |||
*/ | */ | |||
if (opt_outfile && line) | if (opt_outfile && line) | |||
fprintf(OUTFILE, "%s\n", line); | fprintf(OUTFILE, "%s\n", line); | |||
skipping to change at line 2178 | skipping to change at line 2191 | |||
{ | { | |||
status.exit_status=1; | status.exit_status=1; | |||
if (com_go(&glob_buffer,line) <= 0) | if (com_go(&glob_buffer,line) <= 0) | |||
status.exit_status=0; | status.exit_status=0; | |||
} | } | |||
} | } | |||
#if defined(__WIN__) | #if defined(__WIN__) | |||
buffer.free(); | buffer.free(); | |||
tmpbuf.free(); | tmpbuf.free(); | |||
#else | ||||
if (interactive) | ||||
/* | ||||
free the last entered line. | ||||
Note: my_free() cannot be used here as the memory was allocated under | ||||
the readline/libedit library. | ||||
*/ | ||||
free(line); | ||||
#endif | #endif | |||
/* | /* | |||
If the function is called by 'source' command, it will return to intera ctive | If the function is called by 'source' command, it will return to intera ctive | |||
mode, so real_binary_mode should be FALSE. Otherwise, it will exit the | mode, so real_binary_mode should be FALSE. Otherwise, it will exit the | |||
program, it is safe to set real_binary_mode to FALSE. | program, it is safe to set real_binary_mode to FALSE. | |||
*/ | */ | |||
real_binary_mode= FALSE; | real_binary_mode= FALSE; | |||
return status.exit_status; | return status.exit_status; | |||
} | } | |||
skipping to change at line 2985 | skipping to change at line 3006 | |||
uint i; | uint i; | |||
int rc; | int rc; | |||
LEX_STRING *tmp; | LEX_STRING *tmp; | |||
DBUG_ENTER("check_histignore"); | DBUG_ENTER("check_histignore"); | |||
for (i= 0; i < histignore_patterns.elements; i++) | for (i= 0; i < histignore_patterns.elements; i++) | |||
{ | { | |||
tmp= dynamic_element(&histignore_patterns, i, LEX_STRING *); | tmp= dynamic_element(&histignore_patterns, i, LEX_STRING *); | |||
if ((rc= charset_info->coll->wildcmp(&my_charset_latin1, | if ((rc= charset_info->coll->wildcmp(charset_info, | |||
string, string + strlen(string), | string, string + strlen(string), | |||
tmp->str, tmp->str + tmp->length, | tmp->str, tmp->str + tmp->length, | |||
wild_prefix, wild_one, | wild_prefix, wild_one, | |||
wild_many)) == 0) | wild_many)) == 0) | |||
DBUG_RETURN(1); | DBUG_RETURN(1); | |||
} | } | |||
DBUG_RETURN(0); | DBUG_RETURN(0); | |||
} | } | |||
/** | /** | |||
skipping to change at line 4647 | skipping to change at line 4668 | |||
for(quote_count= 0; ptr ++ && *ptr; ptr= strpbrk(ptr, "\"\'`")) | for(quote_count= 0; ptr ++ && *ptr; ptr= strpbrk(ptr, "\"\'`")) | |||
quote_count ++; | quote_count ++; | |||
return quote_count; | return quote_count; | |||
} | } | |||
static int | static int | |||
sql_real_connect(char *host,char *database,char *user,char *password, | sql_real_connect(char *host,char *database,char *user,char *password, | |||
uint silent) | uint silent) | |||
{ | { | |||
my_bool interactive= status.batch ? FALSE : TRUE; | my_bool handle_expired= (opt_connect_expired_password || !status.batch) ? | |||
TRUE : FALSE; | ||||
if (connected) | if (connected) | |||
{ | { | |||
connected= 0; | connected= 0; | |||
mysql_close(&mysql); | mysql_close(&mysql); | |||
} | } | |||
mysql_init(&mysql); | mysql_init(&mysql); | |||
if (opt_init_command) | if (opt_init_command) | |||
mysql_options(&mysql, MYSQL_INIT_COMMAND, opt_init_command); | mysql_options(&mysql, MYSQL_INIT_COMMAND, opt_init_command); | |||
if (opt_connect_timeout) | if (opt_connect_timeout) | |||
skipping to change at line 4739 | skipping to change at line 4761 | |||
mysql_options(&mysql, MYSQL_SERVER_PUBLIC_KEY, opt_server_public_key); | mysql_options(&mysql, MYSQL_SERVER_PUBLIC_KEY, opt_server_public_key); | |||
#endif | #endif | |||
if (using_opt_enable_cleartext_plugin) | if (using_opt_enable_cleartext_plugin) | |||
mysql_options(&mysql, MYSQL_ENABLE_CLEARTEXT_PLUGIN, | mysql_options(&mysql, MYSQL_ENABLE_CLEARTEXT_PLUGIN, | |||
(char*) &opt_enable_cleartext_plugin); | (char*) &opt_enable_cleartext_plugin); | |||
mysql_options(&mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0); | mysql_options(&mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0); | |||
mysql_options4(&mysql, MYSQL_OPT_CONNECT_ATTR_ADD, | mysql_options4(&mysql, MYSQL_OPT_CONNECT_ATTR_ADD, | |||
"program_name", "mysql"); | "program_name", "mysql"); | |||
mysql_options(&mysql, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, &interactiv e); | mysql_options(&mysql, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, &handle_exp ired); | |||
if (!mysql_real_connect(&mysql, host, user, password, | if (!mysql_real_connect(&mysql, host, user, password, | |||
database, opt_mysql_port, opt_mysql_unix_port, | database, opt_mysql_port, opt_mysql_unix_port, | |||
connect_flag | CLIENT_MULTI_STATEMENTS)) | connect_flag | CLIENT_MULTI_STATEMENTS)) | |||
{ | { | |||
if (!silent || | if (!silent || | |||
(mysql_errno(&mysql) != CR_CONN_HOST_ERROR && | (mysql_errno(&mysql) != CR_CONN_HOST_ERROR && | |||
mysql_errno(&mysql) != CR_CONNECTION_ERROR)) | mysql_errno(&mysql) != CR_CONNECTION_ERROR)) | |||
{ | { | |||
(void) put_error(&mysql); | (void) put_error(&mysql); | |||
End of changes. 9 change blocks. | ||||
5 lines changed or deleted | 29 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |