📄 ps_conv.inc
字号:
execute stmt1 ;prepare stmt1 from "select 'true' as found from t9 where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and c29= ? and c30= ?";execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ;######## SELECT .. WHERE column(string)=value(BIGINT(m,n),BIGINT) ########set @arg00= 20;# c20 (char) must be extended for the comparisonselect 'true' as found from t9 where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and c27= 20 and c28= 20 and c29= 20 and c30= 20 ;select 'true' as found from t9 where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;prepare stmt1 from "select 'true' as found from t9 where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and c27= 20 and c28= 20 and c29= 20 and c30= 20" ;execute stmt1 ;prepare stmt1 from "select 'true' as found from t9 where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and c21= ? and c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ;######## SELECT .. WHERE column(string)=value(DOUBLE(m,n),DOUBLE) ########set @arg00= 20.0;# c20 (char) must be extended for the comparisonselect 'true' as found from t9 where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;select 'true' as found from t9 where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;prepare stmt1 from "select 'true' as found from t9 where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;execute stmt1 ;prepare stmt1 from "select 'true' as found from t9 where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and c21= ? and c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00 ;delete from t9 ;######################### test of date/time columns ######################### ## c13 date, c14 datetime, c15 timestamp(14), c16 time, c17 year ## #############################################################################--disable_query_logselect '-- insert into date/time columns --' as test_sequence ;--enable_query_log######## INSERT into .. date/time columns values(VARCHAR(19),LONGTEXT) ########--disable_query_logset @arg00= '1991-01-01 01:01:01' ;insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 20, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01') ;insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ;prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 22, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01')" ;execute stmt1 ;prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 23, ?, ?, ?, ?, ? )" ;execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;######## INSERT into .. date/time columns values(DATETIME,LONGBLOB) ########set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 30, CAST('1991-01-01 01:01:01' as datetime), CAST('1991-01-01 01:01:01' as datetime), CAST('1991-01-01 01:01:01' as datetime), CAST('1991-01-01 01:01:01' as datetime), CAST('1991-01-01 01:01:01' as datetime)) ;insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ;prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 32, CAST('1991-01-01 01:01:01' as datetime), CAST('1991-01-01 01:01:01' as datetime), CAST('1991-01-01 01:01:01' as datetime), CAST('1991-01-01 01:01:01' as datetime), CAST('1991-01-01 01:01:01' as datetime))" ;execute stmt1 ;prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 33, ?, ?, ?, ?, ? )" ;execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;######## INSERT into .. date/time columns values(BIGINT(n),BIGINT) ########set @arg00= 2000000000 ;insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 40, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 ) ;insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 41, @arg00, @arg00, @arg00, @arg00, @arg00) ;prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 42, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 )" ;execute stmt1 ;prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 43, ?, ?, ?, ?, ? )" ;execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;######## INSERT into .. date/time columns values(DOUBLE(m,n),DOUBLE) ########set @arg00= 1.0e+10 ;insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ;prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 52, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 )" ;execute stmt1 ;prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 53, ?, ?, ?, ?, ? )" ;execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;######## INSERT into .. date/time columns values(LONGBLOB,NULL) ######### Attention: c15 is timestamp and the manual says:# The first TIMESTAMP column in table row automatically is updated # to the current timestamp when the value of any other column in the# row is changed, unless the TIMESTAMP column explicitly is assigned # a value other than NULL.# That's why a fixed NOT NULL value is inserted.set @arg00= 'abc' ;set @arg00= NULL ;insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 60, NULL, NULL, '1991-01-01 01:01:01', NULL, NULL) ;insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 61, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ;prepare stmt1 from "insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 62, NULL, NULL, '1991-01-01 01:01:01', NULL, NULL)" ;execute stmt1 ;prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 63, ?, ?, '1991-01-01 01:01:01', ?, ? )" ;execute stmt2 using @arg00, @arg00, @arg00, @arg00 ;######## INSERT into .. date/time columns values(BIGINT,NULL) ########set @arg00= 8 ;set @arg00= NULL ;insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 71, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ;prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 73, ?, ?, '1991-01-01 01:01:01', ?, ? )" ;execute stmt2 using @arg00, @arg00, @arg00, @arg00 ;######## INSERT into .. date/time columns values(DOUBLE,NULL) ########set @arg00= 8.0 ;set @arg00= NULL ;insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 81, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ;prepare stmt2 from "insert into t9 ( c1, c13, c14, c15, c16, c17 )values ( 83, ?, ?, '1991-01-01 01:01:01', ?, ? )" ;execute stmt2 using @arg00, @arg00, @arg00, @arg00 ;--enable_query_log######## SELECT of all inserted records ########select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;--disable_query_logselect '-- select .. where date/time column = .. --' as test_sequence ;--enable_query_log######## SELECT .. WHERE column(date/time/..)=value(CHAR(n)/LONGTEXT) ########set @arg00= '1991-01-01 01:01:01' ;select 'true' as found from t9 where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and c17= '1991-01-01 01:01:01' ;select 'true' as found from t9 where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 and c17= @arg00 ;prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and c17= '1991-01-01 01:01:01'" ;execute stmt1 ;prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;######## SELECT .. WHERE column(date/time/..)=value(DATETIME/LONGBLOB) ########set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and c14= CAST('1991-01-01 01:01:01' as datetime) and c15= CAST('1991-01-01 01:01:01' as datetime) and c16= CAST('1991-01-01 01:01:01' as datetime) and c17= CAST('1991-01-01 01:01:01' as datetime) ;select 'true' as found from t9 where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 and c17= @arg00 ;prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and c14= CAST('1991-01-01 01:01:01' as datetime) and c15= CAST('1991-01-01 01:01:01' as datetime) and c16= CAST('1991-01-01 01:01:01' as datetime) and c17= CAST('1991-01-01 01:01:01' as datetime)" ;execute stmt1 ;prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;######## SELECT .. WHERE column(year)=value(INT(10)/BIGINT) ########set @arg00= 1991 ;select 'true' as found from t9 where c1= 20 and c17= 1991 ;select 'true' as found from t9 where c1= 20 and c17= @arg00 ;prepare stmt1 from "select 'true' as found from t9 where c1= 20 and c17= 1991" ;execute stmt1 ;prepare stmt1 from "select 'true' as found from t9where c1= 20 and c17= ?" ;execute stmt1 using @arg00 ;######## SELECT .. WHERE column(year)=value(DOUBLE(m,n)/DOUBLE) ########set @arg00= 1.991e+3 ;select 'true' as found from t9 where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;select 'true' as found from t9 where c1= 20 and abs(c17 - @arg00) < 0.01 ;prepare stmt1 from "select 'true' as found from t9 where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;execute stmt1 ;prepare stmt1 from "select 'true' as found from t9where c1= 20 and abs(c17 - ?) < 0.01" ;execute stmt1 using @arg00 ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -