comparison src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java @ 268:ee4c826e3933

Extended method getNumericFunctions() by also returning functions: degrees, fuse, ms_round, ms_str, ms_trunc and radians. Extended method getStringFunctions() by also returning function: position. Updated ChangeLog.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 07 Mar 2019 18:56:55 +0100 (2019-03-07)
parents 43ea6c50483e
children 7d041f5c3fea
comparison
equal deleted inserted replaced
267:43ea6c50483e 268:ee4c826e3933
491 public String getNumericFunctions() { 491 public String getNumericFunctions() {
492 String match = 492 String match =
493 "('tinyint', 'smallint', 'int', 'bigint', 'hugeint', 'decimal', 'double', 'real') )" + 493 "('tinyint', 'smallint', 'int', 'bigint', 'hugeint', 'decimal', 'double', 'real') )" +
494 " AND \"type\" = 1" + // only scalar functions 494 " AND \"type\" = 1" + // only scalar functions
495 // exclude functions which belong to the 'str' module 495 // exclude functions which belong to the 'str' module
496 " AND \"mod\" <> 'str')"; // to filter out string functions: 'code' and 'space' 496 " AND \"mod\" <> 'str')" + // to filter out string functions: 'code' and 'space'
497 " OR \"name\" IN ('degrees','fuse','ms_round','ms_str','ms_trunc','radians')";
497 return getConcatenatedStringFromQuery(FunctionsSelect + FunctionsWhere + match + OrFunctionsMaxMin + FunctionsOrderBy1); 498 return getConcatenatedStringFromQuery(FunctionsSelect + FunctionsWhere + match + OrFunctionsMaxMin + FunctionsOrderBy1);
498 } 499 }
499 500
500 @Override 501 @Override
501 public String getStringFunctions() { 502 public String getStringFunctions() {
502 String match = 503 String match =
503 "('char', 'varchar', 'clob', 'json') )" + 504 "('char', 'varchar', 'clob', 'json') )" +
504 // include functions which belong to the 'str' module 505 // include functions which belong to the 'str' module
505 " OR \"mod\" = 'str')"; 506 " OR \"mod\" = 'str')";
506 return getConcatenatedStringFromQuery(FunctionsSelect + FunctionsWhere + match + OrFunctionsMaxMin + FunctionsOrderBy1); 507 String unionPart =
508 // add system functions which are not listed in sys.functions but implemented in the SQL parser (see sql/server/sql_parser.y)
509 " UNION SELECT 'position'";
510 return getConcatenatedStringFromQuery(FunctionsSelect + FunctionsWhere + match + OrFunctionsMaxMin + unionPart + FunctionsOrderBy1);
507 } 511 }
508 512
509 @Override 513 @Override
510 public String getSystemFunctions() { 514 public String getSystemFunctions() {
511 String wherePart = 515 String wherePart =
526 } 530 }
527 531
528 @Override 532 @Override
529 public String getTimeDateFunctions() { 533 public String getTimeDateFunctions() {
530 String wherePart = 534 String wherePart =
531 "\"mod\" = 'mtime' OR \"name\" IN ('epoch','localtime','localtimestamp')"; 535 "\"mod\" IN ('mtime','timestamp') OR \"name\" IN ('localtime','localtimestamp')";
532 String unionPart = 536 String unionPart =
533 // add time date functions which are not listed in sys.functions but implemented in the SQL parser (see sql/server/sql_parser.y) 537 // add time date functions which are not listed in sys.functions but implemented in the SQL parser (see sql/server/sql_parser.y)
534 " UNION SELECT 'extract'" + 538 " UNION SELECT 'extract'" +
535 " UNION SELECT 'now'"; 539 " UNION SELECT 'now'";
536 return getConcatenatedStringFromQuery(FunctionsSelect + wherePart + OrFunctionsMaxMin + unionPart + FunctionsOrderBy1); 540 return getConcatenatedStringFromQuery(FunctionsSelect + wherePart + OrFunctionsMaxMin + unionPart + FunctionsOrderBy1);