Mercurial > hg > monetdb-java
comparison src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java @ 781:71d32f1a4d60
Improved DatabaseMetaData.getSystemFunctions(). It now also returns functions: current_sessionid, greatest, ifnull, least, sql_max, sql_min. Function ifnull will only be returned for servers Jun2023 (11.47 or higher).
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 12 Oct 2023 13:21:55 +0200 (19 months ago) |
parents | 1547843b3a9b |
children | 93b256bf29a7 |
comparison
equal
deleted
inserted
replaced
780:3b09f0c93cdd | 781:71d32f1a4d60 |
---|---|
451 } | 451 } |
452 | 452 |
453 @Override | 453 @Override |
454 public String getSystemFunctions() { | 454 public String getSystemFunctions() { |
455 final String wherePart = | 455 final String wherePart = |
456 "f.\"name\" IN ('columnsize','database','debug','get_value_for','hash','hashsize','heapsize'" + | 456 "f.\"name\" IN ('columnsize','current_sessionid','database','debug'" + |
457 ",'ifnull','ifthenelse','imprintsize','isaurl','isauuid','isnull','masterclock','mastertick'" + | 457 ",'get_value_for','greatest','hash','hashsize','heapsize'" + |
458 ",'newurl','next_value_for','password_hash','replicaclock','replicatick','uuid')" + | 458 ",'ifthenelse','imprintsize','isaurl','isauuid','isnull','least'" + |
459 ",'masterclock','mastertick'" + // wlc/wlr functions | |
460 ",'newurl','next_value_for','password_hash'" + | |
461 ",'replicaclock','replicatick'" + // wlc/wlr functions | |
462 ",'sql_max','sql_min','uuid')"; | |
463 String unionPart = | |
459 // add functions which are not listed in sys.functions but implemented in the SQL parser (see sql/server/sql_parser.y) | 464 // add functions which are not listed in sys.functions but implemented in the SQL parser (see sql/server/sql_parser.y) |
460 " UNION ALL SELECT * FROM (VALUES('cast'),('coalesce'),('convert'),('nullif')) as sf"; | 465 " UNION SELECT * FROM (VALUES('cast'),('coalesce'),('convert'),('ifnull'),('nullif')) as sf"; |
461 // ToDo: from release 11.47.1 we also support function: ifnull, but only with odbc escape notation, so {fn ifnull(null, 2)}. Related issue: 6933. | 466 try { |
462 return getConcatenatedStringFromQuery(FunctionsSelect + wherePart + FunctionsOrderBy1); | 467 // from release 11.47.1 we support function: ifnull, but only with odbc escape notation, so {fn ifnull(null, 2)}. See issue: 6933. |
468 // from release 11.49.1 we support function: ifnull also without odbc escape notation. | |
469 if ((con.getDatabaseMajorVersion() == 11) && (con.getDatabaseMinorVersion() <= 45)) | |
470 // release 11.45 (Sep2022) or older did not support function: ifnull. | |
471 unionPart = unionPart.replace(",('ifnull')", ""); | |
472 } catch (SQLException e) { /* ignore */ } | |
473 return getConcatenatedStringFromQuery(FunctionsSelect + wherePart + unionPart + FunctionsOrderBy1); | |
463 } | 474 } |
464 | 475 |
465 @Override | 476 @Override |
466 public String getTimeDateFunctions() { | 477 public String getTimeDateFunctions() { |
467 final String wherePart = | 478 final String wherePart = |