Commit c12a5975 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into  zippy.(none):/home/cmiller/work/mysql/mysql-5.1-new__bug18078


BitKeeper/etc/config:
  Auto merged
VC++Files/mysql.sln:
  Auto merged
VC++Files/mysys/mysys.vcproj:
  Auto merged
mysql-test/r/ps.result:
  Auto merged
mysql-test/r/ps_1general.result:
  Auto merged
mysql-test/r/timezone2.result:
  Auto merged
mysql-test/t/ps.test:
  Auto merged
mysql-test/t/ps_1general.test:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/tztime.cc:
  Auto merged
sql/tztime.h:
  Auto merged
tests/Makefile.am:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
parents 4e3dd4cc 435f3396
...@@ -257,6 +257,7 @@ EndProject ...@@ -257,6 +257,7 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_client_test", "tests\mysql_client_test.vcproj", "{DA224DAB-5006-42BE-BB77-16E8BE5326D5}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_client_test", "tests\mysql_client_test.vcproj", "{DA224DAB-5006-42BE-BB77-16E8BE5326D5}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{26383276-4843-494B-8BE0-8936ED3EBAAB} = {26383276-4843-494B-8BE0-8936ED3EBAAB} {26383276-4843-494B-8BE0-8936ED3EBAAB} = {26383276-4843-494B-8BE0-8936ED3EBAAB}
{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlmanager", "server-tools\instance-manager\mysqlmanager.vcproj", "{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlmanager", "server-tools\instance-manager\mysqlmanager.vcproj", "{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}"
......
...@@ -3232,6 +3232,49 @@ ...@@ -3232,6 +3232,49 @@
PreprocessorDefinitions=""/> PreprocessorDefinitions=""/>
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="my_memmem.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Max|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="TLS_DEBUG|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="TLS|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File <File
RelativePath="my_messnc.c"> RelativePath="my_messnc.c">
<FileConfiguration <FileConfiguration
......
...@@ -307,7 +307,7 @@ int main(int argc, char **argv) ...@@ -307,7 +307,7 @@ int main(int argc, char **argv)
b_read= my_read(check_file, chf_buffer, sizeof(chf_buffer)-1, MYF(0)); b_read= my_read(check_file, chf_buffer, sizeof(chf_buffer)-1, MYF(0));
chf_buffer[b_read]= 0; chf_buffer[b_read]= 0;
my_close(check_file, MYF(0)); my_close(check_file, MYF(0));
if (!strcmp(chf_buffer, VERSION)) if (!strcmp(chf_buffer, MYSQL_SERVER_VERSION))
{ {
if (opt_verbose) if (opt_verbose)
puts("mysql_upgrade already done for this version"); puts("mysql_upgrade already done for this version");
......
...@@ -1056,3 +1056,104 @@ a b ...@@ -1056,3 +1056,104 @@ a b
1 9 1 9
3 7 3 7
drop table t1; drop table t1;
create table t1 (a int);
create table t2 like t1;
create table t3 like t2;
prepare stmt from "repair table t1";
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
prepare stmt from "optimize table t1";
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status OK
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
prepare stmt from "analyze table t1";
execute stmt;
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
execute stmt;
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
prepare stmt from "repair table t1, t2, t3";
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t2 repair status OK
test.t3 repair status OK
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t2 repair status OK
test.t3 repair status OK
prepare stmt from "optimize table t1, t2, t3";
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status OK
test.t2 optimize status OK
test.t3 optimize status OK
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
test.t2 optimize status Table is already up to date
test.t3 optimize status Table is already up to date
prepare stmt from "analyze table t1, t2, t3";
execute stmt;
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
test.t3 analyze status Table is already up to date
execute stmt;
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
test.t3 analyze status Table is already up to date
prepare stmt from "repair table t1, t4, t3";
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t4 repair error Table 'test.t4' doesn't exist
test.t3 repair status OK
Warnings:
Error 1146 Table 'test.t4' doesn't exist
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t4 repair error Table 'test.t4' doesn't exist
test.t3 repair status OK
Warnings:
Error 1146 Table 'test.t4' doesn't exist
prepare stmt from "optimize table t1, t3, t4";
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status OK
test.t3 optimize status OK
test.t4 optimize error Table 'test.t4' doesn't exist
Warnings:
Error 1146 Table 'test.t4' doesn't exist
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
test.t3 optimize status Table is already up to date
test.t4 optimize error Table 'test.t4' doesn't exist
Warnings:
Error 1146 Table 'test.t4' doesn't exist
prepare stmt from "analyze table t4, t1";
execute stmt;
Table Op Msg_type Msg_text
test.t4 analyze error Table 'test.t4' doesn't exist
test.t1 analyze status Table is already up to date
Warnings:
Error 1146 Table 'test.t4' doesn't exist
execute stmt;
Table Op Msg_type Msg_text
test.t4 analyze error Table 'test.t4' doesn't exist
test.t1 analyze status Table is already up to date
Warnings:
Error 1146 Table 'test.t4' doesn't exist
deallocate prepare stmt;
...@@ -410,13 +410,10 @@ ERROR HY000: This command is not supported in the prepared statement protocol ye ...@@ -410,13 +410,10 @@ ERROR HY000: This command is not supported in the prepared statement protocol ye
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 '; prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
execute stmt1 ; execute stmt1 ;
prepare stmt1 from ' optimize table t1 ' ; prepare stmt1 from ' optimize table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' analyze table t1 ' ; prepare stmt1 from ' analyze table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' checksum table t1 ' ; prepare stmt1 from ' checksum table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' repair table t1 ' ; prepare stmt1 from ' repair table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ; prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' handler t1 open '; prepare stmt1 from ' handler t1 open ';
......
...@@ -286,12 +286,12 @@ id stmt_text status ...@@ -286,12 +286,12 @@ id stmt_text status
1 select 1 supported 1 select 1 supported
2 flush tables not supported 2 flush tables not supported
3 handler t1 open as ha not supported 3 handler t1 open as ha not supported
4 analyze table t1 not supported 4 analyze table t1 supported
5 check table t1 not supported 5 check table t1 not supported
6 checksum table t1 not supported 6 checksum table t1 not supported
7 check table t1 not supported 7 check table t1 not supported
8 optimize table t1 not supported 8 optimize table t1 supported
9 repair table t1 not supported 9 repair table t1 supported
10 describe extended select * from t1 supported 10 describe extended select * from t1 supported
11 help help not supported 11 help help not supported
12 show databases supported 12 show databases supported
......
drop table if exists t1, t2; drop table if exists t1, t2;
drop function if exists f1;
create table t1 (ts timestamp); create table t1 (ts timestamp);
set time_zone='+00:00'; set time_zone='+00:00';
select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp()); select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
...@@ -268,3 +269,17 @@ select * from t1; ...@@ -268,3 +269,17 @@ select * from t1;
convert_tz(NULL, NULL, NULL) convert_tz(NULL, NULL, NULL)
NULL NULL
drop table t1; drop table t1;
create table t1 (ldt datetime, udt datetime);
create function f1(i datetime) returns datetime
return convert_tz(i, 'UTC', 'Europe/Moscow');
create trigger t1_bi before insert on t1 for each row
set new.udt:= convert_tz(new.ldt, 'Europe/Moscow', 'UTC');
insert into t1 (ldt) values ('2006-04-19 16:30:00');
select * from t1;
ldt udt
2006-04-19 16:30:00 2006-04-19 12:30:00
select ldt, f1(udt) as ldt2 from t1;
ldt ldt2
2006-04-19 16:30:00 2006-04-19 16:30:00
drop table t1;
drop function f1;
...@@ -1110,4 +1110,40 @@ select * from t1 order by 1+1; ...@@ -1110,4 +1110,40 @@ select * from t1 order by 1+1;
drop table t1; drop table t1;
#
# Bug#19308 "REPAIR/OPTIMIZE/ANALYZE supported in SP but not in PS".
# Add test coverage for the added commands.
#
create table t1 (a int);
create table t2 like t1;
create table t3 like t2;
prepare stmt from "repair table t1";
execute stmt;
execute stmt;
prepare stmt from "optimize table t1";
execute stmt;
execute stmt;
prepare stmt from "analyze table t1";
execute stmt;
execute stmt;
prepare stmt from "repair table t1, t2, t3";
execute stmt;
execute stmt;
prepare stmt from "optimize table t1, t2, t3";
execute stmt;
execute stmt;
prepare stmt from "analyze table t1, t2, t3";
execute stmt;
execute stmt;
prepare stmt from "repair table t1, t4, t3";
execute stmt;
execute stmt;
prepare stmt from "optimize table t1, t3, t4";
execute stmt;
execute stmt;
prepare stmt from "analyze table t4, t1";
execute stmt;
execute stmt;
deallocate prepare stmt;
# End of 5.0 tests # End of 5.0 tests
...@@ -456,13 +456,10 @@ into table t1 fields terminated by ''\t'' '; ...@@ -456,13 +456,10 @@ into table t1 fields terminated by ''\t'' ';
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 '; prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
execute stmt1 ; execute stmt1 ;
## ##
--error 1295
prepare stmt1 from ' optimize table t1 ' ; prepare stmt1 from ' optimize table t1 ' ;
--error 1295
prepare stmt1 from ' analyze table t1 ' ; prepare stmt1 from ' analyze table t1 ' ;
--error 1295 --error 1295
prepare stmt1 from ' checksum table t1 ' ; prepare stmt1 from ' checksum table t1 ' ;
--error 1295
prepare stmt1 from ' repair table t1 ' ; prepare stmt1 from ' repair table t1 ' ;
--error 1295 --error 1295
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ; prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# Preparing playground # Preparing playground
--disable_warnings --disable_warnings
drop table if exists t1, t2; drop table if exists t1, t2;
drop function if exists f1;
--enable_warnings --enable_warnings
...@@ -222,3 +223,22 @@ select * from t1; ...@@ -222,3 +223,22 @@ select * from t1;
drop table t1; drop table t1;
# End of 4.1 tests # End of 4.1 tests
#
# Test for bug #11081 "Using a CONVERT_TZ function in a stored function
# or trigger fails".
#
create table t1 (ldt datetime, udt datetime);
create function f1(i datetime) returns datetime
return convert_tz(i, 'UTC', 'Europe/Moscow');
create trigger t1_bi before insert on t1 for each row
set new.udt:= convert_tz(new.ldt, 'Europe/Moscow', 'UTC');
# This should work without errors
insert into t1 (ldt) values ('2006-04-19 16:30:00');
select * from t1;
# This should work without errors as well
select ldt, f1(udt) as ldt2 from t1;
drop table t1;
drop function f1;
# End of 5.0 tests
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
void *my_memmem(const void *haystack, size_t haystacklen, void *my_memmem(const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen) const void *needle, size_t needlelen)
{ {
const void *cursor; const unsigned char *cursor;
const void *last_possible_needle_location = haystack + haystacklen - needlelen; const unsigned char *last_possible_needle_location =
(unsigned char *)haystack + haystacklen - needlelen;
/* Easy answers */ /* Easy answers */
if (needlelen > haystacklen) return(NULL); if (needlelen > haystacklen) return(NULL);
......
...@@ -1755,6 +1755,9 @@ static bool check_prepared_statement(Prepared_statement *stmt, ...@@ -1755,6 +1755,9 @@ static bool check_prepared_statement(Prepared_statement *stmt,
case SQLCOM_CALL: case SQLCOM_CALL:
case SQLCOM_CREATE_VIEW: case SQLCOM_CREATE_VIEW:
case SQLCOM_DROP_VIEW: case SQLCOM_DROP_VIEW:
case SQLCOM_REPAIR:
case SQLCOM_ANALYZE:
case SQLCOM_OPTIMIZE:
break; break;
default: default:
......
...@@ -1382,11 +1382,30 @@ static LS_INFO *tz_lsis= 0; ...@@ -1382,11 +1382,30 @@ static LS_INFO *tz_lsis= 0;
static bool time_zone_tables_exist= 1; static bool time_zone_tables_exist= 1;
typedef struct st_tz_names_entry: public Sql_alloc /*
Names of tables (with their lengths) that are needed
for dynamical loading of time zone descriptions.
*/
static const LEX_STRING tz_tables_names[MY_TZ_TABLES_COUNT]=
{
{(char *) STRING_WITH_LEN("time_zone_name")},
{(char *) STRING_WITH_LEN("time_zone")},
{(char *) STRING_WITH_LEN("time_zone_transition_type")},
{(char *) STRING_WITH_LEN("time_zone_transition")}
};
/* Name of database to which those tables belong. */
static const LEX_STRING tz_tables_db_name= {(char *) STRING_WITH_LEN("mysql")};
class Tz_names_entry: public Sql_alloc
{ {
public:
String name; String name;
Time_zone *tz; Time_zone *tz;
} TZ_NAMES_ENTRY; };
/* /*
...@@ -1394,7 +1413,7 @@ typedef struct st_tz_names_entry: public Sql_alloc ...@@ -1394,7 +1413,7 @@ typedef struct st_tz_names_entry: public Sql_alloc
they should obey C calling conventions. they should obey C calling conventions.
*/ */
extern "C" byte* my_tz_names_get_key(TZ_NAMES_ENTRY *entry, uint *length, extern "C" byte* my_tz_names_get_key(Tz_names_entry *entry, uint *length,
my_bool not_used __attribute__((unused))) my_bool not_used __attribute__((unused)))
{ {
*length= entry->name.length(); *length= entry->name.length();
...@@ -1415,7 +1434,8 @@ extern "C" byte* my_offset_tzs_get_key(Time_zone_offset *entry, uint *length, ...@@ -1415,7 +1434,8 @@ extern "C" byte* my_offset_tzs_get_key(Time_zone_offset *entry, uint *length,
SYNOPSIS SYNOPSIS
tz_init_table_list() tz_init_table_list()
tz_tabs - pointer to preallocated array of 4 TABLE_LIST objects tz_tabs - pointer to preallocated array of MY_TZ_TABLES_COUNT
TABLE_LIST objects
global_next_ptr - pointer to variable which points to global_next member global_next_ptr - pointer to variable which points to global_next member
of last element of global table list (or list root of last element of global table list (or list root
then list is empty) (in/out). then list is empty) (in/out).
...@@ -1430,27 +1450,27 @@ extern "C" byte* my_offset_tzs_get_key(Time_zone_offset *entry, uint *length, ...@@ -1430,27 +1450,27 @@ extern "C" byte* my_offset_tzs_get_key(Time_zone_offset *entry, uint *length,
static void static void
tz_init_table_list(TABLE_LIST *tz_tabs, TABLE_LIST ***global_next_ptr) tz_init_table_list(TABLE_LIST *tz_tabs, TABLE_LIST ***global_next_ptr)
{ {
bzero(tz_tabs, sizeof(TABLE_LIST) * 4); bzero(tz_tabs, sizeof(TABLE_LIST) * MY_TZ_TABLES_COUNT);
tz_tabs[0].alias= tz_tabs[0].table_name= (char*)"time_zone_name";
tz_tabs[1].alias= tz_tabs[1].table_name= (char*)"time_zone"; for (int i= 0; i < MY_TZ_TABLES_COUNT; i++)
tz_tabs[2].alias= tz_tabs[2].table_name= (char*)"time_zone_transition_type"; {
tz_tabs[3].alias= tz_tabs[3].table_name= (char*)"time_zone_transition"; tz_tabs[i].alias= tz_tabs[i].table_name= tz_tables_names[i].str;
tz_tabs[0].next_global= tz_tabs[0].next_local= tz_tabs+1; tz_tabs[i].table_name_length= tz_tables_names[i].length;
tz_tabs[1].next_global= tz_tabs[1].next_local= tz_tabs+2; tz_tabs[i].db= tz_tables_db_name.str;
tz_tabs[2].next_global= tz_tabs[2].next_local= tz_tabs+3; tz_tabs[i].db_length= tz_tables_db_name.length;
tz_tabs[0].lock_type= tz_tabs[1].lock_type= tz_tabs[2].lock_type= tz_tabs[i].lock_type= TL_READ;
tz_tabs[3].lock_type= TL_READ;
tz_tabs[0].db= tz_tabs[1].db= tz_tabs[2].db= tz_tabs[3].db= (char *)"mysql"; if (i != MY_TZ_TABLES_COUNT - 1)
tz_tabs[i].next_global= tz_tabs[i].next_local= &tz_tabs[i+1];
if (i != 0)
tz_tabs[i].prev_global= &tz_tabs[i-1].next_global;
}
/* Link into global list */ /* Link into global list */
tz_tabs[0].prev_global= *global_next_ptr; tz_tabs[0].prev_global= *global_next_ptr;
tz_tabs[1].prev_global= &tz_tabs[0].next_global;
tz_tabs[2].prev_global= &tz_tabs[1].next_global;
tz_tabs[3].prev_global= &tz_tabs[2].next_global;
**global_next_ptr= tz_tabs; **global_next_ptr= tz_tabs;
/* Update last-global-pointer to point to pointer in last table */ /* Update last-global-pointer to point to pointer in last table */
*global_next_ptr= &tz_tabs[3].next_global; *global_next_ptr= &tz_tabs[MY_TZ_TABLES_COUNT-1].next_global;
} }
...@@ -1479,7 +1499,8 @@ TABLE_LIST fake_time_zone_tables_list; ...@@ -1479,7 +1499,8 @@ TABLE_LIST fake_time_zone_tables_list;
NOTE NOTE
my_tz_check_n_skip_implicit_tables() function depends on fact that my_tz_check_n_skip_implicit_tables() function depends on fact that
elements of list created are allocated as TABLE_LIST[4] array. elements of list created are allocated as TABLE_LIST[MY_TZ_TABLES_COUNT]
array.
RETURN VALUES RETURN VALUES
Returns pointer to first TABLE_LIST object, (could be 0 if time zone Returns pointer to first TABLE_LIST object, (could be 0 if time zone
...@@ -1495,7 +1516,8 @@ my_tz_get_table_list(THD *thd, TABLE_LIST ***global_next_ptr) ...@@ -1495,7 +1516,8 @@ my_tz_get_table_list(THD *thd, TABLE_LIST ***global_next_ptr)
if (!time_zone_tables_exist) if (!time_zone_tables_exist)
DBUG_RETURN(0); DBUG_RETURN(0);
if (!(tz_tabs= (TABLE_LIST *)thd->alloc(sizeof(TABLE_LIST) * 4))) if (!(tz_tabs= (TABLE_LIST *)thd->alloc(sizeof(TABLE_LIST) *
MY_TZ_TABLES_COUNT)))
DBUG_RETURN(&fake_time_zone_tables_list); DBUG_RETURN(&fake_time_zone_tables_list);
tz_init_table_list(tz_tabs, global_next_ptr); tz_init_table_list(tz_tabs, global_next_ptr);
...@@ -1534,9 +1556,9 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap) ...@@ -1534,9 +1556,9 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
{ {
THD *thd; THD *thd;
TABLE_LIST *tables= 0; TABLE_LIST *tables= 0;
TABLE_LIST tables_buff[5], **last_global_next_ptr; TABLE_LIST tables_buff[1+MY_TZ_TABLES_COUNT], **last_global_next_ptr;
TABLE *table; TABLE *table;
TZ_NAMES_ENTRY *tmp_tzname; Tz_names_entry *tmp_tzname;
my_bool return_val= 1; my_bool return_val= 1;
int res; int res;
DBUG_ENTER("my_tz_init"); DBUG_ENTER("my_tz_init");
...@@ -1568,7 +1590,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap) ...@@ -1568,7 +1590,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
tz_inited= 1; tz_inited= 1;
/* Add 'SYSTEM' time zone to tz_names hash */ /* Add 'SYSTEM' time zone to tz_names hash */
if (!(tmp_tzname= new (&tz_storage) TZ_NAMES_ENTRY())) if (!(tmp_tzname= new (&tz_storage) Tz_names_entry()))
{ {
sql_print_error("Fatal error: OOM while initializing time zones"); sql_print_error("Fatal error: OOM while initializing time zones");
goto end_with_cleanup; goto end_with_cleanup;
...@@ -1764,7 +1786,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) ...@@ -1764,7 +1786,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
{ {
TABLE *table= 0; TABLE *table= 0;
TIME_ZONE_INFO *tz_info; TIME_ZONE_INFO *tz_info;
TZ_NAMES_ENTRY *tmp_tzname; Tz_names_entry *tmp_tzname;
Time_zone *return_val= 0; Time_zone *return_val= 0;
int res; int res;
uint tzid, ttid; uint tzid, ttid;
...@@ -2039,7 +2061,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) ...@@ -2039,7 +2061,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
} }
if (!(tmp_tzname= new (&tz_storage) TZ_NAMES_ENTRY()) || if (!(tmp_tzname= new (&tz_storage) Tz_names_entry()) ||
!(tmp_tzname->tz= new (&tz_storage) Time_zone_db(tz_info, !(tmp_tzname->tz= new (&tz_storage) Time_zone_db(tz_info,
&(tmp_tzname->name))) || &(tmp_tzname->name))) ||
(tmp_tzname->name.set(tz_name_buff, tz_name->length(), (tmp_tzname->name.set(tz_name_buff, tz_name->length(),
...@@ -2186,7 +2208,7 @@ str_to_offset(const char *str, uint length, long *offset) ...@@ -2186,7 +2208,7 @@ str_to_offset(const char *str, uint length, long *offset)
Time_zone * Time_zone *
my_tz_find(const String * name, TABLE_LIST *tz_tables) my_tz_find(const String * name, TABLE_LIST *tz_tables)
{ {
TZ_NAMES_ENTRY *tmp_tzname; Tz_names_entry *tmp_tzname;
Time_zone *result_tz= 0; Time_zone *result_tz= 0;
long offset; long offset;
DBUG_ENTER("my_tz_find"); DBUG_ENTER("my_tz_find");
...@@ -2221,7 +2243,7 @@ my_tz_find(const String * name, TABLE_LIST *tz_tables) ...@@ -2221,7 +2243,7 @@ my_tz_find(const String * name, TABLE_LIST *tz_tables)
else else
{ {
result_tz= 0; result_tz= 0;
if ((tmp_tzname= (TZ_NAMES_ENTRY *)hash_search(&tz_names, if ((tmp_tzname= (Tz_names_entry *)hash_search(&tz_names,
(const byte *)name->ptr(), (const byte *)name->ptr(),
name->length()))) name->length())))
result_tz= tmp_tzname->tz; result_tz= tmp_tzname->tz;
...@@ -2273,7 +2295,7 @@ Time_zone *my_tz_find_with_opening_tz_tables(THD *thd, const String *name) ...@@ -2273,7 +2295,7 @@ Time_zone *my_tz_find_with_opening_tz_tables(THD *thd, const String *name)
our time zone tables. Note that if we don't have tz tables on this our time zone tables. Note that if we don't have tz tables on this
slave, we don't even try. slave, we don't even try.
*/ */
TABLE_LIST tables[4]; TABLE_LIST tables[MY_TZ_TABLES_COUNT];
TABLE_LIST *dummy; TABLE_LIST *dummy;
TABLE_LIST **dummyp= &dummy; TABLE_LIST **dummyp= &dummy;
tz_init_table_list(tables, &dummyp); tz_init_table_list(tables, &dummyp);
......
...@@ -69,6 +69,15 @@ extern my_time_t sec_since_epoch_TIME(TIME *t); ...@@ -69,6 +69,15 @@ extern my_time_t sec_since_epoch_TIME(TIME *t);
extern TABLE_LIST fake_time_zone_tables_list; extern TABLE_LIST fake_time_zone_tables_list;
/*
Number of elements in table list produced by my_tz_get_table_list()
(this table list contains tables which are needed for dynamical loading
of time zone descriptions). Actually it is imlementation detail that
should not be used anywhere outside of tztime.h and tztime.cc.
*/
static const int MY_TZ_TABLES_COUNT= 4;
/* /*
Check if we have pointer to the begining of list of implicitly used time Check if we have pointer to the begining of list of implicitly used time
zone tables, set SELECT_ACL for them and fast-forward to its end. zone tables, set SELECT_ACL for them and fast-forward to its end.
...@@ -91,9 +100,9 @@ inline bool my_tz_check_n_skip_implicit_tables(TABLE_LIST **table, ...@@ -91,9 +100,9 @@ inline bool my_tz_check_n_skip_implicit_tables(TABLE_LIST **table,
{ {
if (*table == tz_tables) if (*table == tz_tables)
{ {
for (int i= 0; i < 4; i++) for (int i= 0; i < MY_TZ_TABLES_COUNT; i++)
(*table)[i].grant.privilege= SELECT_ACL; (*table)[i].grant.privilege= SELECT_ACL;
(*table)+= 3; (*table)+= MY_TZ_TABLES_COUNT - 1;
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
......
...@@ -43,7 +43,7 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ ...@@ -43,7 +43,7 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
LIBS = @CLIENT_LIBS@ LIBS = @CLIENT_LIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ \ LDADD = @CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql/libmysqlclient.la $(top_builddir)/libmysql/libmysqlclient.la
mysql_client_test_LDADD= $(LDADD) $(CXXLDFLAGS) -lmysys -L../mysys mysql_client_test_LDADD= $(LDADD) $(CXXLDFLAGS) -L../mysys -lmysys
mysql_client_test_SOURCES= mysql_client_test.c $(yassl_dummy_link_fix) mysql_client_test_SOURCES= mysql_client_test.c $(yassl_dummy_link_fix)
insert_test_SOURCES= insert_test.c $(yassl_dummy_link_fix) insert_test_SOURCES= insert_test.c $(yassl_dummy_link_fix)
select_test_SOURCES= select_test.c $(yassl_dummy_link_fix) select_test_SOURCES= select_test.c $(yassl_dummy_link_fix)
......
...@@ -14846,7 +14846,6 @@ static void test_bug15613() ...@@ -14846,7 +14846,6 @@ static void test_bug15613()
static void test_bug17667() static void test_bug17667()
{ {
int rc; int rc;
myheader("test_bug17667");
struct buffer_and_length { struct buffer_and_length {
const char *buffer; const char *buffer;
const uint length; const uint length;
...@@ -14863,6 +14862,8 @@ static void test_bug17667() ...@@ -14863,6 +14862,8 @@ static void test_bug17667()
struct buffer_and_length *statement_cursor; struct buffer_and_length *statement_cursor;
FILE *log_file; FILE *log_file;
myheader("test_bug17667");
for (statement_cursor= statements; statement_cursor->buffer != NULL; for (statement_cursor= statements; statement_cursor->buffer != NULL;
statement_cursor++) { statement_cursor++) {
rc= mysql_real_query(mysql, statement_cursor->buffer, rc= mysql_real_query(mysql, statement_cursor->buffer,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment