1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Fix for Bug#4030 "Client side conversion string -> date type doesn't

work (prepared statements)" and after-review fixes:
- str_to_TIME renamed to str_to_datetime to pair with str_to_time
- functions str_to_time and str_to_TIME moved to sql-common
- send_data_str now supports MYSQL_TYPE_TIME, MYSQL_TIME_DATE,
  MYSQL_TIME_DATETIME types of user input buffers.
- few more comments in the client library
- a test case added.


VC++Files/libmysql/libmysql.dsp:
  new file: my_time.c
VC++Files/libmysqld/libmysqld.dsp:
  new file: my_time.c
VC++Files/sql/mysqld.dsp:
  new file: my_time.c
include/Makefile.am:
  - mysql_time.h added to the list of installed client library headers
include/mysql.h:
  - declarations for MYSQL_TIME and enum_mysql_timestamp_type moved to 
  mysql_time.h, which is in shared use of client library and mysys.
libmysql/Makefile.shared:
  - my_time.lo added to the list of libmysql objects
libmysql/libmysql.c:
  Fix for bug#4030 "Client side conversion string -> date type doesn't work
   (prepared statements)" and cleanup.
  - added case labels for TIME/DATE/DATETIME types to send_data_str
  - comments for read_binary_{date,time,datetime}, fetch_result_*, fetch_results.
libmysqld/Makefile.am:
  - my_time.c added
sql-common/Makefile.am:
  - my_time.c added to the list of files included into source distribution.
sql/Makefile.am:
  my_time.c added to the list of mysqld sources.
sql/field.cc:
  - TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to 
    MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item.cc:
  - TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to 
    MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item_timefunc.cc:
  - TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to 
    MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/mysql_priv.h:
  - added typedefs for TIME and timestamp_type
  - removed declarations for str_to_time and str_to_TIME (now this functions
    reside in mysys)
sql/mysqld.cc:
  - log_10_int moved to mysys (it's used by str_to_TIME and str_to_time)
  - enum values TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
    MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
sql/set_var.cc:
  - TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to 
    MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/set_var.h:
  - fixed timestamp_type usage to be compatible with typedef.
sql/sql_prepare.cc:
  - TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
    MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
  - embedded library implementation of set_param_{time,date,datetime} is
  much simplier now, as MYSQL_TIME is the same as TIME.
sql/sql_yacc.yy:
  - s/\<TIMESTAMP_/MYSQL_TIMESTAMP/gc
sql/structs.h:
  - declarations for TIME and timestamp_type replaced with typedefs
  - str_to_datetime arguments moved to mysys headers
sql/time.cc:
  - str_to_time and str_to_TIME moved to mysys
  - TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to 
    MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...} as these names are now
    exported to client.
  - str_to_TIME renamed to str_to_datetime to pair with str_to_time
  - str_to_TIME_with_warn renamed accordingly
sql/tztime.cc:
  - TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to 
    MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
tests/client_test.c:
  - a test case for Bug#4030 "Client side conversion string -> date type 
  doesn't work (prepared statements)"
This commit is contained in:
unknown
2004-06-24 19:08:36 +04:00
parent 85e9258b05
commit 9dde418895
25 changed files with 386 additions and 770 deletions

View File

@@ -361,7 +361,7 @@ static void set_param_time(Item_param *param, uchar **pos, ulong len)
}
tm.day= tm.year= tm.month= 0;
param->set_time(&tm, TIMESTAMP_TIME,
param->set_time(&tm, MYSQL_TIMESTAMP_TIME,
MAX_TIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
}
*pos+= length;
@@ -396,7 +396,7 @@ static void set_param_datetime(Item_param *param, uchar **pos, ulong len)
tm.second_part= (length > 7) ? (ulong) sint4korr(to+7) : 0;
param->set_time(&tm, TIMESTAMP_DATETIME,
param->set_time(&tm, MYSQL_TIMESTAMP_DATETIME,
MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
}
*pos+= length;
@@ -423,7 +423,7 @@ static void set_param_date(Item_param *param, uchar **pos, ulong len)
tm.second_part= 0;
tm.neg= 0;
param->set_time(&tm, TIMESTAMP_DATE,
param->set_time(&tm, MYSQL_TIMESTAMP_DATE,
MAX_DATE_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
}
*pos+= length;
@@ -432,58 +432,25 @@ static void set_param_date(Item_param *param, uchar **pos, ulong len)
#else/*!EMBEDDED_LIBRARY*/
void set_param_time(Item_param *param, uchar **pos, ulong len)
{
TIME tm;
MYSQL_TIME *to= (MYSQL_TIME*)*pos;
tm.second_part= to->second_part;
tm.day= to->day;
tm.hour= to->hour;
tm.minute= to->minute;
tm.second= to->second;
tm.year= tm.month= 0;
tm.neg= to->neg;
param->set_time(&tm, TIMESTAMP_TIME,
param->set_time(to, MYSQL_TIMESTAMP_TIME,
MAX_TIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
}
void set_param_datetime(Item_param *param, uchar **pos, ulong len)
{
TIME tm;
MYSQL_TIME *to= (MYSQL_TIME*)*pos;
tm.second_part= to->second_part;
tm.day= to->day;
tm.hour= to->hour;
tm.minute= to->minute;
tm.second= to->second;
tm.year= to->year;
tm.month= to->month;
tm.neg= 0;
param->set_time(&tm, TIMESTAMP_DATETIME,
param->set_time(to, MYSQL_TIMESTAMP_DATETIME,
MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
}
void set_param_date(Item_param *param, uchar **pos, ulong len)
{
TIME tm;
MYSQL_TIME *to= (MYSQL_TIME*)*pos;
tm.second_part= to->second_part;
tm.day= to->day;
tm.year= to->year;
tm.month= to->month;
tm.neg= 0;
tm.hour= tm.minute= tm.second= 0;
tm.second_part= 0;
tm.neg= 0;
param->set_time(&tm, TIMESTAMP_DATE,
param->set_time(to, MYSQL_TIMESTAMP_DATE,
MAX_DATE_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
}
#endif /*!EMBEDDED_LIBRARY*/