Below is the list of changes that have just been committed into a local
5.0 repository of hf. When hf does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-11-06 22:33:18+04:00, holyfoot@stripped +4 -0
bug #19491 (5.0-related additional fixes)
include/my_time.h@stripped, 2006-11-06 22:33:13+04:00, holyfoot@stripped +2 -0
we need to use it outside the my_time.cc
mysql-test/r/gis-rtree.result@stripped, 2006-11-06 22:33:13+04:00, holyfoot@stripped +8 -7
result fixed
sql-common/my_time.c@stripped, 2006-11-06 22:33:13+04:00, holyfoot@stripped +2 -2
'static' removed
sql/field.cc@stripped, 2006-11-06 22:33:13+04:00, holyfoot@stripped +28 -0
checks for invalid datetimes added
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: holyfoot
# Host: deer.(none)
# Root: /home/hf/work/mysql-5.0.clean
--- 1.327/sql/field.cc 2006-11-06 22:33:26 +04:00
+++ 1.328/sql/field.cc 2006-11-06 22:33:26 +04:00
@@ -5407,7 +5407,21 @@ int Field_newdate::store_time(TIME *ltim
long tmp;
int error= 0;
if (type == MYSQL_TIMESTAMP_DATE || type == MYSQL_TIMESTAMP_DATETIME)
+ {
tmp=ltime->year*16*32+ltime->month*32+ltime->day;
+ if ((my_bool)check_date(ltime, tmp,
+ (TIME_FUZZY_DATE |
+ (current_thd->variables.sql_mode &
+ (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
+ MODE_INVALID_DATES))), &error))
+ {
+ char buff[12];
+ String str(buff, sizeof(buff), &my_charset_latin1);
+ make_date((DATE_TIME_FORMAT *) 0, ltime, &str);
+ set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
+ str.ptr(), str.length(), MYSQL_TIMESTAMP_DATE, 1);
+ }
+ }
else
{
tmp=0;
@@ -5616,8 +5630,22 @@ int Field_datetime::store_time(TIME *lti
structure always fit into DATETIME range.
*/
if (type == MYSQL_TIMESTAMP_DATE || type == MYSQL_TIMESTAMP_DATETIME)
+ {
tmp=((ltime->year*10000L+ltime->month*100+ltime->day)*LL(1000000)+
(ltime->hour*10000L+ltime->minute*100+ltime->second));
+ if ((my_bool)check_date(ltime, tmp,
+ (TIME_FUZZY_DATE |
+ (current_thd->variables.sql_mode &
+ (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
+ MODE_INVALID_DATES))), &error))
+ {
+ char buff[12];
+ String str(buff, sizeof(buff), &my_charset_latin1);
+ make_datetime((DATE_TIME_FORMAT *) 0, ltime, &str);
+ set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
+ str.ptr(), str.length(), MYSQL_TIMESTAMP_DATETIME,1);
+ }
+ }
else
{
tmp=0;
--- 1.11/include/my_time.h 2006-11-06 22:33:26 +04:00
+++ 1.12/include/my_time.h 2006-11-06 22:33:26 +04:00
@@ -49,6 +49,8 @@ typedef long my_time_t;
#define TIME_NO_ZERO_DATE (TIME_NO_ZERO_IN_DATE*2)
#define TIME_INVALID_DATES (TIME_NO_ZERO_DATE*2)
+my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
+ ulong flags, int *was_cut);
enum enum_mysql_timestamp_type
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
uint flags, int *was_cut);
--- 1.20/sql-common/my_time.c 2006-11-06 22:33:26 +04:00
+++ 1.21/sql-common/my_time.c 2006-11-06 22:33:26 +04:00
@@ -76,8 +76,8 @@ uint calc_days_in_year(uint year)
1 error
*/
-static my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
- ulong flags, int *was_cut)
+my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
+ ulong flags, int *was_cut)
{
if (not_zero_date)
{
--- 1.20/mysql-test/r/gis-rtree.result 2006-11-06 22:33:26 +04:00
+++ 1.21/mysql-test/r/gis-rtree.result 2006-11-06 22:33:26 +04:00
@@ -862,13 +862,6 @@ CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
-CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
-INSERT INTO t1(foo) VALUES (NULL);
-ERROR 23000: Column 'foo' cannot be null
-INSERT INTO t1() VALUES ();
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
-INSERT INTO t1(foo) VALUES ('');
-ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,1)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,0)));
@@ -879,4 +872,12 @@ SELECT 1 FROM t1 WHERE foo != PointFromW
1
1
1
+DROP TABLE t1;
+CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
+INSERT INTO t1(foo) VALUES (NULL);
+ERROR 23000: Column 'foo' cannot be null
+INSERT INTO t1() VALUES ();
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+INSERT INTO t1(foo) VALUES ('');
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
DROP TABLE t1;
| Thread |
|---|
| • bk commit into 5.0 tree (holyfoot:1.2297) BUG#19491 | holyfoot | 6 Nov |