comparison src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java @ 365:63cccacad468

Add sys.ms_stuff() to returned list of StringFunctions.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Wed, 16 Sep 2020 18:56:18 +0200 (2020-09-16)
parents 34ce6e1b1be8
children 83bfade6333e
comparison
equal deleted inserted replaced
364:37f54743b1fd 365:63cccacad468
406 final String match = 406 final String match =
407 "('tinyint','smallint','int','bigint','hugeint','decimal','double','real'))" + 407 "('tinyint','smallint','int','bigint','hugeint','decimal','double','real'))" +
408 " AND \"type\" = 1" + // only scalar functions 408 " AND \"type\" = 1" + // only scalar functions
409 // exclude functions which do not work or belong to string functions (code(int) and space(int)) 409 // exclude functions which do not work or belong to string functions (code(int) and space(int))
410 " AND f.\"name\" NOT IN ('code','not_uniques','rotate_xor_hash','space'))" + 410 " AND f.\"name\" NOT IN ('code','not_uniques','rotate_xor_hash','space'))" +
411 // include specific functions which have no 1st arg (pi()) or it is not numeric 411 // include specific functions which have no arguments (pi()) or are numeric. Actually ms_str is a conversion function from float to str.
412 " OR f.\"name\" IN ('alpha','degrees','fuse','ms_round','ms_str','ms_trunc','pi','radians')"; 412 " OR f.\"name\" IN ('alpha','degrees','fuse','ms_round','ms_str','ms_trunc','pi','radians')";
413 return getConcatenatedStringFromQuery(FunctionsSelect + FunctionsWhere + match + OrFunctionsMaxMin + FunctionsOrderBy1); 413 return getConcatenatedStringFromQuery(FunctionsSelect + FunctionsWhere + match + OrFunctionsMaxMin + FunctionsOrderBy1);
414 } 414 }
415 415
416 @Override 416 @Override
420 " AND \"type\" = 1" + // only scalar functions 420 " AND \"type\" = 1" + // only scalar functions
421 // exclude sql functions: get_value_for, next_value_for, restart 421 // exclude sql functions: get_value_for, next_value_for, restart
422 " AND \"mod\" <> 'sql')" + 422 " AND \"mod\" <> 'sql')" +
423 // include specific functions code(int) and space(int) which belong to the 'str' module 423 // include specific functions code(int) and space(int) which belong to the 'str' module
424 " OR \"mod\" = 'str'" + 424 " OR \"mod\" = 'str'" +
425 // include 3 specific json functions, md5() and udf reverse() which all accept a string arg 425 // include 3 specific json functions, md5(), ms_stuff() and udf reverse() which all accept a string arg
426 " OR f.\"name\" IN ('isarray','isobject','isvalid','md5','reverse')"; 426 " OR f.\"name\" IN ('isarray','isobject','isvalid','md5','ms_stuff','reverse')";
427 final String unionPart = 427 final String unionPart =
428 // add functions which are not listed in sys.functions but implemented in the SQL parser (see sql/server/sql_parser.y) 428 // add functions which are not listed in sys.functions but implemented in the SQL parser (see sql/server/sql_parser.y)
429 " UNION SELECT 'position'"; 429 " UNION SELECT 'position'";
430 return getConcatenatedStringFromQuery(FunctionsSelect + FunctionsWhere + match + OrFunctionsMaxMin + unionPart + FunctionsOrderBy1); 430 return getConcatenatedStringFromQuery(FunctionsSelect + FunctionsWhere + match + OrFunctionsMaxMin + unionPart + FunctionsOrderBy1);
431 } 431 }