📄 ejbql.out
字号:
-15 -16 -17 ij> execute p2;1 -----------1 2 3 4 5 6 7 13 14 15 16 17 ij> execute p3;12 rows inserted/updated/deletedij> execute p1;A -----------1 2 -3 -4 -5 -6 -7 13 14 -15 -16 -17 -1 -2 3 4 5 6 7 -13 -14 15 16 17 ij> select * from foo;A -----------1 2 -3 -4 -5 -6 -7 13 14 -15 -16 -17 -1 -2 3 4 5 6 7 -13 -14 15 16 17 ij> drop table foo;0 rows inserted/updated/deletedij> -- End of ABS/ABSVAL test. For all valid types. Un-escaped function.-- abs is not a reserved wordcreate table abs( a int );0 rows inserted/updated/deletedij> drop table abs;0 rows inserted/updated/deletedij> -- This test EJBQL Absolute function. Resolve 3535-- Begin of ABS test. For escape function.-- Integer-- Basic-- beetle 5805 - support INT[EGER] built-in functionvalues{fn abs(INT(' 0') )};ERROR 42X01: Syntax error: Encountered "INT" at line 7, column 15.ij> values{fn abs(INT('-0') )};ERROR 42X01: Syntax error: Encountered "INT" at line 1, column 15.ij> values{fn abs(INT(' 1') )};ERROR 42X01: Syntax error: Encountered "INT" at line 1, column 15.ij> values{fn abs(INT('-1') )};ERROR 42X01: Syntax error: Encountered "INT" at line 1, column 15.ij> values{fn abs(INT(' 1000000') )};ERROR 42X01: Syntax error: Encountered "INT" at line 1, column 15.ij> values{fn abs(INT('-1000000') )};ERROR 42X01: Syntax error: Encountered "INT" at line 1, column 15.ij> values{fn abs(INT(' 2147483647') )};ERROR 42X01: Syntax error: Encountered "INT" at line 1, column 15.ij> values{fn abs(INT('-2147483648') + 1 )};ERROR 42X01: Syntax error: Encountered "INT" at line 1, column 15.ij> -- Errorvalues{fn abs(INT('-2147483648') )};ERROR 42X01: Syntax error: Encountered "INT" at line 2, column 15.ij> values{fn abs(INT(' 2147483647') + 1 )};ERROR 42X01: Syntax error: Encountered "INT" at line 1, column 15.ij> -- Smallint-- Basic-- beetle 5807 - support SMALLINT built-in functionvalues{fn abs( SMALLINT(' 0') )};1 ------0 ij> values{fn abs( SMALLINT('-0') )};1 ------0 ij> values{fn abs( SMALLINT(' 1') )};1 ------1 ij> values{fn abs( SMALLINT('-1') )};1 ------1 ij> values{fn abs( SMALLINT(' 10000') )};1 ------10000 ij> values{fn abs( SMALLINT('-10000') )};1 ------10000 ij> values{fn abs( SMALLINT(' 32767') )};1 ------32767 ij> values{fn abs( SMALLINT('-32768') + 1 )};1 -----------32767 ij> values{fn abs(-SMALLINT('-32768') )};1 ------ERROR 22003: The resulting value is outside the range for the data type SMALLINT.ij> -- Errorvalues{fn abs(-SMALLINT(' 32768') )};ERROR 22003: The resulting value is outside the range for the data type SHORT.ij> values{fn abs( SMALLINT('-32768') )};1 ------ERROR 22003: The resulting value is outside the range for the data type SMALLINT.ij> -- Bigint-- Basic-- beetle 5809 - support BIGINT built-in functionvalues{fn abs( BIGINT(' 0') )};1 --------------------0 ij> values{fn abs( BIGINT('-0') )};1 --------------------0 ij> values{fn abs( BIGINT(' 1') )};1 --------------------1 ij> values{fn abs( BIGINT('-1') )};1 --------------------1 ij> values{fn abs( BIGINT(' 100000000000') )};1 --------------------100000000000 ij> values{fn abs( BIGINT('-100000000000') )};1 --------------------100000000000 ij> values{fn abs( BIGINT(' 9223372036854775807') )};1 --------------------9223372036854775807 ij> values{fn abs( BIGINT('-9223372036854775808') + 1 )};1 --------------------9223372036854775807 ij> -- Errorvalues{fn abs(-BIGINT('-9223372036854775808') )};1 --------------------ERROR 22003: The resulting value is outside the range for the data type BIGINT.ij> values{fn abs( BIGINT('-9223372036854775808') )};1 --------------------ERROR 22003: The resulting value is outside the range for the data type BIGINT.ij> -- Real-- Basic-- beetle 5806 - support REAL built-in functionvalues{fn abs( REAL( 0) )};ERROR 42X01: Syntax error: Encountered "REAL" at line 4, column 16.ij> values{fn abs( REAL(-0) )};ERROR 42X01: Syntax error: Encountered "REAL" at line 1, column 16.ij> values{fn abs( REAL( 1) )};ERROR 42X01: Syntax error: Encountered "REAL" at line 1, column 16.ij> values{fn abs( REAL(-1) )};ERROR 42X01: Syntax error: Encountered "REAL" at line 1, column 16.ij> values{fn abs( REAL( 1000000.001) )};ERROR 42X01: Syntax error: Encountered "REAL" at line 1, column 16.ij> values{fn abs( REAL(-1000000.001) )};ERROR 42X01: Syntax error: Encountered "REAL" at line 1, column 16.ij> values{fn abs( REAL( 3.402E+38) )};ERROR 42X01: Syntax error: Encountered "REAL" at line 1, column 16.ij> values{fn abs( REAL(-3.402E+38) + 1 )};ERROR 42X01: Syntax error: Encountered "REAL" at line 1, column 16.ij> -- Errorvalues{fn abs( REAL( 3.402E+38 * 2) )};ERROR 42X01: Syntax error: Encountered "REAL" at line 2, column 16.ij> values{fn abs(-REAL( NaN) )};ERROR 42X01: Syntax error: Encountered "REAL" at line 1, column 16.ij> values{fn abs( REAL( 1.40129846432481707e-45) )};ERROR 42X01: Syntax error: Encountered "REAL" at line 1, column 16.ij> values{fn abs( REAL( 3.40282346638528860e+38) )};ERROR 42X01: Syntax error: Encountered "REAL" at line 1, column 16.ij> -- Double Precision/Double-- Basic-- beetle 5803 - support DOUBLE_[PRECISION] built-in functionvalues{fn abs( DOUBLE( 0) )};1 ----------------------0.0 ij> values{fn abs( DOUBLE(-0) )};1 ----------------------0.0 ij> values{fn abs( DOUBLE( 1) )};1 ----------------------1.0 ij> values{fn abs( DOUBLE(-1) )};1 ----------------------1.0 ij> values{fn abs( DOUBLE( 1000000.001) )};1 ----------------------1000000.001 ij> values{fn abs( DOUBLE(-1000000.001) )};1 ----------------------1000000.001 ij> values{fn abs( DOUBLE(-1.79769E+308) )};1 ----------------------1.79769E308 ij> values{fn abs( DOUBLE( 1.79769E+308) + 1 )};1 ----------------------1.79769E308 ij> values{fn abs( DOUBLE( 2.225E-307 + 1) )};1 ----------------------1.0 ij> -- Errorvalues{fn abs( DOUBLE( 1.79769E+308 * 2) )};1 ----------------------ERROR 22003: The resulting value is outside the range for the data type DOUBLE.ij> values{fn abs(-DOUBLE( NaN) )};ERROR 42X04: Column 'NAN' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'NAN' is not a column in the target table.ij> values{fn abs( DOUBLE( 4.9E-324) )};ERROR 22003: The resulting value is outside the range for the data type DOUBLE.ij> values{fn abs( DOUBLE( 1.7976931348623157E308) )};ERROR 22003: The resulting value is outside the range for the data type DOUBLE.ij> -- Decimal/Numeric-- Basic-- beetle 5802 - support DEC[IMAL] built-in functionvalues{ fn abs(DEC( 0) )};ERROR 42X01: Syntax error: Encountered "DEC" at line 4, column 16.ij> values{ fn abs(DEC(-0) )};ERROR 42X01: Syntax error: Encountered "DEC" at line 1, column 16.ij> values{ fn abs(DEC( 1) )};ERROR 42X01: Syntax error: Encountered "DEC" at line 1, column 16.ij> values{ fn abs(DEC(-1) )};ERROR 42X01: Syntax error: Encountered "DEC" at line 1, column 16.ij> values{ fn abs(DEC( 1000000000000) )};ERROR 42X01: Syntax error: Encountered "DEC" at line 1, column 16.ij> values{ fn abs(DEC(-1000000000000) )};ERROR 42X01: Syntax error: Encountered "DEC" at line 1, column 16.ij> -- More generic testvalues{ fn abs( 0-1-.1 ) };1 ---------------1.1 ij> values{ fn abs( -0-1.000000001 ) };1 -----------------------1.000000001 ij> VALUES{ FN ABS( 100-200-300 ) };1 -----------400 ij> -- Errorvalues{ fn abs('null') };ERROR 42X25: The 'ABS/ABSVAL' function is not allowed on the 'CHAR' type.ij> -- End of ABS test. For escaped function.-- This test EJBQL Absolute function. Resolve 3535-- Begin of ABSVAL test. For all valid types, un-escaped function.-- Integer has a range of -2147483648 to 2147483647-- Basiccreate table myint( a int );0 rows inserted/updated/deletedij> select abs(a) from myint;1 -----------ij> insert into myint values (null);1 row inserted/updated/deletedij> select abs(a) from myint;1 -----------NULL ij> autocommit off;ij> -- Prepare Statements, should pass and return 1prepare p1 as 'select abs(?) from myint';ij> prepare p1 as 'select 1 from myint where ? <= 4';ij> execute p1 using 'values absval( 4 )';1 -----------1 ij> execute p1 using 'values absval( -4 )';1 -----------1 ij> execute p1 using 'values absval( 4.4 )';1 -----------1 ij> execute p1 using 'values absval( -4.4 )';1 -----------1 ij> -- Prepare Statements, should pass and return 1prepare p2 as 'select {fn abs(?)} from myint';ij> prepare p2 as 'select 1 from myint where ? <= 4';ij> execute p2 using 'values {fn abs( 4 )}';1 -----------1 ij> execute p2 using 'values {fn abs( -4 )}';1 -----------1 ij> execute p2 using 'values {fn abs( 4.4 )}';1 -----------1 ij> execute p2 using 'values {fn abs( -4.4 )}';1 -----------1 ij> execute p2 using 'values {fn abs( -4.44444444444444444444444 )}';1 -----------1 ij> autocommit on;ij> drop table myint;0 rows inserted/updated/deletedij> -- Using Strings in escape functioncreate table myStr( a varchar(10) );0 rows inserted/updated/deletedij> insert into myStr values ( '123' );1 row inserted/updated/deletedij> insert into myStr values ( '-123' );1 row inserted/updated/deletedij> insert into myStr values ( '-12 ' );1 row inserted/updated/deletedij> insert into myStr values ( ' -2 ' );1 row inserted/updated/deletedij> insert into myStr values ( '1a3' );1 row inserted/updated/deletedij> select * from myStr;A ----------123 -123 -12 -2 1a3 ij> select abs(a) from myStr;ERROR 42X25: The 'ABS/ABSVAL' function is not allowed on the 'VARCHAR' type.ij> select {fn abs(a)} from myStr;ERROR 42X25: The 'ABS/ABSVAL' function is not allowed on the 'VARCHAR' type.ij> drop table myStr;0 rows inserted/updated/deletedij> -- End of ABSVAL test-- This test EJBQL function, CONCAT. Resolve 3535-- Begin of CONCAT test-- Basicvalues{ fn concat( 'hello', ' world' ) };1 -----------hello worldij> VALUES{ FN CONCAT( 'HELLO', ' WORLD' ) };1 -----------HELLO WORLDij> values{ fn concat( '' , '' )};1 ---------------ij> values{ fn concat( CHAR(''), CHAR('') ) };1 ------------------------------ij> values{ fn concat( 45, 67 )};ERROR 42846: Cannot convert types 'INTEGER' to 'VARCHAR'.ij> values{ fn concat( '45', 67 )};ERROR 42846: Cannot convert types 'INTEGER' to 'VARCHAR'.ij> values{ fn concat( 45, '67' )};ERROR 42846: Cannot convert types 'INTEGER' to 'VARCHAR'.ij> values{ fn concat( CHAR('C'), CHAR('#') ) };1 ------------------------------C # ij> values{ fn concat( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ`1234567890-=\ [];,./ \'' |', 'abcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+|<>?:"{} '''''' ' ) };1 --------------------------------------------------------------------------------------------------------------------ABCDEFGHIJKLMNOPQRSTUVWXYZ`1234567890-=\ [];,./ \' |abcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+|<>?:"{} ''' ij> create table concat ( a int );0 rows inserted/updated/deletedij> insert into concat values (1);1 row inserted/updated/deletedij> select * from CONCAT;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -