mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge work:/home/bk/mysql-4.0
into serg.mysql.com:/usr/home/serg/Abk/mysql-4.0
This commit is contained in:
@ -20,12 +20,12 @@ pkginclude_HEADERS = dbug.h m_string.h my_sys.h my_list.h \
|
||||
mysql.h mysql_com.h mysqld_error.h mysql_embed.h \
|
||||
my_semaphore.h my_pthread.h my_no_pthread.h raid.h \
|
||||
errmsg.h my_global.h my_net.h my_alloc.h \
|
||||
my_getopt.h sslopt-longopts.h \
|
||||
my_getopt.h sslopt-longopts.h my_dir.h \
|
||||
sslopt-vars.h sslopt-case.h $(BUILT_SOURCES)
|
||||
noinst_HEADERS = config-win.h config-os2.h config-netware.h \
|
||||
nisam.h heap.h merge.h my_bitmap.h\
|
||||
myisam.h myisampack.h myisammrg.h ft_global.h\
|
||||
my_dir.h mysys_err.h my_base.h \
|
||||
mysys_err.h my_base.h \
|
||||
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
|
||||
my_aes.h my_tree.h hash.h thr_alarm.h \
|
||||
thr_lock.h t_ctype.h violite.h md5.h mysql_version.h.in
|
||||
|
@ -84,3 +84,23 @@ date date_time time_stamp
|
||||
2005-01-01 2005-01-01 00:00:00 20050101000000
|
||||
2030-01-01 2030-01-01 00:00:00 20300101000000
|
||||
drop table t1;
|
||||
show variables like 'new';
|
||||
Variable_name Value
|
||||
new OFF
|
||||
create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
|
||||
t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
|
||||
t14 timestamp(14));
|
||||
insert t1 values (0,0,0,0,0,0,0),
|
||||
("1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
|
||||
"1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
|
||||
"1997-12-31 23:47:59");
|
||||
select * from t1;
|
||||
t2 t4 t6 t8 t10 t12 t14
|
||||
00 0000 000000 00000000 0000000000 000000000000 00000000000000
|
||||
97 9712 971231 19971231 9712312347 971231234759 19971231234759
|
||||
set new=1;
|
||||
select * from t1;
|
||||
t2 t4 t6 t8 t10 t12 t14
|
||||
0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59
|
||||
drop table t1;
|
||||
|
@ -55,3 +55,17 @@ INSERT INTO t1 VALUES ("2030-01-01","2030-01-01 00:00:00",20300101000000);
|
||||
#INSERT INTO t1 VALUES ("2050-01-01","2050-01-01 00:00:00",20500101000000);
|
||||
SELECT * FROM t1;
|
||||
drop table t1;
|
||||
|
||||
show variables like 'new';
|
||||
create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
|
||||
t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
|
||||
t14 timestamp(14));
|
||||
insert t1 values (0,0,0,0,0,0,0),
|
||||
("1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
|
||||
"1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
|
||||
"1997-12-31 23:47:59");
|
||||
select * from t1;
|
||||
set new=1;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
|
27
sql/field.cc
27
sql/field.cc
@ -2621,9 +2621,9 @@ String *Field_timestamp::val_str(String *val_buffer,
|
||||
time_t time_arg;
|
||||
struct tm *l_time;
|
||||
struct tm tm_tmp;
|
||||
|
||||
val_buffer->alloc(field_length+1);
|
||||
char *to=(char*) val_buffer->ptr(),*end=to+field_length;
|
||||
my_bool new_format= (current_thd->variables.new_mode),
|
||||
full_year=(field_length == 8 || field_length == 14 || new_format);
|
||||
int real_field_length= new_format ? 19 : field_length;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
if (table->db_low_byte_first)
|
||||
@ -2634,17 +2634,23 @@ String *Field_timestamp::val_str(String *val_buffer,
|
||||
|
||||
if (temp == 0L)
|
||||
{ /* Zero time is "000000" */
|
||||
VOID(strfill(to,field_length,'0'));
|
||||
val_buffer->length(field_length);
|
||||
if (new_format)
|
||||
val_buffer->copy("0000-00-00 00:00:00", real_field_length);
|
||||
else
|
||||
val_buffer->copy("00000000000000", real_field_length);
|
||||
return val_buffer;
|
||||
}
|
||||
time_arg=(time_t) temp;
|
||||
localtime_r(&time_arg,&tm_tmp);
|
||||
l_time=&tm_tmp;
|
||||
|
||||
val_buffer->alloc(real_field_length+1);
|
||||
char *to=(char*) val_buffer->ptr(),*end=to+real_field_length;
|
||||
|
||||
for (pos=0; to < end ; pos++)
|
||||
{
|
||||
bool year_flag=0;
|
||||
switch (dayord.pos[pos]) {
|
||||
switch (pos) {
|
||||
case 0: part_time=l_time->tm_year % 100; year_flag=1; break;
|
||||
case 1: part_time=l_time->tm_mon+1; break;
|
||||
case 2: part_time=l_time->tm_mday; break;
|
||||
@ -2653,7 +2659,7 @@ String *Field_timestamp::val_str(String *val_buffer,
|
||||
case 5: part_time=l_time->tm_sec; break;
|
||||
default: part_time=0; break; /* purecov: deadcode */
|
||||
}
|
||||
if (year_flag && (field_length == 8 || field_length == 14))
|
||||
if (year_flag && full_year)
|
||||
{
|
||||
if (part_time < YY_PART_YEAR)
|
||||
{
|
||||
@ -2666,7 +2672,14 @@ String *Field_timestamp::val_str(String *val_buffer,
|
||||
}
|
||||
*to++=(char) ('0'+((uint) part_time/10));
|
||||
*to++=(char) ('0'+((uint) part_time % 10));
|
||||
if (new_format)
|
||||
{
|
||||
static const char delim[6]="-- ::";
|
||||
*to++=delim[pos];
|
||||
}
|
||||
}
|
||||
if (new_format)
|
||||
to--;
|
||||
*to=0; // Safeguard
|
||||
val_buffer->length((uint) (to-val_buffer->ptr()));
|
||||
return val_buffer;
|
||||
|
@ -3340,7 +3340,7 @@ struct my_option my_long_options[] =
|
||||
{"log-long-format", OPT_LONG_FORMAT,
|
||||
"Log some extra information to update log", 0, 0, 0, GET_NO_ARG, NO_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
{"log-slave-updates", OPT_LOG_SLAVE_UPDATES,
|
||||
{"log-slave-updates", OPT_LOG_SLAVE_UPDATES,
|
||||
"Tells the slave to log the updates from the slave thread to the binary log. You will need to turn it on if you plan to daisy-chain the slaves.",
|
||||
(gptr*) &opt_log_slave_updates, (gptr*) &opt_log_slave_updates, 0, GET_BOOL,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
@ -3349,7 +3349,7 @@ struct my_option my_long_options[] =
|
||||
(gptr*) &global_system_variables.low_priority_updates,
|
||||
(gptr*) &max_system_variables.low_priority_updates,
|
||||
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"master-host", OPT_MASTER_HOST,
|
||||
{"master-host", OPT_MASTER_HOST,
|
||||
"Master hostname or IP address for replication. If not set, the slave thread will not be started. Note that the setting of master-host will be ignored if there exists a valid master.info file.",
|
||||
(gptr*) &master_host, (gptr*) &master_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
|
||||
0, 0, 0, 0},
|
||||
@ -3423,8 +3423,10 @@ struct my_option my_long_options[] =
|
||||
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
|
||||
"Simulate memory shortage when compiled with the --with-debug=full option",
|
||||
0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"new", 'n', "Use very new possible 'unsafe' functions", 0, 0, 0, GET_NO_ARG,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"new", 'n', "Use very new possible 'unsafe' functions",
|
||||
(gptr*) &global_system_variables.new_mode,
|
||||
(gptr*) &max_system_variables.new_mode,
|
||||
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifdef NOT_YET
|
||||
{"no-mix-table-types", OPT_NO_MIX_TYPE, "Don't allow commands with uses two different table types",
|
||||
(gptr*) &opt_no_mix_types, (gptr*) &opt_no_mix_types, 0, GET_BOOL, NO_ARG,
|
||||
@ -4222,9 +4224,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
case 'L':
|
||||
strmake(language, argument, sizeof(language)-1);
|
||||
break;
|
||||
case 'n':
|
||||
opt_specialflag|= SPECIAL_NEW_FUNC;
|
||||
break;
|
||||
case 'o':
|
||||
protocol_version=PROTOCOL_VERSION-1;
|
||||
break;
|
||||
@ -4232,9 +4231,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
init_slave_skip_errors(argument);
|
||||
break;
|
||||
case OPT_SAFEMALLOC_MEM_LIMIT:
|
||||
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
|
||||
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
|
||||
safemalloc_mem_limit = atoi(argument);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
case OPT_MAX_ALLOWED_PACKET:
|
||||
|
@ -179,6 +179,7 @@ sys_var_thd_ulong sys_net_write_timeout("net_write_timeout",
|
||||
sys_var_thd_ulong sys_net_retry_count("net_retry_count",
|
||||
&SV::net_retry_count,
|
||||
fix_net_retry_count);
|
||||
sys_var_thd_bool sys_new_mode("new", &SV::new_mode);
|
||||
sys_var_thd_ulong sys_read_buff_size("read_buffer_size",
|
||||
&SV::read_buff_size);
|
||||
sys_var_thd_ulong sys_read_rnd_buff_size("read_rnd_buffer_size",
|
||||
@ -347,6 +348,7 @@ sys_var *sys_variables[]=
|
||||
&sys_net_retry_count,
|
||||
&sys_net_wait_timeout,
|
||||
&sys_net_write_timeout,
|
||||
&sys_new_mode,
|
||||
&sys_query_cache_size,
|
||||
#ifdef HAVE_QUERY_CACHE
|
||||
&sys_query_cache_limit,
|
||||
@ -490,6 +492,7 @@ struct show_var_st init_vars[]= {
|
||||
{sys_net_read_timeout.name, (char*) &sys_net_read_timeout, SHOW_SYS},
|
||||
{sys_net_retry_count.name, (char*) &sys_net_retry_count, SHOW_SYS},
|
||||
{sys_net_write_timeout.name,(char*) &sys_net_write_timeout, SHOW_SYS},
|
||||
{sys_new_mode.name, (char*) &sys_new_mode, SHOW_SYS},
|
||||
{"open_files_limit", (char*) &open_files_limit, SHOW_LONG},
|
||||
{"pid_file", (char*) pidfile_name, SHOW_CHAR},
|
||||
{"log_error", (char*) log_error_file, SHOW_CHAR},
|
||||
|
@ -310,7 +310,8 @@ struct system_variables
|
||||
ulong table_type;
|
||||
|
||||
my_bool log_warnings;
|
||||
my_bool low_priority_updates;
|
||||
my_bool low_priority_updates;
|
||||
my_bool new_mode;
|
||||
|
||||
CONVERT *convert_set;
|
||||
};
|
||||
|
@ -1957,6 +1957,8 @@ mysql_execute_command(void)
|
||||
case SQLCOM_TRUNCATE:
|
||||
if (check_access(thd,DELETE_ACL,tables->db,&tables->grant.privilege))
|
||||
goto error; /* purecov: inspected */
|
||||
if (grant_option && check_grant(thd,DELETE_ACL,tables))
|
||||
goto error;
|
||||
/*
|
||||
Don't allow this within a transaction because we want to use
|
||||
re-generate table
|
||||
|
@ -82,7 +82,7 @@
|
||||
|
||||
#define SPECIAL_USE_LOCKS 1 /* Lock used databases */
|
||||
#define SPECIAL_NO_NEW_FUNC 2 /* Skip new functions */
|
||||
#define SPECIAL_NEW_FUNC 4 /* New nonstandard functions */
|
||||
#define SPECIAL_SKIP_SHOW_DB 4 /* Don't allow 'show db' */
|
||||
#define SPECIAL_WAIT_IF_LOCKED 8 /* Wait if locked database */
|
||||
#define SPECIAL_SAME_DB_NAME 16 /* form name = file name */
|
||||
#define SPECIAL_ENGLISH 32 /* English error messages */
|
||||
@ -92,7 +92,6 @@
|
||||
#define SPECIAL_NO_HOST_CACHE 512 /* Don't cache hosts */
|
||||
#define SPECIAL_LONG_LOG_FORMAT 1024
|
||||
#define SPECIAL_SAFE_MODE 2048
|
||||
#define SPECIAL_SKIP_SHOW_DB 4096 /* Don't allow 'show db' */
|
||||
|
||||
/* Extern defines */
|
||||
#define store_record(A,B) bmove_allign((A)->record[B],(A)->record[0],(size_t) (A)->reclength)
|
||||
|
Reference in New Issue
Block a user