diff options
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/client.c | 14 | ||||
-rw-r--r-- | sql-common/my_time.c | 12 |
2 files changed, 20 insertions, 6 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index 4a8bdda5c5e..930388d2459 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -133,6 +133,7 @@ static void mysql_close_free(MYSQL *mysql); static int wait_for_data(my_socket fd, uint timeout); #endif + /**************************************************************************** A modified version of connect(). my_connect() allows you to specify a timeout value, in seconds, that we should wait until we @@ -723,7 +724,7 @@ void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate) Flush result set sent from server */ -void flush_use_result(MYSQL *mysql) +static void cli_flush_use_result(MYSQL *mysql) { /* Clear the current execution status */ DBUG_PRINT("warning",("Not all packets read, clearing them")); @@ -842,7 +843,7 @@ mysql_free_result(MYSQL_RES *result) mysql->unbuffered_fetch_owner= 0; if (mysql->status == MYSQL_STATUS_USE_RESULT) { - flush_use_result(mysql); + (*mysql->methods->flush_use_result)(mysql); mysql->status=MYSQL_STATUS_READY; } } @@ -1057,9 +1058,8 @@ void mysql_read_default_options(struct st_mysql_options *options, options->max_allowed_packet= atoi(opt_arg); break; case 28: /* protocol */ - if ((options->protocol = find_type(opt_arg, - &sql_protocol_typelib,0)) - == ~(ulong) 0) + if ((options->protocol= find_type(opt_arg, + &sql_protocol_typelib,0)) <= 0) { fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg); exit(1); @@ -1401,6 +1401,7 @@ mysql_init(MYSQL *mysql) bzero((char*) (mysql),sizeof(*(mysql))); mysql->options.connect_timeout= CONNECT_TIMEOUT; mysql->last_used_con= mysql->next_slave= mysql->master = mysql; + strmov(mysql->net.sqlstate, not_error_sqlstate); /* By default, we are a replication pivot. The caller must reset it after we return if this is not the case. @@ -1493,7 +1494,8 @@ static MYSQL_METHODS client_methods= cli_advanced_command, cli_read_rows, cli_use_result, - cli_fetch_lengths + cli_fetch_lengths, + cli_flush_use_result #ifndef MYSQL_SERVER ,cli_list_fields, cli_read_prepare_result, diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 855e92d6648..4b5daf53bea 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -17,6 +17,8 @@ #include <my_time.h> #include <m_string.h> #include <m_ctype.h> +/* Windows version of localtime_r() is declared in my_ptrhead.h */ +#include <my_pthread.h> ulonglong log_10_int[20]= { @@ -714,3 +716,13 @@ my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap) return (my_time_t) tmp; } /* my_system_gmt_sec */ + + +/* Set MYSQL_TIME structure to 0000-00-00 00:00:00.000000 */ + +void set_zero_time(MYSQL_TIME *tm) +{ + bzero((void*) tm, sizeof(*tm)); + tm->time_type= MYSQL_TIMESTAMP_NONE; +} + |