From ae57debaba17f6069262dfd1e41fe4c9a54b957b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 16 Aug 2002 20:31:48 +0300 Subject: [PATCH] A fix for bigints with quoted constants .. Same princpile can be applied to other expressions --- Docs/manual.texi | 2 ++ mysql-test/r/select.result | 15 +++++++++++++++ mysql-test/t/select.test | 8 ++++++++ sql/item_cmpfunc.cc | 4 ++-- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 71e6e9b9eed..3b253255199 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -50257,6 +50257,8 @@ each individual 4.0.x release. @itemize @bullet @item +Fixed a bug with bigint's and quoted strings ... +@item Added @code{QUOTE()} function that performs SQL quoting to produce values that can be used as data values in queries. @item diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 6d26f9aa90a..6998e81e094 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -3240,3 +3240,18 @@ INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12 SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'NULL' AND b.sampletime < 'NULL' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; gvid the_success the_fail the_size the_time DROP TABLE t1,t2; +create table t1 ( A_Id bigint(20) NOT NULL default '0', A_UpdateBy char(10) NOT NULL default '', A_UpdateDate bigint(20) NOT NULL default '0', A_UpdateSerial int(11) NOT NULL default '0', other_types bigint(20) NOT NULL default '0', wss_type bigint(20) NOT NULL default '0'); +INSERT INTO t1 VALUES (102935998719055004,'brade',1029359987,2,102935229116544068,102935229216544093); +select wss_type from t1 where wss_type ='102935229216544106'; +wss_type +select wss_type from t1 where wss_type ='102935229216544105'; +wss_type +select wss_type from t1 where wss_type ='102935229216544104'; +wss_type +select wss_type from t1 where wss_type ='102935229216544093'; +wss_type +102935229216544093 +select wss_type from t1 where wss_type =102935229216544093; +wss_type +102935229216544093 +drop table t1; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 159746e4dde..e553ee38499 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -1730,3 +1730,11 @@ CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned d INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35); SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'NULL' AND b.sampletime < 'NULL' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; DROP TABLE t1,t2; +create table t1 ( A_Id bigint(20) NOT NULL default '0', A_UpdateBy char(10) NOT NULL default '', A_UpdateDate bigint(20) NOT NULL default '0', A_UpdateSerial int(11) NOT NULL default '0', other_types bigint(20) NOT NULL default '0', wss_type bigint(20) NOT NULL default '0'); +INSERT INTO t1 VALUES (102935998719055004,'brade',1029359987,2,102935229116544068,102935229216544093); +select wss_type from t1 where wss_type ='102935229216544106'; +select wss_type from t1 where wss_type ='102935229216544105'; +select wss_type from t1 where wss_type ='102935229216544104'; +select wss_type from t1 where wss_type ='102935229216544093'; +select wss_type from t1 where wss_type =102935229216544093; +drop table t1; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 6391e61cb77..8e010e7de8a 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -69,7 +69,7 @@ void Item_bool_func2::fix_length_and_dec() if (args[0]->type() == FIELD_ITEM) { Field *field=((Item_field*) args[0])->field; - if (field->store_for_compare()) + if (field->store_for_compare() || field->result_type() == INT_RESULT) { if (convert_constant_item(field,&args[1])) { @@ -81,7 +81,7 @@ void Item_bool_func2::fix_length_and_dec() if (args[1]->type() == FIELD_ITEM) { Field *field=((Item_field*) args[1])->field; - if (field->store_for_compare()) + if (field->store_for_compare() || field->result_type() == INT_RESULT) { if (convert_constant_item(field,&args[0])) {