Changeset: 34f9ddd1a4e5 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=34f9ddd1a4e5
Modified Files:
        ChangeLog
        src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
Branch: default
Log Message:

Corrected and extended output of DatabaseMetaData methods 
getTimeDateFunctions() and getSystemFunctions().
The Date/Time functions (curdate, current_date, current_time, 
current_timestamp, curtime, local_timezone, localtime, localtimestamp)
were returned by getSystemFunctions() but are now returned by 
getTimeDateFunctions().
getTimeDateFunctions() now also lists functions: date_to_str, extract, now, 
str_to_date, str_to_time, str_to_timestamp, time_to_str and timestamp_to_str.


diffs (42 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,13 @@
 # This file is updated with Maddlog
 
 * Thu Apr 26 2018 Martin van Dinther <[email protected]>
+- Corrected and extended output of DatabaseMetaData methods
+  getTimeDateFunctions() and getSystemFunctions().  The Date/Time functions
+  (curdate, current_date, current_time, current_timestamp, curtime,
+  local_timezone, localtime, localtimestamp) were returned by
+  getSystemFunctions() but are now returned by getTimeDateFunctions().
+  getTimeDateFunctions() now also lists functions: date_to_str, extract, now,
+  str_to_date, str_to_time, str_to_timestamp, time_to_str and timestamp_to_str.
 - Improved DatabaseMetaData methods getTablePrivileges() and
   getColumnPrivileges() by returning also any combination of privileges
   for the table or column in the PRIVILEGE result column. Previously only
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java 
b/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
@@ -510,6 +510,9 @@ public class MonetDatabaseMetaData exten
                        "WHERE \"id\" NOT IN (SELECT \"func_id\" FROM 
\"sys\".\"args\" WHERE \"number\" = 1)" +
                        " AND \"id\" IN (SELECT \"function_id\" FROM 
\"sys\".\"systemfunctions\")" +
                        " AND \"type\" = 1" +   // only scalar functions
+                       // exclude functions which belong to the 'mtime' module
+                       " AND \"mod\" <> 'mtime'" +
+                       " AND \"name\" NOT IN ('localtime', 'localtimestamp')" +
                        // add system functions which are not listed in 
sys.functions but implemented in the SQL parser (see sql/server/sql_parser.y)
                        " UNION SELECT 'cast'" +
                        " UNION SELECT 'convert'" +
@@ -523,9 +526,8 @@ public class MonetDatabaseMetaData exten
 
        @Override
        public String getTimeDateFunctions() {
-               String match =
-                       "('date', 'time', 'timestamp', 'timetz', 'timestamptz', 
'sec_interval', 'month_interval') )";
-               return getConcatenatedStringFromQuery(FunctionsSelect + 
FunctionsWhere + match + AddFunctionsMaxMin + FunctionsOrderBy1);
+               String wherePart = "WHERE \"mod\" = 'mtime' OR \"name\" IN 
('localtime', 'localtimestamp') UNION SELECT 'extract' UNION SELECT 'now'";
+               return getConcatenatedStringFromQuery(FunctionsSelect + 
wherePart + AddFunctionsMaxMin + FunctionsOrderBy1);
        }
 
        /**
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to