Merge bodhi.local:/opt/local/work/tmp_merge
into bodhi.local:/opt/local/work/mysql-5.0-runtime-merge-41 BitKeeper/etc/ignore: auto-union libmysqld/Makefile.am: Auto merged myisam/mi_create.c: Auto merged mysql-test/r/date_formats.result: Auto merged mysql-test/t/date_formats.test: Auto merged sql/Makefile.am: Auto merged sql/item_timefunc.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.cc: Auto merged sql/sql_class.h: Auto merged support-files/mysql.spec.sh: Auto merged mysql-test/r/myisam.result: Manual merge. mysql-test/t/myisam.test: Manual merge. sql/set_var.cc: Manual merge. sql/set_var.h: Manual merge. sql/sql_cache.cc: Manual merge. sql/sql_class.cc: Manual merge.
This commit is contained in:
commit
60b7f9d645
19
.bzrignore
19
.bzrignore
@ -1,3 +1,5 @@
|
||||
*.Plo
|
||||
*.Po
|
||||
*.a
|
||||
*.bb
|
||||
*.bbg
|
||||
@ -9,6 +11,7 @@
|
||||
*.gcov
|
||||
*.idb
|
||||
*.la
|
||||
*.lai
|
||||
*.lib
|
||||
*.lo
|
||||
*.map
|
||||
@ -26,9 +29,6 @@
|
||||
*/.pure
|
||||
*~
|
||||
.*.swp
|
||||
*.Po
|
||||
*.Plo
|
||||
*.lai
|
||||
./README.build-files
|
||||
./config.h
|
||||
./copy_mysql_files.bat
|
||||
@ -45,9 +45,6 @@
|
||||
.gdb_history
|
||||
.gdbinit
|
||||
.libs
|
||||
client/.libs -prune
|
||||
tests/.libs -prune
|
||||
tools/.libs -prune
|
||||
.o
|
||||
.out
|
||||
.snprj/*
|
||||
@ -55,6 +52,7 @@ tools/.libs -prune
|
||||
50
|
||||
=6
|
||||
BUILD/compile-pentium-maintainer
|
||||
BitKeeper/etc/RESYNC_TREE
|
||||
BitKeeper/etc/config
|
||||
BitKeeper/etc/csets
|
||||
BitKeeper/etc/csets-in
|
||||
@ -286,6 +284,7 @@ build_tags.sh
|
||||
client/#mysql.cc#
|
||||
client/*.ds?
|
||||
client/*.vcproj
|
||||
client/.libs -prune
|
||||
client/completion_hash.cpp
|
||||
client/decimal.c
|
||||
client/insert_test
|
||||
@ -565,6 +564,7 @@ libmysqld/sql_insert.cc
|
||||
libmysqld/sql_lex.cc
|
||||
libmysqld/sql_list.cc
|
||||
libmysqld/sql_load.cc
|
||||
libmysqld/sql_locale.cc
|
||||
libmysqld/sql_manager.cc
|
||||
libmysqld/sql_map.cc
|
||||
libmysqld/sql_olap.cc
|
||||
@ -676,6 +676,7 @@ mysql-test/mysql-test-run.log
|
||||
mysql-test/mysql_test_run_new
|
||||
mysql-test/ndb/ndbcluster
|
||||
mysql-test/r/*.err
|
||||
mysql-test/r/*.log
|
||||
mysql-test/r/*.out
|
||||
mysql-test/r/*.reject
|
||||
mysql-test/r/alter_table.err
|
||||
@ -1068,6 +1069,7 @@ scripts/mysql_secure_installation
|
||||
scripts/mysql_setpermission
|
||||
scripts/mysql_tableinfo
|
||||
scripts/mysql_upgrade
|
||||
scripts/mysql_upgrade_shell
|
||||
scripts/mysql_zap
|
||||
scripts/mysqlaccess
|
||||
scripts/mysqlbug
|
||||
@ -1269,6 +1271,7 @@ test1/*
|
||||
test_xml
|
||||
tests/*.ds?
|
||||
tests/*.vcproj
|
||||
tests/.libs -prune
|
||||
tests/client_test
|
||||
tests/connect_test
|
||||
tests/mysql_client_test
|
||||
@ -1276,6 +1279,7 @@ thr_insert_test/*
|
||||
thr_test/*
|
||||
thread_test
|
||||
tmp/*
|
||||
tools/.libs -prune
|
||||
tools/my_vsnprintf.c
|
||||
tools/mysqlmanager
|
||||
tools/mysqlmngd
|
||||
@ -1292,6 +1296,3 @@ vio/viotest-sslconnect.cpp
|
||||
vio/viotest.cpp
|
||||
zlib/*.ds?
|
||||
zlib/*.vcproj
|
||||
BitKeeper/etc/RESYNC_TREE
|
||||
mysql-test/r/*.log
|
||||
scripts/mysql_upgrade_shell
|
||||
|
@ -51,7 +51,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
|
||||
key.cc lock.cc log.cc log_event.cc sql_state.c \
|
||||
protocol.cc net_serv.cc opt_range.cc \
|
||||
opt_sum.cc procedure.cc records.cc sql_acl.cc \
|
||||
sql_load.cc discover.cc \
|
||||
sql_load.cc discover.cc sql_locale.cc \
|
||||
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
|
||||
sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc \
|
||||
sql_lex.cc sql_list.cc sql_manager.cc sql_map.cc sql_parse.cc \
|
||||
|
@ -545,9 +545,20 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
|
||||
|
||||
if (ci->index_file_name)
|
||||
{
|
||||
fn_format(filename, ci->index_file_name,"",MI_NAME_IEXT,4);
|
||||
fn_format(linkname,name, "",MI_NAME_IEXT,4);
|
||||
linkname_ptr=linkname;
|
||||
if (options & HA_OPTION_TMP_TABLE)
|
||||
{
|
||||
char *path;
|
||||
/* chop off the table name, tempory tables use generated name */
|
||||
if ((path= strrchr(ci->index_file_name, FN_LIBCHAR)))
|
||||
*path= '\0';
|
||||
fn_format(filename, name, ci->index_file_name, MI_NAME_IEXT,
|
||||
MY_REPLACE_DIR | MY_UNPACK_FILENAME);
|
||||
}
|
||||
else
|
||||
fn_format(filename, ci->index_file_name, "",
|
||||
MI_NAME_IEXT, MY_UNPACK_FILENAME);
|
||||
fn_format(linkname, name, "", MI_NAME_IEXT, MY_UNPACK_FILENAME);
|
||||
linkname_ptr= linkname;
|
||||
/*
|
||||
Don't create the table if the link or file exists to ensure that one
|
||||
doesn't accidently destroy another table.
|
||||
@ -601,10 +612,21 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
|
||||
{
|
||||
if (ci->data_file_name)
|
||||
{
|
||||
fn_format(filename, ci->data_file_name,"",MI_NAME_DEXT,4);
|
||||
fn_format(linkname, name, "",MI_NAME_DEXT,4);
|
||||
linkname_ptr=linkname;
|
||||
create_flag=0;
|
||||
if (options & HA_OPTION_TMP_TABLE)
|
||||
{
|
||||
char *path;
|
||||
/* chop off the table name, tempory tables use generated name */
|
||||
if ((path= strrchr(ci->data_file_name, FN_LIBCHAR)))
|
||||
*path= '\0';
|
||||
fn_format(filename, name, ci->data_file_name, MI_NAME_DEXT,
|
||||
MY_REPLACE_DIR | MY_UNPACK_FILENAME);
|
||||
}
|
||||
else
|
||||
fn_format(filename, ci->data_file_name, "",
|
||||
MI_NAME_DEXT, MY_UNPACK_FILENAME);
|
||||
fn_format(linkname, name, "", MI_NAME_DEXT, MY_UNPACK_FILENAME);
|
||||
linkname_ptr= linkname;
|
||||
create_flag= 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -495,6 +495,22 @@ f1 f2
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect date value: '2003-04-05 g'
|
||||
Warning 1292 Truncated incorrect datetime value: '2003-04-05 10:11:12.101010234567'
|
||||
set names latin1;
|
||||
select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
|
||||
date_format('2004-01-01','%W (%a), %e %M (%b) %Y')
|
||||
Thursday (Thu), 1 January (Jan) 2004
|
||||
set lc_time_names=ru_RU;
|
||||
set names koi8r;
|
||||
select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
|
||||
date_format('2004-01-01','%W (%a), %e %M (%b) %Y')
|
||||
þÅÔ×ÅÒÇ (þÔ×), 1 ñÎ×ÁÒÑ (ñÎ×) 2004
|
||||
set lc_time_names=de_DE;
|
||||
set names latin1;
|
||||
select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
|
||||
date_format('2004-01-01','%W (%a), %e %M (%b) %Y')
|
||||
Donnerstag (Do), 1 Januar (Jan) 2004
|
||||
set names latin1;
|
||||
set lc_time_names=en_US;
|
||||
create table t1 (f1 datetime);
|
||||
insert into t1 (f1) values ("2005-01-01");
|
||||
insert into t1 (f1) values ("2005-02-01");
|
||||
|
@ -1454,3 +1454,24 @@ create table t3 (c1 int) engine=myisam pack_keys=default;
|
||||
create table t4 (c1 int) engine=myisam pack_keys=2;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2' at line 1
|
||||
drop table t1, t2, t3;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TEMPORARY TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TEMPORARY TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
create table t1 (a int) engine=myisam select 42 a;
|
||||
select * from t1;
|
||||
a
|
||||
9
|
||||
select * from t1;
|
||||
a
|
||||
99
|
||||
select * from t1;
|
||||
a
|
||||
42
|
||||
drop table t1;
|
||||
|
@ -261,6 +261,20 @@ select str_to_date("2003-04-05 g", "%Y-%m-%d") as f1,
|
||||
str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2;
|
||||
--enable_ps_protocol
|
||||
|
||||
#
|
||||
# Test of locale dependent date format (WL#2928 Date Translation NRE)
|
||||
#
|
||||
set names latin1;
|
||||
select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
|
||||
set lc_time_names=ru_RU;
|
||||
set names koi8r;
|
||||
select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
|
||||
set lc_time_names=de_DE;
|
||||
set names latin1;
|
||||
select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
|
||||
set names latin1;
|
||||
set lc_time_names=en_US;
|
||||
|
||||
#
|
||||
# Bug #14016
|
||||
#
|
||||
|
@ -718,8 +718,6 @@ UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb';
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Test varchar
|
||||
#
|
||||
@ -844,3 +842,35 @@ create table t3 (c1 int) engine=myisam pack_keys=default;
|
||||
--error 1064
|
||||
create table t4 (c1 int) engine=myisam pack_keys=2;
|
||||
drop table t1, t2, t3;
|
||||
#
|
||||
# Bug#8706 - temporary table with data directory option fails
|
||||
#
|
||||
connect (session1,localhost,root,,);
|
||||
connect (session2,localhost,root,,);
|
||||
|
||||
connection session1;
|
||||
disable_query_log;
|
||||
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/tmp" select 9 a;
|
||||
enable_query_log;
|
||||
show create table t1;
|
||||
|
||||
connection session2;
|
||||
disable_query_log;
|
||||
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/tmp" select 99 a;
|
||||
enable_query_log;
|
||||
show create table t1;
|
||||
|
||||
connection default;
|
||||
create table t1 (a int) engine=myisam select 42 a;
|
||||
|
||||
connection session1;
|
||||
select * from t1;
|
||||
disconnect session1;
|
||||
connection session2;
|
||||
select * from t1;
|
||||
disconnect session2;
|
||||
connection default;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -79,7 +79,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
|
||||
mysqld.cc password.c hash_filo.cc hostname.cc \
|
||||
set_var.cc sql_parse.cc sql_yacc.yy \
|
||||
sql_base.cc table.cc sql_select.cc sql_insert.cc \
|
||||
sql_prepare.cc sql_error.cc \
|
||||
sql_prepare.cc sql_error.cc sql_locale.cc \
|
||||
sql_update.cc sql_delete.cc uniques.cc sql_do.cc \
|
||||
procedure.cc item_uniq.cc sql_test.cc \
|
||||
log.cc log_event.cc init.cc derror.cc sql_acl.cc \
|
||||
|
@ -30,25 +30,6 @@
|
||||
/* Day number for Dec 31st, 9999 */
|
||||
#define MAX_DAY_NUMBER 3652424L
|
||||
|
||||
static const char *month_names[]=
|
||||
{
|
||||
"January", "February", "March", "April", "May", "June", "July", "August",
|
||||
"September", "October", "November", "December", NullS
|
||||
};
|
||||
|
||||
TYPELIB month_names_typelib=
|
||||
{ array_elements(month_names)-1,"", month_names, NULL };
|
||||
|
||||
static const char *day_names[]=
|
||||
{
|
||||
"Monday", "Tuesday", "Wednesday",
|
||||
"Thursday", "Friday", "Saturday" ,"Sunday", NullS
|
||||
};
|
||||
|
||||
TYPELIB day_names_typelib=
|
||||
{ array_elements(day_names)-1,"", day_names, NULL};
|
||||
|
||||
|
||||
/*
|
||||
OPTIMIZATION TODO:
|
||||
- Replace the switch with a function that should be called for each
|
||||
@ -223,8 +204,12 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
|
||||
val= tmp;
|
||||
break;
|
||||
case 'M':
|
||||
if ((l_time->month= check_word(my_locale_en_US.month_names,
|
||||
val, val_end, &val)) <= 0)
|
||||
goto err;
|
||||
break;
|
||||
case 'b':
|
||||
if ((l_time->month= check_word(&month_names_typelib,
|
||||
if ((l_time->month= check_word(my_locale_en_US.ab_month_names,
|
||||
val, val_end, &val)) <= 0)
|
||||
goto err;
|
||||
break;
|
||||
@ -299,8 +284,11 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
|
||||
|
||||
/* Exotic things */
|
||||
case 'W':
|
||||
if ((weekday= check_word(my_locale_en_US.day_names, val, val_end, &val)) <= 0)
|
||||
goto err;
|
||||
break;
|
||||
case 'a':
|
||||
if ((weekday= check_word(&day_names_typelib, val, val_end, &val)) <= 0)
|
||||
if ((weekday= check_word(my_locale_en_US.ab_day_names, val, val_end, &val)) <= 0)
|
||||
goto err;
|
||||
break;
|
||||
case 'w':
|
||||
@ -502,9 +490,15 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time,
|
||||
uint weekday;
|
||||
ulong length;
|
||||
const char *ptr, *end;
|
||||
MY_LOCALE *locale;
|
||||
THD *thd= current_thd;
|
||||
char buf[128];
|
||||
String tmp(buf, thd->variables.character_set_results);
|
||||
uint errors= 0;
|
||||
|
||||
str->length(0);
|
||||
str->set_charset(&my_charset_bin);
|
||||
locale = thd->variables.lc_time_names;
|
||||
|
||||
if (l_time->neg)
|
||||
str->append('-');
|
||||
@ -520,26 +514,38 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time,
|
||||
case 'M':
|
||||
if (!l_time->month)
|
||||
return 1;
|
||||
str->append(month_names[l_time->month-1]);
|
||||
tmp.copy(locale->month_names->type_names[l_time->month-1],
|
||||
strlen(locale->month_names->type_names[l_time->month-1]),
|
||||
system_charset_info, tmp.charset(), &errors);
|
||||
str->append(tmp.ptr(), tmp.length());
|
||||
break;
|
||||
case 'b':
|
||||
if (!l_time->month)
|
||||
return 1;
|
||||
str->append(month_names[l_time->month-1],3);
|
||||
tmp.copy(locale->ab_month_names->type_names[l_time->month-1],
|
||||
strlen(locale->ab_month_names->type_names[l_time->month-1]),
|
||||
system_charset_info, tmp.charset(), &errors);
|
||||
str->append(tmp.ptr(), tmp.length());
|
||||
break;
|
||||
case 'W':
|
||||
if (type == MYSQL_TIMESTAMP_TIME)
|
||||
return 1;
|
||||
weekday= calc_weekday(calc_daynr(l_time->year,l_time->month,
|
||||
l_time->day),0);
|
||||
str->append(day_names[weekday]);
|
||||
tmp.copy(locale->day_names->type_names[weekday],
|
||||
strlen(locale->day_names->type_names[weekday]),
|
||||
system_charset_info, tmp.charset(), &errors);
|
||||
str->append(tmp.ptr(), tmp.length());
|
||||
break;
|
||||
case 'a':
|
||||
if (type == MYSQL_TIMESTAMP_TIME)
|
||||
return 1;
|
||||
weekday=calc_weekday(calc_daynr(l_time->year,l_time->month,
|
||||
l_time->day),0);
|
||||
str->append(day_names[weekday],3);
|
||||
tmp.copy(locale->ab_day_names->type_names[weekday],
|
||||
strlen(locale->ab_day_names->type_names[weekday]),
|
||||
system_charset_info, tmp.charset(), &errors);
|
||||
str->append(tmp.ptr(), tmp.length());
|
||||
break;
|
||||
case 'D':
|
||||
if (type == MYSQL_TIMESTAMP_TIME)
|
||||
@ -919,6 +925,7 @@ String* Item_func_monthname::val_str(String* str)
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
const char *month_name;
|
||||
uint month= (uint) val_int();
|
||||
THD *thd= current_thd;
|
||||
|
||||
if (null_value || !month)
|
||||
{
|
||||
@ -926,7 +933,7 @@ String* Item_func_monthname::val_str(String* str)
|
||||
return (String*) 0;
|
||||
}
|
||||
null_value=0;
|
||||
month_name= month_names[month-1];
|
||||
month_name= thd->variables.lc_time_names->month_names->type_names[month-1];
|
||||
str->set(month_name, strlen(month_name), system_charset_info);
|
||||
return str;
|
||||
}
|
||||
@ -1051,11 +1058,12 @@ String* Item_func_dayname::val_str(String* str)
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
uint weekday=(uint) val_int(); // Always Item_func_daynr()
|
||||
const char *name;
|
||||
THD *thd= current_thd;
|
||||
|
||||
if (null_value)
|
||||
return (String*) 0;
|
||||
|
||||
name= day_names[weekday];
|
||||
name= thd->variables.lc_time_names->day_names->type_names[weekday];
|
||||
str->set(name, strlen(name), system_charset_info);
|
||||
return str;
|
||||
}
|
||||
@ -1676,7 +1684,7 @@ uint Item_func_date_format::format_length(const String *format)
|
||||
switch(*++ptr) {
|
||||
case 'M': /* month, textual */
|
||||
case 'W': /* day (of the week), textual */
|
||||
size += 9;
|
||||
size += 64; /* large for UTF8 locale data */
|
||||
break;
|
||||
case 'D': /* day (of the month), numeric plus english suffix */
|
||||
case 'Y': /* year, numeric, 4 digits */
|
||||
@ -1686,6 +1694,8 @@ uint Item_func_date_format::format_length(const String *format)
|
||||
break;
|
||||
case 'a': /* locale's abbreviated weekday name (Sun..Sat) */
|
||||
case 'b': /* locale's abbreviated month name (Jan.Dec) */
|
||||
size += 32; /* large for UTF8 locale data */
|
||||
break;
|
||||
case 'j': /* day of year (001..366) */
|
||||
size += 3;
|
||||
break;
|
||||
|
@ -95,6 +95,23 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
|
||||
extern CHARSET_INFO *system_charset_info, *files_charset_info ;
|
||||
extern CHARSET_INFO *national_charset_info, *table_alias_charset;
|
||||
|
||||
|
||||
typedef struct my_locale_st
|
||||
{
|
||||
const char *name;
|
||||
const char *description;
|
||||
const bool is_ascii;
|
||||
TYPELIB *month_names;
|
||||
TYPELIB *ab_month_names;
|
||||
TYPELIB *day_names;
|
||||
TYPELIB *ab_day_names;
|
||||
} MY_LOCALE;
|
||||
|
||||
extern MY_LOCALE my_locale_en_US;
|
||||
extern MY_LOCALE *my_locales[];
|
||||
|
||||
MY_LOCALE *my_locale_by_name(const char *name);
|
||||
|
||||
/***************************************************************************
|
||||
Configuration parameters
|
||||
****************************************************************************/
|
||||
@ -567,6 +584,7 @@ struct Query_cache_query_flags
|
||||
ulong sql_mode;
|
||||
ulong max_sort_length;
|
||||
ulong group_concat_max_len;
|
||||
MY_LOCALE *lc_time_names;
|
||||
};
|
||||
#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags)
|
||||
#include "sql_cache.h"
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include <my_getopt.h>
|
||||
#include <thr_alarm.h>
|
||||
#include <myisam.h>
|
||||
|
||||
#ifdef HAVE_BERKELEY_DB
|
||||
#include "ha_berkeley.h"
|
||||
#endif
|
||||
@ -553,6 +554,9 @@ static sys_var_thd_ha_rows sys_select_limit("sql_select_limit",
|
||||
static sys_var_timestamp sys_timestamp("timestamp");
|
||||
static sys_var_last_insert_id sys_last_insert_id("last_insert_id");
|
||||
static sys_var_last_insert_id sys_identity("identity");
|
||||
|
||||
static sys_var_thd_lc_time_names sys_lc_time_names("lc_time_names");
|
||||
|
||||
static sys_var_insert_id sys_insert_id("insert_id");
|
||||
static sys_var_readonly sys_error_count("error_count",
|
||||
OPT_SESSION,
|
||||
@ -651,6 +655,7 @@ sys_var *sys_variables[]=
|
||||
&sys_key_cache_division_limit,
|
||||
&sys_key_cache_age_threshold,
|
||||
&sys_last_insert_id,
|
||||
&sys_lc_time_names,
|
||||
&sys_license,
|
||||
&sys_local_infile,
|
||||
&sys_log_binlog,
|
||||
@ -921,6 +926,7 @@ struct show_var_st init_vars[]= {
|
||||
{"large_files_support", (char*) &opt_large_files, SHOW_BOOL},
|
||||
{"large_page_size", (char*) &opt_large_page_size, SHOW_INT},
|
||||
{"large_pages", (char*) &opt_large_pages, SHOW_MY_BOOL},
|
||||
{sys_lc_time_names.name, (char*) &sys_lc_time_names, SHOW_SYS},
|
||||
{sys_license.name, (char*) &sys_license, SHOW_SYS},
|
||||
{sys_local_infile.name, (char*) &sys_local_infile, SHOW_SYS},
|
||||
#ifdef HAVE_MLOCKALL
|
||||
@ -2764,6 +2770,40 @@ byte *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type,
|
||||
return (byte*) &(max_user_connections);
|
||||
}
|
||||
|
||||
bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var)
|
||||
{
|
||||
char *locale_str =var->value->str_value.c_ptr();
|
||||
MY_LOCALE *locale_match= my_locale_by_name(locale_str);
|
||||
|
||||
if (locale_match == NULL)
|
||||
{
|
||||
my_printf_error(ER_UNKNOWN_ERROR,
|
||||
"Unknown locale: '%s'", MYF(0), locale_str);
|
||||
return 1;
|
||||
}
|
||||
var->save_result.locale_value= locale_match;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool sys_var_thd_lc_time_names::update(THD *thd, set_var *var)
|
||||
{
|
||||
thd->variables.lc_time_names= var->save_result.locale_value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
byte *sys_var_thd_lc_time_names::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
return (byte *)(thd->variables.lc_time_names->name);
|
||||
}
|
||||
|
||||
|
||||
void sys_var_thd_lc_time_names::set_default(THD *thd, enum_var_type type)
|
||||
{
|
||||
thd->variables.lc_time_names = &my_locale_en_US;
|
||||
}
|
||||
|
||||
/*
|
||||
Functions to update thd->options bits
|
||||
|
@ -28,6 +28,8 @@
|
||||
class sys_var;
|
||||
class set_var;
|
||||
typedef struct system_variables SV;
|
||||
typedef struct my_locale_st MY_LOCALE;
|
||||
|
||||
extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib;
|
||||
|
||||
typedef int (*sys_check_func)(THD *, set_var *);
|
||||
@ -810,6 +812,25 @@ public:
|
||||
void warn_deprecated(THD *thd);
|
||||
void set_default(THD *thd, enum_var_type type);
|
||||
bool update(THD *thd, set_var *var);
|
||||
}
|
||||
|
||||
|
||||
class sys_var_thd_lc_time_names :public sys_var_thd
|
||||
{
|
||||
public:
|
||||
sys_var_thd_lc_time_names(const char *name_arg):
|
||||
sys_var_thd(name_arg)
|
||||
{}
|
||||
bool check(THD *thd, set_var *var);
|
||||
SHOW_TYPE type() { return SHOW_CHAR; }
|
||||
bool check_update_type(Item_result type)
|
||||
{
|
||||
return type != STRING_RESULT; /* Only accept strings */
|
||||
}
|
||||
bool check_default(enum_var_type type) { return 0; }
|
||||
bool update(THD *thd, set_var *var);
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
virtual void set_default(THD *thd, enum_var_type type);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@ -844,6 +865,7 @@ public:
|
||||
ulonglong ulonglong_value;
|
||||
DATE_TIME_FORMAT *date_time_format;
|
||||
Time_zone *time_zone;
|
||||
MY_LOCALE *locale_value;
|
||||
} save_result;
|
||||
LEX_STRING base; /* for structs */
|
||||
|
||||
|
@ -814,6 +814,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
|
||||
flags.time_zone= thd->variables.time_zone;
|
||||
flags.sql_mode= thd->variables.sql_mode;
|
||||
flags.max_sort_length= thd->variables.max_sort_length;
|
||||
flags.lc_time_names= thd->variables.lc_time_names;
|
||||
flags.group_concat_max_len= thd->variables.group_concat_max_len;
|
||||
DBUG_PRINT("qcache", ("long %d, 4.1: %d, more results %d, pkt_nr: %d, \
|
||||
CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
|
||||
@ -1048,6 +1049,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
|
||||
flags.sql_mode= thd->variables.sql_mode;
|
||||
flags.max_sort_length= thd->variables.max_sort_length;
|
||||
flags.group_concat_max_len= thd->variables.group_concat_max_len;
|
||||
flags.lc_time_names= thd->variables.lc_time_names;
|
||||
DBUG_PRINT("qcache", ("long %d, 4.1: %d, more results %d, pkt_nr: %d, \
|
||||
CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
|
||||
sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
|
||||
|
@ -306,6 +306,7 @@ void THD::init(void)
|
||||
total_warn_count= 0;
|
||||
update_charset();
|
||||
bzero((char *) &status_var, sizeof(status_var));
|
||||
variables.lc_time_names = &my_locale_en_US;
|
||||
}
|
||||
|
||||
|
||||
|
@ -575,6 +575,9 @@ struct system_variables
|
||||
CHARSET_INFO *collation_database;
|
||||
CHARSET_INFO *collation_connection;
|
||||
|
||||
/* Locale Support */
|
||||
MY_LOCALE *lc_time_names;
|
||||
|
||||
Time_zone *time_zone;
|
||||
|
||||
/* DATE, DATETIME and TIME formats */
|
||||
|
1607
sql/sql_locale.cc
Normal file
1607
sql/sql_locale.cc
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user