db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r348330 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/jdbc/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ testing/org/apache/derbyTesting/functionTests/ma...
Date Wed, 23 Nov 2005 00:57:23 GMT
Author: djd
Date: Tue Nov 22 16:57:15 2005
New Revision: 348330

URL: http://svn.apache.org/viewcvs?rev=348330&view=rev
Log:
DERBY-471 Correct DatabaseMetaData.getTimeDateFunctions to correctly return
a valid subset of the JDBC/ODBC escaped functions that Derby supports.
Expanded existing tests for time date functions.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadataJdbc20.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadataJdbc20.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/odbc_metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/metadataJdbc20.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/odbc_metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadataJdbc20.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadataJdbc20.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java
Tue Nov 22 16:57:15 2005
@@ -450,13 +450,13 @@
 	}
 
     /**
-     * Get a comma separated list of time and date functions.
-		not sure if this includes these built-ins or not, but here they are.
-		FIXME: find a way to reference method aliases known to be "date/time"
-     * @return the list
+     * Get a comma separated list of JDBC escaped time date functions.
+     * Must be a complete or sub set of functions in appendix C.3
+     * of JDBC 3.0 specification.
+      * @return the list
      */
 	public String getTimeDateFunctions() {
-		return "CURDATE,CURTIME,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,EXTRACT";
+		return "CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR";
 	}
 
     /**

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out
Tue Nov 22 16:57:15 2005
@@ -64,7 +64,7 @@
 getNumericFunctions(): ABS,MOD,SQRT
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
-getTimeDateFunctions(): CURDATE,CURTIME,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,EXTRACT
+getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): true
 supportsAlterTableWithDropColumn(): true

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadataJdbc20.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadataJdbc20.out?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadataJdbc20.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadataJdbc20.out
Tue Nov 22 16:57:15 2005
@@ -102,6 +102,34 @@
 SQLSTATE(42X01): Syntax error: Encountered "SOUNDEX" at line 1, column 13.
 Executing VALUES { fn SPACE(12) } -- 
 SQLSTATE(42X01): Syntax error: Encountered "SPACE" at line 1, column 13.
+Test escaped date time functions - JDBC 3.0 C.3
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES CASE WHEN { fn CURDATE()} = CURRENT_DATE THEN 'OK' ELSE 'wrong' END -- 
 = >OK<  << 
+Executing VALUES CASE WHEN { fn CURTIME()} = CURRENT_TIME THEN 'OK' ELSE 'wrong' END -- 
 = >OK<  << 
+Executing VALUES { fn HOUR({t '16:13:03'}) } --   = >16<  << 
+Executing VALUES { fn MINUTE({t '16:13:03'}) } --   = >13<  << 
+Executing VALUES { fn MONTH({d '1995-12-19'}) } --   = >12<  << 
+Executing VALUES { fn SECOND({t '16:13:03'}) } --   = >3<  << 
+Executing VALUES { fn TIMESTAMPADD(SQL_TSI_DAY, 7, {ts 'xxxxxxFILTERED-TIMESTAMPxxxxx}) }
--   = >xxxxxxFILTERED-TIMESTAMPxxxxx<  << 
+Executing VALUES { fn TIMESTAMPDIFF(SQL_TSI_DAY, {ts 'xxxxxxFILTERED-TIMESTAMPxxxxx}, {ts
'xxxxxxFILTERED-TIMESTAMPxxxxx}) } --   = >683<  << 
+Executing VALUES { fn YEAR({d '1995-12-19'}) } --   = >1995<  << 
+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn DAYNAME({d '1995-12-19'h}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYNAME" at line 1, column 13.
+Executing VALUES { fn DAYOFMONTH({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYOFMONTH" at line 1, column 13.
+Executing VALUES { fn DAYOFWEEK({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYOFWEEK" at line 1, column 13.
+Executing VALUES { fn DAYOFYEAR({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYOFYEAR" at line 1, column 13.
+Executing VALUES { fn MONTHNAME({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "MONTHNAME" at line 1, column 13.
+Executing VALUES CASE WHEN { fn NOW()} = CURRENT_TIMESTAMP THEN 'OK' ELSE 'wrong' END --

+SQLSTATE(42X01): Syntax error: Encountered "NOW" at line 1, column 23.
+Executing VALUES { fn QUARTER({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "QUARTER" at line 1, column 13.
+Executing VALUES { fn WEEK({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "WEEK" at line 1, column 13.
 Test escaped system functions - JDBC 3.0 C.4
 TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
 Executing VALUES { fn USER() } --   = >APP<  << 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out
Tue Nov 22 16:57:15 2005
@@ -94,7 +94,7 @@
 getNumericFunctions(): ABS,MOD,SQRT
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
-getTimeDateFunctions(): CURDATE,CURTIME,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,EXTRACT
+getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): true
 supportsAlterTableWithDropColumn(): true

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadata.out?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadata.out
Tue Nov 22 16:57:15 2005
@@ -64,7 +64,7 @@
 getNumericFunctions(): ABS,MOD,SQRT
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
-getTimeDateFunctions(): CURDATE,CURTIME,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,EXTRACT
+getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): true
 supportsAlterTableWithDropColumn(): true

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadataJdbc20.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadataJdbc20.out?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadataJdbc20.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadataJdbc20.out
Tue Nov 22 16:57:15 2005
@@ -102,6 +102,34 @@
 SQLSTATE(42X01): Syntax error: Encountered "SOUNDEX" at line 1, column 13.
 Executing VALUES { fn SPACE(12) } -- 
 SQLSTATE(42X01): Syntax error: Encountered "SPACE" at line 1, column 13.
+Test escaped date time functions - JDBC 3.0 C.3
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES CASE WHEN { fn CURDATE()} = CURRENT_DATE THEN 'OK' ELSE 'wrong' END -- 
 = >OK<  << 
+Executing VALUES CASE WHEN { fn CURTIME()} = CURRENT_TIME THEN 'OK' ELSE 'wrong' END -- 
 = >OK<  << 
+Executing VALUES { fn HOUR({t '16:13:03'}) } --   = >16<  << 
+Executing VALUES { fn MINUTE({t '16:13:03'}) } --   = >13<  << 
+Executing VALUES { fn MONTH({d '1995-12-19'}) } --   = >12<  << 
+Executing VALUES { fn SECOND({t '16:13:03'}) } --   = >3<  << 
+Executing VALUES { fn TIMESTAMPADD(SQL_TSI_DAY, 7, {ts 'xxxxxxFILTERED-TIMESTAMPxxxxx}) }
--   = >xxxxxxFILTERED-TIMESTAMPxxxxx<  << 
+Executing VALUES { fn TIMESTAMPDIFF(SQL_TSI_DAY, {ts 'xxxxxxFILTERED-TIMESTAMPxxxxx}, {ts
'xxxxxxFILTERED-TIMESTAMPxxxxx}) } --   = >683<  << 
+Executing VALUES { fn YEAR({d '1995-12-19'}) } --   = >1995<  << 
+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn DAYNAME({d '1995-12-19'h}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYNAME" at line 1, column 13.
+Executing VALUES { fn DAYOFMONTH({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYOFMONTH" at line 1, column 13.
+Executing VALUES { fn DAYOFWEEK({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYOFWEEK" at line 1, column 13.
+Executing VALUES { fn DAYOFYEAR({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYOFYEAR" at line 1, column 13.
+Executing VALUES { fn MONTHNAME({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "MONTHNAME" at line 1, column 13.
+Executing VALUES CASE WHEN { fn NOW()} = CURRENT_TIMESTAMP THEN 'OK' ELSE 'wrong' END --

+SQLSTATE(42X01): Syntax error: Encountered "NOW" at line 1, column 23.
+Executing VALUES { fn QUARTER({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "QUARTER" at line 1, column 13.
+Executing VALUES { fn WEEK({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "WEEK" at line 1, column 13.
 Test escaped system functions - JDBC 3.0 C.4
 TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
 Executing VALUES { fn USER() } --   = >APP<  << 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/odbc_metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/odbc_metadata.out?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/odbc_metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/odbc_metadata.out
Tue Nov 22 16:57:15 2005
@@ -94,7 +94,7 @@
 getNumericFunctions(): ABS,MOD,SQRT
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
-getTimeDateFunctions(): CURDATE,CURTIME,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,EXTRACT
+getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): true
 supportsAlterTableWithDropColumn(): true

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/metadata.out?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/metadata.out
Tue Nov 22 16:57:15 2005
@@ -64,7 +64,7 @@
 getNumericFunctions(): ABS,MOD,SQRT
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
-getTimeDateFunctions(): CURDATE,CURTIME,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,EXTRACT
+getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): true
 supportsAlterTableWithDropColumn(): true

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/metadataJdbc20.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/metadataJdbc20.out?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/metadataJdbc20.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/metadataJdbc20.out
Tue Nov 22 16:57:15 2005
@@ -102,6 +102,34 @@
 SQLSTATE(42X01): Syntax error: Encountered "SOUNDEX" at line 1, column 13.
 Executing VALUES { fn SPACE(12) } -- 
 SQLSTATE(42X01): Syntax error: Encountered "SPACE" at line 1, column 13.
+Test escaped date time functions - JDBC 3.0 C.3
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES CASE WHEN { fn CURDATE()} = CURRENT_DATE THEN 'OK' ELSE 'wrong' END -- 
 = >OK<  << 
+Executing VALUES CASE WHEN { fn CURTIME()} = CURRENT_TIME THEN 'OK' ELSE 'wrong' END -- 
 = >OK<  << 
+Executing VALUES { fn HOUR({t '16:13:03'}) } --   = >16<  << 
+Executing VALUES { fn MINUTE({t '16:13:03'}) } --   = >13<  << 
+Executing VALUES { fn MONTH({d '1995-12-19'}) } --   = >12<  << 
+Executing VALUES { fn SECOND({t '16:13:03'}) } --   = >3<  << 
+Executing VALUES { fn TIMESTAMPADD(SQL_TSI_DAY, 7, {ts 'xxxxxxFILTERED-TIMESTAMPxxxxx}) }
--   = >xxxxxxFILTERED-TIMESTAMPxxxxx<  << 
+Executing VALUES { fn TIMESTAMPDIFF(SQL_TSI_DAY, {ts 'xxxxxxFILTERED-TIMESTAMPxxxxx}, {ts
'xxxxxxFILTERED-TIMESTAMPxxxxx}) } --   = >683<  << 
+Executing VALUES { fn YEAR({d '1995-12-19'}) } --   = >1995<  << 
+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn DAYNAME({d '1995-12-19'h}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYNAME" at line 1, column 13.
+Executing VALUES { fn DAYOFMONTH({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYOFMONTH" at line 1, column 13.
+Executing VALUES { fn DAYOFWEEK({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYOFWEEK" at line 1, column 13.
+Executing VALUES { fn DAYOFYEAR({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYOFYEAR" at line 1, column 13.
+Executing VALUES { fn MONTHNAME({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "MONTHNAME" at line 1, column 13.
+Executing VALUES CASE WHEN { fn NOW()} = CURRENT_TIMESTAMP THEN 'OK' ELSE 'wrong' END --

+SQLSTATE(42X01): Syntax error: Encountered "NOW" at line 1, column 23.
+Executing VALUES { fn QUARTER({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "QUARTER" at line 1, column 13.
+Executing VALUES { fn WEEK({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "WEEK" at line 1, column 13.
 Test escaped system functions - JDBC 3.0 C.4
 TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
 Executing VALUES { fn USER() } --   = >APP<  << 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/odbc_metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/odbc_metadata.out?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/odbc_metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/odbc_metadata.out
Tue Nov 22 16:57:15 2005
@@ -94,7 +94,7 @@
 getNumericFunctions(): ABS,MOD,SQRT
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
-getTimeDateFunctions(): CURDATE,CURTIME,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,EXTRACT
+getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): true
 supportsAlterTableWithDropColumn(): true

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out
Tue Nov 22 16:57:15 2005
@@ -64,7 +64,7 @@
 getNumericFunctions(): ABS,MOD,SQRT
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
-getTimeDateFunctions(): CURDATE,CURTIME,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,EXTRACT
+getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): true
 supportsAlterTableWithDropColumn(): true

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadataJdbc20.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadataJdbc20.out?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadataJdbc20.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadataJdbc20.out
Tue Nov 22 16:57:15 2005
@@ -102,6 +102,34 @@
 SQLSTATE(42X01): Syntax error: Encountered "SOUNDEX" at line 1, column 13.
 Executing VALUES { fn SPACE(12) } -- 
 SQLSTATE(42X01): Syntax error: Encountered "SPACE" at line 1, column 13.
+Test escaped date time functions - JDBC 3.0 C.3
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES CASE WHEN { fn CURDATE()} = CURRENT_DATE THEN 'OK' ELSE 'wrong' END -- 
 = >OK<  << 
+Executing VALUES CASE WHEN { fn CURTIME()} = CURRENT_TIME THEN 'OK' ELSE 'wrong' END -- 
 = >OK<  << 
+Executing VALUES { fn HOUR({t '16:13:03'}) } --   = >16<  << 
+Executing VALUES { fn MINUTE({t '16:13:03'}) } --   = >13<  << 
+Executing VALUES { fn MONTH({d '1995-12-19'}) } --   = >12<  << 
+Executing VALUES { fn SECOND({t '16:13:03'}) } --   = >3<  << 
+Executing VALUES { fn TIMESTAMPADD(SQL_TSI_DAY, 7, {ts 'xxxxxxFILTERED-TIMESTAMPxxxxx}) }
--   = >xxxxxxFILTERED-TIMESTAMPxxxxx<  << 
+Executing VALUES { fn TIMESTAMPDIFF(SQL_TSI_DAY, {ts 'xxxxxxFILTERED-TIMESTAMPxxxxx}, {ts
'xxxxxxFILTERED-TIMESTAMPxxxxx}) } --   = >683<  << 
+Executing VALUES { fn YEAR({d '1995-12-19'}) } --   = >1995<  << 
+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn DAYNAME({d '1995-12-19'h}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYNAME" at line 1, column 13.
+Executing VALUES { fn DAYOFMONTH({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYOFMONTH" at line 1, column 13.
+Executing VALUES { fn DAYOFWEEK({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYOFWEEK" at line 1, column 13.
+Executing VALUES { fn DAYOFYEAR({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DAYOFYEAR" at line 1, column 13.
+Executing VALUES { fn MONTHNAME({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "MONTHNAME" at line 1, column 13.
+Executing VALUES CASE WHEN { fn NOW()} = CURRENT_TIMESTAMP THEN 'OK' ELSE 'wrong' END --

+SQLSTATE(42X01): Syntax error: Encountered "NOW" at line 1, column 23.
+Executing VALUES { fn QUARTER({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "QUARTER" at line 1, column 13.
+Executing VALUES { fn WEEK({d '1995-12-19'}) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "WEEK" at line 1, column 13.
 Test escaped system functions - JDBC 3.0 C.4
 TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
 Executing VALUES { fn USER() } --   = >APP<  << 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out
Tue Nov 22 16:57:15 2005
@@ -94,7 +94,7 @@
 getNumericFunctions(): ABS,MOD,SQRT
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
-getTimeDateFunctions(): CURDATE,CURTIME,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,EXTRACT
+getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): true
 supportsAlterTableWithDropColumn(): true

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadataJdbc20.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadataJdbc20.java?rev=348330&r1=348329&r2=348330&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadataJdbc20.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadataJdbc20.java
Tue Nov 22 16:57:15 2005
@@ -117,7 +117,10 @@
 			
 			System.out.println("Test escaped string functions - JDBC 3.0 C.2");
 			testEscapedFunctions(con, STRING_FUNCTIONS, met.getStringFunctions());
-			
+
+			System.out.println("Test escaped date time functions - JDBC 3.0 C.3");
+			testEscapedFunctions(con, TIMEDATE_FUNCTIONS, met.getTimeDateFunctions());
+
 			System.out.println("Test escaped system functions - JDBC 3.0 C.4");
 			testEscapedFunctions(con, SYSTEM_FUNCTIONS, met.getSystemFunctions());
 
@@ -235,6 +238,29 @@
 		{ "UCASE", "'Fernando Alonso'" }
 		};
 	
+	private static final String[][] TIMEDATE_FUNCTIONS =
+	{	
+		// Section C.3 JDBC 3.0 spec.
+		{ "CURDATE" },
+		{ "CURTIME" },
+		{ "DAYNAME", "{d '1995-12-19'h}" },
+		{ "DAYOFMONTH", "{d '1995-12-19'}" },
+		{ "DAYOFWEEK", "{d '1995-12-19'}" },
+		{ "DAYOFYEAR", "{d '1995-12-19'}" },
+		{ "HOUR", "{t '16:13:03'}" },
+		{ "MINUTE", "{t '16:13:03'}" },
+		{ "MONTH", "{d '1995-12-19'}" },
+		{ "MONTHNAME", "{d '1995-12-19'}" },
+		{ "NOW" },
+		{ "QUARTER", "{d '1995-12-19'}" },
+		{ "SECOND", "{t '16:13:03'}" },
+		{ "TIMESTAMPADD", "SQL_TSI_DAY", "7", "{ts '1995-12-19 12:15:54'}" },
+		{ "TIMESTAMPDIFF", "SQL_TSI_DAY", "{ts '1995-12-19 12:15:54'}", "{ts '1997-11-02 00:15:23'}"
},
+		{ "WEEK", "{d '1995-12-19'}" },
+		{ "YEAR", "{d '1995-12-19'}" },
+		
+	};
+
 	private static final String[][] SYSTEM_FUNCTIONS =
 	{	
 		// Section C.4 JDBC 3.0 spec.
@@ -322,6 +348,18 @@
 		}
 		
 		sql = sql + ") }";
+		
+		// Special processing for functions that return
+		// current date, time or timestamp. This is to
+		// ensure we don't have output that depends on
+		// the time the test is run.
+		if ("CURDATE".equals(specDetails[0]))
+			sql = "VALUES CASE WHEN { fn CURDATE()} = CURRENT_DATE THEN 'OK' ELSE 'wrong' END";
+		else if ("CURTIME".equals(specDetails[0]))
+			sql = "VALUES CASE WHEN { fn CURTIME()} = CURRENT_TIME THEN 'OK' ELSE 'wrong' END";
+		else if ("NOW".equals(specDetails[0]))
+			sql = "VALUES CASE WHEN { fn NOW()} = CURRENT_TIMESTAMP THEN 'OK' ELSE 'wrong' END";
+		
 		
 		System.out.print("Executing " + sql + " -- ");
 			



Mime
View raw message