From b9862a88e7a54650c246e511429ddb56e74ae2ae Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Jun 2004 03:21:50 +0400 Subject: Proposed fix for Bug#4026 "Microseconds part of TIME/DATETIME types is broken (prepared statements)": fixed date handling in many places of prepared statements code. libmysql/libmysql.c: Fix for Bug#4026: - now buffer_length is defined for any buffer type. Network buffer preallocation cleaned up. - added constants for maximum buffer sizes necessary for MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME types. - TIME/DATETIME packing/unpacking functions fixed - now result set metadata is always updated from fields sent to COM_EXECUTE. This is necessary to make 'SELECT ?' queries work without conversions. sql/item.cc: - added implementatoin of Item_param::get_date sql/item.h: - added enum_field_types Item_param::param_type. First step for proper handling of placeholders. - added get_date() implementation to prevent date -> string -> date conversions when MYSQL_TYPE_DATE/DATETIME parameter is used in temporal context. sql/protocol.cc: Fix for Bug#4026: - PACKET_BUFFET_EXTRA_ALLOC -> PACKET_BUFFER_EXTRA_ALLOC. The define itself was moved to .cc as it's used only in protocol.cc - fixed Protocol_prep::store_time() call. sql/protocol.h: - PACKET_BUFFER_EXTRA_ALLOC moved to protocol.cc sql/sql_prepare.cc: Fix for Bug#4026: - MYSQL_TYPE_TIME/DATETIME handling fixed. - added initialization for Item_param::param_type in setup_one_conversion_function tests/client_test.c: Test case for Bug#4026 --- sql/protocol.h | 1 - 1 file changed, 1 deletion(-) (limited to 'sql/protocol.h') diff --git a/sql/protocol.h b/sql/protocol.h index 41885ec9f1f..43230983db7 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -18,7 +18,6 @@ #pragma interface /* gcc class implementation */ #endif -#define PACKET_BUFFET_EXTRA_ALLOC 1024 class i_string; class THD; -- cgit v1.2.1 From 8f61f709740588c1a41eacdc12e1481e6924ef33 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Jun 2004 22:36:48 +0500 Subject: Fix for the bug #4014 (prepared SELECT in embedded server) Problem is that store_string_aux calls 'wrong' net_store_data sql/protocol.h: I tried not to do net_store_data virtual - it's going to work a bit slower - using the fact that Protocol_simple and Protocol_prep have different implementation for 'store' methods. But now the store_string_aux method works for both. Well we still can try to make separate versions for Protocol_prep and Protocol_simple, but i prefer to make net_store_data virtual for embedded server so we won't have similar problems in the future --- sql/protocol.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sql/protocol.h') diff --git a/sql/protocol.h b/sql/protocol.h index 43230983db7..d7ce5425ad1 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -35,8 +35,10 @@ protected: enum enum_field_types *field_types; #endif uint field_count; +#ifndef EMBEDDED_LIBRARY bool net_store_data(const char *from, uint length); -#ifdef EMBEDDED_LIBRARY +#else + virtual bool net_store_data(const char *from, uint length); char **next_field; MYSQL_FIELD *next_mysql_field; MEM_ROOT *alloc; -- cgit v1.2.1