Below is the list of changes that have just been committed into a local
5.0 repository of martin. When martin 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, 2007-12-18 14:41:55+01:00, mhansson@stripped +4 -0
Bug#24525: ADDDATE returns string value
When DATETIME values are compared to constants, the constants should be
converted to TIMESTAMP. But this depended on field_type, which is
MYSQL_TYPE_STRING for ADDDATE when invoked with a string.
Fixed by adding a case for functions returning DATETIME/DATE but have
STRING result.
mysql-test/r/type_date.result@stripped, 2007-12-18 14:41:53+01:00, mhansson@stripped +3 -0
Bug#24525: Test casehe
mysql-test/t/type_date.test@stripped, 2007-12-18 14:41:53+01:00, mhansson@stripped +5 -0
Bug#24525: Test result
sql/item.cc@stripped, 2007-12-18 14:41:53+01:00, mhansson@stripped +3 -0
Bug#24525: Changed basis for is_datetime.
sql/item.h@stripped, 2007-12-18 14:41:53+01:00, mhansson@stripped +9 -0
Bug#24525: Added get_comparison_type
diff -Nrup a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
--- a/mysql-test/r/type_date.result 2007-10-04 09:15:24 +02:00
+++ b/mysql-test/r/type_date.result 2007-12-18 14:41:53 +01:00
@@ -146,3 +146,6 @@ str_to_date( '', a )
0000-00-00 00:00:00
NULL
DROP TABLE t1;
+SELECT DATE_ADD('2006-11-30 9:00:00',INTERVAL 0 HOUR) = '2006-11-30 9';
+DATE_ADD('2006-11-30 9:00:00',INTERVAL 0 HOUR) = '2006-11-30 9'
+1
diff -Nrup a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
--- a/mysql-test/t/type_date.test 2007-10-04 09:15:25 +02:00
+++ b/mysql-test/t/type_date.test 2007-12-18 14:41:53 +01:00
@@ -149,3 +149,8 @@ INSERT INTO t1 VALUES (NULL);
SELECT str_to_date( '', a ) FROM t1;
DROP TABLE t1;
+
+#
+# Bug#24525: ADDDATE returns string value
+#
+SELECT DATE_ADD('2006-11-30 9:00:00',INTERVAL 0 HOUR) = '2006-11-30 9';
diff -Nrup a/sql/item.cc b/sql/item.cc
--- a/sql/item.cc 2007-10-16 10:17:35 +02:00
+++ b/sql/item.cc 2007-12-18 14:41:53 +01:00
@@ -4240,6 +4240,9 @@ bool Item::is_datetime()
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
return TRUE;
+ case MYSQL_TYPE_STRING:
+ if (result_as_longlong())
+ return TRUE;
default:
break;
}
diff -Nrup a/sql/item.h b/sql/item.h
--- a/sql/item.h 2007-10-16 10:19:00 +02:00
+++ b/sql/item.h 2007-12-18 14:41:53 +01:00
@@ -869,6 +869,15 @@ public:
representation is more precise than the string one).
*/
virtual bool result_as_longlong() { return FALSE; }
+ /**
+ @breif For Items where the other argument in a comparison should be cast to
+ TIMESTAMP before comparison, this method returns true.
+
+ A special case applies when comparing a TIMESTAMP or DATETIME value with
+ constant. The constant is converted to a timestamp before the comparison
+ is performed. This is done to be more ODBC-friendly. The rule applies only
+ to TIMESTAMP or DATETIME.
+ */
bool is_datetime();
virtual Field::geometry_type get_geometry_type() const
{ return Field::GEOM_GEOMETRY; };
| Thread |
|---|
| • bk commit into 5.0 tree (mhansson:1.2546) BUG#24525 | mhansson | 18 Dec |