summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <sasha@mysql.sashanet.com>2001-04-05 19:10:58 -0600
committerunknown <sasha@mysql.sashanet.com>2001-04-05 19:10:58 -0600
commit0b6b1b752b9d71db06fe674c1b76a2d924d3e7c8 (patch)
tree26e498fbf660f4aec521921019ceb14c09655c93
parent353d84d874c4a4c9bef89a1e19737ff7dd468a65 (diff)
parent96c3bd94327cd920985724c8d2799a952ea4bf57 (diff)
downloadmariadb-git-0b6b1b752b9d71db06fe674c1b76a2d924d3e7c8.tar.gz
Merge work:/home/bk/mysql
into mysql.sashanet.com:/home/sasha/src/bk/mysql
-rwxr-xr-xBUILD/compile-pentium-debug2
-rwxr-xr-xBUILD/compile-pentium-debug-max13
-rw-r--r--client/mysqltest.c7
-rw-r--r--mysql-test/r/df_crash.result6
-rw-r--r--mysql-test/t/df_crash.test10
-rw-r--r--sql/time.cc8
6 files changed, 40 insertions, 6 deletions
diff --git a/BUILD/compile-pentium-debug b/BUILD/compile-pentium-debug
index 2800ace97c5..7d25ac4a406 100755
--- a/BUILD/compile-pentium-debug
+++ b/BUILD/compile-pentium-debug
@@ -8,6 +8,6 @@ c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs"
-extra_configs="$extra_configs --with-berkeley-db --with-innobase"
+extra_configs="$extra_configs "
. "$path/FINISH.sh"
diff --git a/BUILD/compile-pentium-debug-max b/BUILD/compile-pentium-debug-max
new file mode 100755
index 00000000000..2800ace97c5
--- /dev/null
+++ b/BUILD/compile-pentium-debug-max
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+path=`dirname $0`
+. "$path/SETUP.sh"
+
+extra_flags="$pentium_cflags $debug_cflags"
+c_warnings="$c_warnings $debug_extra_warnings"
+cxx_warnings="$cxx_warnings $debug_extra_warnings"
+extra_configs="$pentium_configs $debug_configs"
+
+extra_configs="$extra_configs --with-berkeley-db --with-innobase"
+
+. "$path/FINISH.sh"
diff --git a/client/mysqltest.c b/client/mysqltest.c
index d354bbbca01..10095bbf7df 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -241,8 +241,8 @@ static void do_eval(DYNAMIC_STRING* query_eval, const char* query)
else
{
if(!(v = var_get(p, &p, 0)))
- die("Bad variabled in eval");
- dynstr_append(query_eval, v->str_val);
+ die("Bad variable in eval");
+ dynstr_append_mem(query_eval, v->str_val, v->str_val_len);
}
break;
case '\\':
@@ -436,6 +436,7 @@ VAR* var_get(const char* var_name, const char** var_name_end, int raw)
{
sprintf(v->str_val, "%d", v->int_val);
v->int_dirty = 0;
+ v->str_val_len = strlen(v->str_val);
}
if(var_name_end)
*var_name_end = var_name ;
@@ -475,7 +476,7 @@ int var_set(char* var_name, char* var_name_end, char* var_val,
die("Out of memory");
}
memcpy(v->str_val, var_val, val_len-1);
- v->str_val_len = val_len;
+ v->str_val_len = val_len - 1;
v->str_val[val_len] = 0;
v->int_val = atoi(v->str_val);
return 0;
diff --git a/mysql-test/r/df_crash.result b/mysql-test/r/df_crash.result
new file mode 100644
index 00000000000..5f0c5e1d38a
--- /dev/null
+++ b/mysql-test/r/df_crash.result
@@ -0,0 +1,6 @@
+month(updated)
+10
+NULL
+year(updated)
+1999
+NULL
diff --git a/mysql-test/t/df_crash.test b/mysql-test/t/df_crash.test
new file mode 100644
index 00000000000..2f83de04d1c
--- /dev/null
+++ b/mysql-test/t/df_crash.test
@@ -0,0 +1,10 @@
+drop table if exists db_crash;
+CREATE TABLE df_crash (
+ updated text
+) TYPE=MyISAM;
+INSERT INTO df_crash VALUES ('1999-10-5');
+insert into df_crash values ('');
+
+select month(updated) from df_crash;
+select year(updated) from df_crash;
+drop table df_crash;
diff --git a/sql/time.cc b/sql/time.cc
index ce4b5b0e30c..b40047cb381 100644
--- a/sql/time.cc
+++ b/sql/time.cc
@@ -428,11 +428,15 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
uint field_length,year_length,digits,i,number_of_fields,date[7];
bool date_used=0;
const char *pos;
- const char *end=str+length;
DBUG_ENTER("str_to_TIME");
DBUG_PRINT("enter",("str: %.*s",length,str));
- for (; !isdigit(*str) && str != end ; str++) ; // Skipp garbage
+ if(!str)
+ DBUG_RETURN(TIMESTAMP_NONE);
+
+ const char *end=str+length;
+
+ for (; !isdigit(*str) && str != end ; str++) ; // Skip garbage
if (str == end)
DBUG_RETURN(TIMESTAMP_NONE);
/*