@@ -1354,6 +1354,20 @@ describe('mysql', () => {
13541354 "SELECT * FROM `T1`"
13551355 ]
13561356 } ,
1357+ {
1358+ title : 'null safe equal operator' ,
1359+ sql : [
1360+ "SELECT * FROM T1 WHERE a <=> b" ,
1361+ "SELECT * FROM `T1` WHERE `a` <=> `b`"
1362+ ]
1363+ } ,
1364+ {
1365+ title : 'null safe equal operator with null' ,
1366+ sql : [
1367+ "SELECT * FROM T1 WHERE a <=> NULL" ,
1368+ "SELECT * FROM `T1` WHERE `a` <=> NULL"
1369+ ]
1370+ } ,
13571371 ]
13581372 SQL_LIST . forEach ( sqlInfo => {
13591373 const { title, sql } = sqlInfo
@@ -1367,10 +1381,10 @@ describe('mysql', () => {
13671381
13681382 it ( 'should throw error when args is not right' , ( ) => {
13691383 let sql = `select convert(json_unquote(json_extract('{"thing": "252"}', "$.thing")));`
1370- expect ( parser . astify . bind ( parser , sql ) ) . to . throw ( 'Expected "!=", "#", "#-", "#>", "#>>", "%", "&", "&&", "*", "+", ",", "-", "--", "->", "->>", "/", "/*", "<", "<<", "<=", "<>", "<@", "=", ">", ">=", ">>", "?", "?&", "?|", "@>", "AND", "BETWEEN", "COLLATE", "IN", "IS", "LIKE", "NOT", "ON", "OR", "OVER", "REGEXP", "RLIKE", "USING", "XOR", "^", "div", "mod", "|", "||", or [ \\t\\n\\r] but ")" found.' )
1371- expect ( parser . astify . bind ( parser , 'select convert("");' ) ) . to . throw ( 'Expected "!=", "#", "#-", "#>", "#>>", "%", "&", "&&", "*", "+", ",", "-", "--", "->", "->>", "/", "/*", "<", "<<", "<=", "<>", "<@", "=", ">", ">=", ">>", "?", "?&", "?|", "@>", "AND", "BETWEEN", "COLLATE", "IN", "IS", "LIKE", "NOT", "OR", "REGEXP", "RLIKE", "USING", "XOR", "^", "div", "mod", "|", "||", or [ \\t\\n\\r] but ")" found.' )
1384+ expect ( parser . astify . bind ( parser , sql ) ) . to . throw ( 'Expected "!=", "#", "#-", "#>", "#>>", "%", "&", "&&", "*", "+", ",", "-", "--", "->", "->>", "/", "/*", "<", "<<", "<=", "<=>", "< >", "<@", "=", ">", ">=", ">>", "?", "?&", "?|", "@>", "AND", "BETWEEN", "COLLATE", "IN", "IS", "LIKE", "NOT", "ON", "OR", "OVER", "REGEXP", "RLIKE", "USING", "XOR", "^", "div", "mod", "|", "||", or [ \\t\\n\\r] but ")" found.' )
1385+ expect ( parser . astify . bind ( parser , 'select convert("");' ) ) . to . throw ( 'Expected "!=", "#", "#-", "#>", "#>>", "%", "&", "&&", "*", "+", ",", "-", "--", "->", "->>", "/", "/*", "<", "<<", "<=", "<=>", "< >", "<@", "=", ">", ">=", ">>", "?", "?&", "?|", "@>", "AND", "BETWEEN", "COLLATE", "IN", "IS", "LIKE", "NOT", "OR", "REGEXP", "RLIKE", "USING", "XOR", "^", "div", "mod", "|", "||", or [ \\t\\n\\r] but ")" found.' )
13721386 sql = 'SELECT AVG(Quantity,age) FROM table1;'
1373- expect ( parser . astify . bind ( parser , sql ) ) . to . throw ( 'Expected "!=", "#", "#-", "#>", "#>>", "%", "&", "&&", "(", ")", "*", "+", "-", "--", "->", "->>", ".", "/", "/*", "<", "<<", "<=", "<>", "<@", "=", ">", ">=", ">>", "?", "?&", "?|", "@>", "AND", "BETWEEN", "COLLATE", "IN", "IS", "LIKE", "NOT", "OR", "REGEXP", "RLIKE", "XOR", "^", "div", "mod", "|", "||", [ \\t\\n\\r], [A-Za-z0-9_$\\x80-], or [A-Za-z0-9_:一-龥À-ſ] but "," found' )
1387+ expect ( parser . astify . bind ( parser , sql ) ) . to . throw ( 'Expected "!=", "#", "#-", "#>", "#>>", "%", "&", "&&", "(", ")", "*", "+", "-", "--", "->", "->>", ".", "/", "/*", "<", "<<", "<=", "<=>", "< >", "<@", "=", ">", ">=", ">>", "?", "?&", "?|", "@>", "AND", "BETWEEN", "COLLATE", "IN", "IS", "LIKE", "NOT", "OR", "REGEXP", "RLIKE", "XOR", "^", "div", "mod", "|", "||", [ \\t\\n\\r], [A-Za-z0-9_$\\x80-], or [A-Za-z0-9_:一-龥À-ſ] but "," found' )
13741388 } )
13751389
13761390 it ( 'should join multiple table with comma' , ( ) => {
0 commit comments