db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r348289 - 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 Tue, 22 Nov 2005 23:29:12 GMT
Author: djd
Date: Tue Nov 22 15:29:01 2005
New Revision: 348289

URL: http://svn.apache.org/viewcvs?rev=348289&view=rev
Log:
DERBY-471 Correct DatabaseMetaData.getNumericFunctions,getSystemFunctions and getStringFunctions
to correctly return a valid subset of the JDBC/ODBC escaped functions that Derby supports.
Added tests that ensure the functions listed by Derby are supported, and that all
the functions defined by the spec and supported by Derby are listed by Derby.

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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -421,35 +421,32 @@
 	}
 
     /**
-     * Get a comma separated list of math functions.
-	getNumericFunctions lists "math functions" -- so built-in operators and
-	things like EXTRACT are not included.
-	FIXME: find a way to reference method aliases known to be "numeric"
-    *
+     * Get a comma separated list of JDBC escaped numeric functions.
+     * Must be a complete or sub set of functions in appendix C.1
      * @return the list
      */
 	public String getNumericFunctions() {
-		return "ABS,SQRT";
+		return "ABS,MOD,SQRT";
 	}
 
     /**
-     * Get a comma separated list of string functions.
-		REMIND, when they show up, something like this might appear here:
-		FIXME: find a way to reference method aliases known to be "string"
+     * Get a comma separated list of JDBC escaped string functions.
+     * Must be a complete or sub set of functions in appendix C.2
+     * of JDBC 3.0 specification.
      * @return the list
      */
 	public String getStringFunctions() {
-		return "LENGTH,LOWER,LTRIM,RTRIM,SUBSTR,SUBSTRING,UPPER";
+		return "CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE";
 	}
 
     /**
-     * Get a comma separated list of system functions.
-		FIXME: find a way to reference system functions on Database when/if
-		they are registered as aliases or include the Database object too.
+     * Get a comma separated list of JDBC escaped system functions.
+     * Must be a complete or sub set of functions in appendix C.4
+     * of JDBC 3.0 specification.
      * @return the list
      */
 	public String getSystemFunctions()  {
-		return "CURRENT_USER,getCurrentConnection,runTimeStatistics,SESSION_USER,USER,CURRENT SCHEMA";
+		return "USER";
 	}
 
     /**

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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -61,9 +61,9 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,SQRT
-getStringFunctions(): LENGTH,LOWER,LTRIM,RTRIM,SUBSTR,SUBSTRING,UPPER
-getSystemFunctions(): CURRENT_USER,getCurrentConnection,runTimeStatistics,SESSION_USER,USER,CURRENT
SCHEMA
+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
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): 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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -25,4 +25,89 @@
 othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
+Test escaped numeric functions - JDBC 3.0 C.1
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn ABS(-25.67) } --   = >25.67<  << 
+Executing VALUES { fn MOD(124, 7) } --   = >5<  << 
+Executing VALUES { fn SQRT(6.22) } --   = >2.49<  << 
+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn ACOS(1.34) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ACOS" at line 1, column 13.
+Executing VALUES { fn ASIN(1.21) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ASIN" at line 1, column 13.
+Executing VALUES { fn ATAN(0.34) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ATAN" at line 1, column 13.
+Executing VALUES { fn ATAN2(0.56, 1.2) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ATAN2" at line 1, column 13.
+Executing VALUES { fn CEILING(3.45) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "CEILING" at line 1, column 13.
+Executing VALUES { fn COS(1.2) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "COS" at line 1, column 13.
+Executing VALUES { fn COT(3.4) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "COT" at line 1, column 13.
+Executing VALUES { fn DEGREES(2.1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DEGREES" at line 1, column 13.
+Executing VALUES { fn EXP(2.3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "EXP" at line 1, column 13.
+Executing VALUES { fn FLOOR(3.22) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "FLOOR" at line 1, column 13.
+Executing VALUES { fn LOG(34.1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "LOG" at line 1, column 13.
+Executing VALUES { fn LOG10(18.7) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "LOG10" at line 1, column 13.
+Executing VALUES { fn PI() } -- 
+SQLSTATE(42X01): Syntax error: Encountered "PI" at line 1, column 13.
+Executing VALUES { fn POWER(2, 3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "POWER" at line 1, column 13.
+Executing VALUES { fn RADIANS(54) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "RADIANS" at line 1, column 13.
+Executing VALUES { fn RAND(17) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "RAND" at line 1, column 13.
+Executing VALUES { fn ROUND(345.345, 1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ROUND" at line 1, column 13.
+Executing VALUES { fn SIGN(-34) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "SIGN" at line 1, column 13.
+Executing VALUES { fn SIN(0.32) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "SIN" at line 1, column 13.
+Executing VALUES { fn TAN(0.57) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "TAN" at line 1, column 13.
+Executing VALUES { fn TRUNCATE(345.395, 1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "TRUNCATE" at line 1, column 13.
+Test escaped string functions - JDBC 3.0 C.2
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn CONCAT('hello', 'there') } --   = >hellothere<  << 
+Executing VALUES { fn LENGTH('four    ') } --   = >4<  << 
+Executing VALUES { fn LCASE('Fernando Alonso') } --   = >fernando alonso<  <<

+Executing VALUES { fn LOCATE('jour', 'Bonjour') } --   = >4<  << 
+Executing VALUES { fn LTRIM('   left trim   ') } --   = >left trim   <  << 
+Executing VALUES { fn RTRIM('  right trim   ') } --   = >  right trim<  << 
+Executing VALUES { fn SUBSTRING('Ruby the Rubicon Jeep', 10, 7) } --   = >Rubicon<
 << 
+Executing VALUES { fn UCASE('Fernando Alonso') } --   = >FERNANDO ALONSO<  <<

+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn ASCII('Yellow') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ASCII" at line 1, column 13.
+Executing VALUES { fn CHAR(65) } --   = >65         <  << 
+FAIL function works but not declared in list: CHAR
+Executing VALUES { fn DIFFERENCE('Pires', 'Piers') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DIFFERENCE" at line 1, column 13.
+Executing VALUES { fn INSERT('Bill Clinton', 4, 'William') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "INSERT" at line 1, column 13.
+Executing VALUES { fn LEFT('Bonjour', 3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "LEFT" at line 1, column 13.
+Executing VALUES { fn REPEAT('echo', 3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "REPEAT" at line 1, column 13.
+Executing VALUES { fn REPLACE('to be or not to be', 'be', 'England') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "REPLACE" at line 1, column 13.
+Executing VALUES { fn SOUNDEX('Derby') } -- 
+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 system functions - JDBC 3.0 C.4
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn USER() } --   = >APP<  << 
+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn DATABASE() } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DATABASE" at line 1, column 13.
+Executing VALUES { fn IFNULL('this', 'that') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "IFNULL" at line 1, column 13.
 Test metadataJdbc20 finished

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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -91,9 +91,9 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,SQRT
-getStringFunctions(): LENGTH,LOWER,LTRIM,RTRIM,SUBSTR,SUBSTRING,UPPER
-getSystemFunctions(): CURRENT_USER,getCurrentConnection,runTimeStatistics,SESSION_USER,USER,CURRENT
SCHEMA
+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
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): 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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -61,9 +61,9 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,SQRT
-getStringFunctions(): LENGTH,LOWER,LTRIM,RTRIM,SUBSTR,SUBSTRING,UPPER
-getSystemFunctions(): CURRENT_USER,getCurrentConnection,runTimeStatistics,SESSION_USER,USER,CURRENT
SCHEMA
+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
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): 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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -25,4 +25,89 @@
 othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
+Test escaped numeric functions - JDBC 3.0 C.1
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn ABS(-25.67) } --   = >25.67<  << 
+Executing VALUES { fn MOD(124, 7) } --   = >5<  << 
+Executing VALUES { fn SQRT(6.22) } --   = >2.49<  << 
+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn ACOS(1.34) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ACOS" at line 1, column 13.
+Executing VALUES { fn ASIN(1.21) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ASIN" at line 1, column 13.
+Executing VALUES { fn ATAN(0.34) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ATAN" at line 1, column 13.
+Executing VALUES { fn ATAN2(0.56, 1.2) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ATAN2" at line 1, column 13.
+Executing VALUES { fn CEILING(3.45) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "CEILING" at line 1, column 13.
+Executing VALUES { fn COS(1.2) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "COS" at line 1, column 13.
+Executing VALUES { fn COT(3.4) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "COT" at line 1, column 13.
+Executing VALUES { fn DEGREES(2.1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DEGREES" at line 1, column 13.
+Executing VALUES { fn EXP(2.3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "EXP" at line 1, column 13.
+Executing VALUES { fn FLOOR(3.22) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "FLOOR" at line 1, column 13.
+Executing VALUES { fn LOG(34.1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "LOG" at line 1, column 13.
+Executing VALUES { fn LOG10(18.7) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "LOG10" at line 1, column 13.
+Executing VALUES { fn PI() } -- 
+SQLSTATE(42X01): Syntax error: Encountered "PI" at line 1, column 13.
+Executing VALUES { fn POWER(2, 3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "POWER" at line 1, column 13.
+Executing VALUES { fn RADIANS(54) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "RADIANS" at line 1, column 13.
+Executing VALUES { fn RAND(17) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "RAND" at line 1, column 13.
+Executing VALUES { fn ROUND(345.345, 1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ROUND" at line 1, column 13.
+Executing VALUES { fn SIGN(-34) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "SIGN" at line 1, column 13.
+Executing VALUES { fn SIN(0.32) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "SIN" at line 1, column 13.
+Executing VALUES { fn TAN(0.57) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "TAN" at line 1, column 13.
+Executing VALUES { fn TRUNCATE(345.395, 1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "TRUNCATE" at line 1, column 13.
+Test escaped string functions - JDBC 3.0 C.2
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn CONCAT('hello', 'there') } --   = >hellothere<  << 
+Executing VALUES { fn LENGTH('four    ') } --   = >4<  << 
+Executing VALUES { fn LCASE('Fernando Alonso') } --   = >fernando alonso<  <<

+Executing VALUES { fn LOCATE('jour', 'Bonjour') } --   = >4<  << 
+Executing VALUES { fn LTRIM('   left trim   ') } --   = >left trim   <  << 
+Executing VALUES { fn RTRIM('  right trim   ') } --   = >  right trim<  << 
+Executing VALUES { fn SUBSTRING('Ruby the Rubicon Jeep', 10, 7) } --   = >Rubicon<
 << 
+Executing VALUES { fn UCASE('Fernando Alonso') } --   = >FERNANDO ALONSO<  <<

+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn ASCII('Yellow') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ASCII" at line 1, column 13.
+Executing VALUES { fn CHAR(65) } --   = >65         <  << 
+FAIL function works but not declared in list: CHAR
+Executing VALUES { fn DIFFERENCE('Pires', 'Piers') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DIFFERENCE" at line 1, column 13.
+Executing VALUES { fn INSERT('Bill Clinton', 4, 'William') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "INSERT" at line 1, column 13.
+Executing VALUES { fn LEFT('Bonjour', 3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "LEFT" at line 1, column 13.
+Executing VALUES { fn REPEAT('echo', 3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "REPEAT" at line 1, column 13.
+Executing VALUES { fn REPLACE('to be or not to be', 'be', 'England') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "REPLACE" at line 1, column 13.
+Executing VALUES { fn SOUNDEX('Derby') } -- 
+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 system functions - JDBC 3.0 C.4
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn USER() } --   = >APP<  << 
+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn DATABASE() } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DATABASE" at line 1, column 13.
+Executing VALUES { fn IFNULL('this', 'that') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "IFNULL" at line 1, column 13.
 Test metadataJdbc20 finished

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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -91,9 +91,9 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,SQRT
-getStringFunctions(): LENGTH,LOWER,LTRIM,RTRIM,SUBSTR,SUBSTRING,UPPER
-getSystemFunctions(): CURRENT_USER,getCurrentConnection,runTimeStatistics,SESSION_USER,USER,CURRENT
SCHEMA
+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
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): 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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -61,9 +61,9 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,SQRT
-getStringFunctions(): LENGTH,LOWER,LTRIM,RTRIM,SUBSTR,SUBSTRING,UPPER
-getSystemFunctions(): CURRENT_USER,getCurrentConnection,runTimeStatistics,SESSION_USER,USER,CURRENT
SCHEMA
+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
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): 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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -25,4 +25,89 @@
 othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
+Test escaped numeric functions - JDBC 3.0 C.1
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn ABS(-25.67) } --   = >25.67<  << 
+Executing VALUES { fn MOD(124, 7) } --   = >5<  << 
+Executing VALUES { fn SQRT(6.22) } --   = >2.49<  << 
+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn ACOS(1.34) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ACOS" at line 1, column 13.
+Executing VALUES { fn ASIN(1.21) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ASIN" at line 1, column 13.
+Executing VALUES { fn ATAN(0.34) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ATAN" at line 1, column 13.
+Executing VALUES { fn ATAN2(0.56, 1.2) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ATAN2" at line 1, column 13.
+Executing VALUES { fn CEILING(3.45) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "CEILING" at line 1, column 13.
+Executing VALUES { fn COS(1.2) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "COS" at line 1, column 13.
+Executing VALUES { fn COT(3.4) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "COT" at line 1, column 13.
+Executing VALUES { fn DEGREES(2.1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DEGREES" at line 1, column 13.
+Executing VALUES { fn EXP(2.3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "EXP" at line 1, column 13.
+Executing VALUES { fn FLOOR(3.22) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "FLOOR" at line 1, column 13.
+Executing VALUES { fn LOG(34.1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "LOG" at line 1, column 13.
+Executing VALUES { fn LOG10(18.7) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "LOG10" at line 1, column 13.
+Executing VALUES { fn PI() } -- 
+SQLSTATE(42X01): Syntax error: Encountered "PI" at line 1, column 13.
+Executing VALUES { fn POWER(2, 3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "POWER" at line 1, column 13.
+Executing VALUES { fn RADIANS(54) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "RADIANS" at line 1, column 13.
+Executing VALUES { fn RAND(17) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "RAND" at line 1, column 13.
+Executing VALUES { fn ROUND(345.345, 1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ROUND" at line 1, column 13.
+Executing VALUES { fn SIGN(-34) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "SIGN" at line 1, column 13.
+Executing VALUES { fn SIN(0.32) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "SIN" at line 1, column 13.
+Executing VALUES { fn TAN(0.57) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "TAN" at line 1, column 13.
+Executing VALUES { fn TRUNCATE(345.395, 1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "TRUNCATE" at line 1, column 13.
+Test escaped string functions - JDBC 3.0 C.2
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn CONCAT('hello', 'there') } --   = >hellothere<  << 
+Executing VALUES { fn LENGTH('four    ') } --   = >4<  << 
+Executing VALUES { fn LCASE('Fernando Alonso') } --   = >fernando alonso<  <<

+Executing VALUES { fn LOCATE('jour', 'Bonjour') } --   = >4<  << 
+Executing VALUES { fn LTRIM('   left trim   ') } --   = >left trim   <  << 
+Executing VALUES { fn RTRIM('  right trim   ') } --   = >  right trim<  << 
+Executing VALUES { fn SUBSTRING('Ruby the Rubicon Jeep', 10, 7) } --   = >Rubicon<
 << 
+Executing VALUES { fn UCASE('Fernando Alonso') } --   = >FERNANDO ALONSO<  <<

+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn ASCII('Yellow') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ASCII" at line 1, column 13.
+Executing VALUES { fn CHAR(65) } --   = >65         <  << 
+FAIL function works but not declared in list: CHAR
+Executing VALUES { fn DIFFERENCE('Pires', 'Piers') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DIFFERENCE" at line 1, column 13.
+Executing VALUES { fn INSERT('Bill Clinton', 4, 'William') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "INSERT" at line 1, column 13.
+Executing VALUES { fn LEFT('Bonjour', 3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "LEFT" at line 1, column 13.
+Executing VALUES { fn REPEAT('echo', 3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "REPEAT" at line 1, column 13.
+Executing VALUES { fn REPLACE('to be or not to be', 'be', 'England') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "REPLACE" at line 1, column 13.
+Executing VALUES { fn SOUNDEX('Derby') } -- 
+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 system functions - JDBC 3.0 C.4
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn USER() } --   = >APP<  << 
+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn DATABASE() } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DATABASE" at line 1, column 13.
+Executing VALUES { fn IFNULL('this', 'that') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "IFNULL" at line 1, column 13.
 Test metadataJdbc20 finished

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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -91,9 +91,9 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,SQRT
-getStringFunctions(): LENGTH,LOWER,LTRIM,RTRIM,SUBSTR,SUBSTRING,UPPER
-getSystemFunctions(): CURRENT_USER,getCurrentConnection,runTimeStatistics,SESSION_USER,USER,CURRENT
SCHEMA
+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
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): 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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -61,9 +61,9 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,SQRT
-getStringFunctions(): LENGTH,LOWER,LTRIM,RTRIM,SUBSTR,SUBSTRING,UPPER
-getSystemFunctions(): CURRENT_USER,getCurrentConnection,runTimeStatistics,SESSION_USER,USER,CURRENT
SCHEMA
+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
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): 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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -25,4 +25,89 @@
 othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
+Test escaped numeric functions - JDBC 3.0 C.1
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn ABS(-25.67) } --   = >25.67<  << 
+Executing VALUES { fn MOD(124, 7) } --   = >5<  << 
+Executing VALUES { fn SQRT(6.22) } --   = >2.49<  << 
+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn ACOS(1.34) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ACOS" at line 1, column 13.
+Executing VALUES { fn ASIN(1.21) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ASIN" at line 1, column 13.
+Executing VALUES { fn ATAN(0.34) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ATAN" at line 1, column 13.
+Executing VALUES { fn ATAN2(0.56, 1.2) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ATAN2" at line 1, column 13.
+Executing VALUES { fn CEILING(3.45) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "CEILING" at line 1, column 13.
+Executing VALUES { fn COS(1.2) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "COS" at line 1, column 13.
+Executing VALUES { fn COT(3.4) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "COT" at line 1, column 13.
+Executing VALUES { fn DEGREES(2.1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DEGREES" at line 1, column 13.
+Executing VALUES { fn EXP(2.3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "EXP" at line 1, column 13.
+Executing VALUES { fn FLOOR(3.22) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "FLOOR" at line 1, column 13.
+Executing VALUES { fn LOG(34.1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "LOG" at line 1, column 13.
+Executing VALUES { fn LOG10(18.7) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "LOG10" at line 1, column 13.
+Executing VALUES { fn PI() } -- 
+SQLSTATE(42X01): Syntax error: Encountered "PI" at line 1, column 13.
+Executing VALUES { fn POWER(2, 3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "POWER" at line 1, column 13.
+Executing VALUES { fn RADIANS(54) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "RADIANS" at line 1, column 13.
+Executing VALUES { fn RAND(17) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "RAND" at line 1, column 13.
+Executing VALUES { fn ROUND(345.345, 1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ROUND" at line 1, column 13.
+Executing VALUES { fn SIGN(-34) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "SIGN" at line 1, column 13.
+Executing VALUES { fn SIN(0.32) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "SIN" at line 1, column 13.
+Executing VALUES { fn TAN(0.57) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "TAN" at line 1, column 13.
+Executing VALUES { fn TRUNCATE(345.395, 1) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "TRUNCATE" at line 1, column 13.
+Test escaped string functions - JDBC 3.0 C.2
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn CONCAT('hello', 'there') } --   = >hellothere<  << 
+Executing VALUES { fn LENGTH('four    ') } --   = >4<  << 
+Executing VALUES { fn LCASE('Fernando Alonso') } --   = >fernando alonso<  <<

+Executing VALUES { fn LOCATE('jour', 'Bonjour') } --   = >4<  << 
+Executing VALUES { fn LTRIM('   left trim   ') } --   = >left trim   <  << 
+Executing VALUES { fn RTRIM('  right trim   ') } --   = >  right trim<  << 
+Executing VALUES { fn SUBSTRING('Ruby the Rubicon Jeep', 10, 7) } --   = >Rubicon<
 << 
+Executing VALUES { fn UCASE('Fernando Alonso') } --   = >FERNANDO ALONSO<  <<

+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn ASCII('Yellow') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "ASCII" at line 1, column 13.
+Executing VALUES { fn CHAR(65) } --   = >65         <  << 
+FAIL function works but not declared in list: CHAR
+Executing VALUES { fn DIFFERENCE('Pires', 'Piers') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DIFFERENCE" at line 1, column 13.
+Executing VALUES { fn INSERT('Bill Clinton', 4, 'William') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "INSERT" at line 1, column 13.
+Executing VALUES { fn LEFT('Bonjour', 3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "LEFT" at line 1, column 13.
+Executing VALUES { fn REPEAT('echo', 3) } -- 
+SQLSTATE(42X01): Syntax error: Encountered "REPEAT" at line 1, column 13.
+Executing VALUES { fn REPLACE('to be or not to be', 'be', 'England') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "REPLACE" at line 1, column 13.
+Executing VALUES { fn SOUNDEX('Derby') } -- 
+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 system functions - JDBC 3.0 C.4
+TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn USER() } --   = >APP<  << 
+TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST
+Executing VALUES { fn DATABASE() } -- 
+SQLSTATE(42X01): Syntax error: Encountered "DATABASE" at line 1, column 13.
+Executing VALUES { fn IFNULL('this', 'that') } -- 
+SQLSTATE(42X01): Syntax error: Encountered "IFNULL" at line 1, column 13.
 Test metadataJdbc20 finished

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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -91,9 +91,9 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,SQRT
-getStringFunctions(): LENGTH,LOWER,LTRIM,RTRIM,SUBSTR,SUBSTRING,UPPER
-getSystemFunctions(): CURRENT_USER,getCurrentConnection,runTimeStatistics,SESSION_USER,USER,CURRENT
SCHEMA
+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
 getExtraNameCharacters(): 
 supportsAlterTableWithAddColumn(): 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=348289&r1=348288&r2=348289&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 15:29:01 2005
@@ -22,10 +22,13 @@
 
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
 import java.sql.ResultSetMetaData;
 import java.sql.Statement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.sql.Types;
+import java.util.StringTokenizer;
 
 import org.apache.derby.tools.ij;
 
@@ -108,6 +111,15 @@
 			System.out.println("othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? " + met.othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));
 
 			s.close();
+			
+			System.out.println("Test escaped numeric functions - JDBC 3.0 C.1");
+			testEscapedFunctions(con, NUMERIC_FUNCTIONS, met.getNumericFunctions());
+			
+			System.out.println("Test escaped string functions - JDBC 3.0 C.2");
+			testEscapedFunctions(con, STRING_FUNCTIONS, met.getStringFunctions());
+			
+			System.out.println("Test escaped system functions - JDBC 3.0 C.4");
+			testEscapedFunctions(con, SYSTEM_FUNCTIONS, met.getSystemFunctions());
 
 			con.close();
 
@@ -131,7 +143,13 @@
 			se = se.getNextException();
 		}
 	}
-
+	static private void showSQLExceptions (SQLException se) {
+		while (se != null) {
+			System.out.println("SQLSTATE("+se.getSQLState()+"): " + se.getMessage());
+			se = se.getNextException();
+		}
+	}
+	
 	static void dumpRS(ResultSet s) throws SQLException {
 		ResultSetMetaData rsmd = s.getMetaData ();
 
@@ -162,4 +180,185 @@
 		}
 		s.close();
 	}
+	
+	/*
+	** Escaped function testing
+	*/
+	private static final String[][] NUMERIC_FUNCTIONS =
+	{
+		// Section C.1 JDBC 3.0 spec.
+		{ "ABS", "-25.67" },
+		{ "ACOS", "1.34" },
+		{ "ASIN", "1.21" },
+		{ "ATAN", "0.34" },
+		{ "ATAN2", "0.56", "1.2" },
+		{ "CEILING", "3.45" },
+		{ "COS", "1.2" },
+		{ "COT", "3.4" },
+		{ "DEGREES", "2.1" },
+		{ "EXP", "2.3" },
+		{ "FLOOR", "3.22" },
+		{ "LOG", "34.1" },
+		{ "LOG10", "18.7" },
+		{ "MOD", "124", "7" },
+		{ "PI" },
+		{ "POWER", "2", "3" },
+		{ "RADIANS", "54" },
+		{ "RAND", "17" }, 
+		{ "ROUND", "345.345", "1" }, 
+		{ "SIGN", "-34" },
+		{ "SIN", "0.32" },
+		{ "SQRT", "6.22" },
+		{ "TAN", "0.57", },
+		{ "TRUNCATE", "345.395", "1" }
+	};
+	
+	private static final String[][] STRING_FUNCTIONS =
+	{	
+		// Section C.2 JDBC 3.0 spec.
+		{ "ASCII" , "'Yellow'" },
+		{ "CHAR", "65" },
+		{ "CONCAT", "'hello'", "'there'" },
+		{ "DIFFERENCE", "'Pires'", "'Piers'" },
+		{ "INSERT", "'Bill Clinton'", "4", "'William'" },
+		{ "LCASE", "'Fernando Alonso'" },
+		{ "LEFT", "'Bonjour'", "3" },
+		{ "LENGTH", "'four    '" } ,
+		{ "LOCATE", "'jour'", "'Bonjour'" },
+		{ "LTRIM", "'   left trim   '"},
+		{ "REPEAT", "'echo'", "3" },
+		{ "REPLACE", "'to be or not to be'", "'be'", "'England'" },
+		{ "RTRIM", "'  right trim   '"},
+		{ "SOUNDEX", "'Derby'" },
+		{ "SPACE", "12"},
+		{ "SUBSTRING", "'Ruby the Rubicon Jeep'", "10", "7", },
+		{ "UCASE", "'Fernando Alonso'" }
+		};
+	
+	private static final String[][] SYSTEM_FUNCTIONS =
+	{	
+		// Section C.4 JDBC 3.0 spec.
+		{ "DATABASE" },
+		{ "IFNULL", "'this'", "'that'" },
+		{ "USER"},
+		};	
+	
+
+	/**
+	 * Test escaped functions. Working from the list of escaped functions defined
+	 * by JDBC, compared to the list returned by the driver.
+	 * <OL>
+	 * <LI> See that all functions defined by the driver are in the spec list
+	 * and that they work.
+	 * <LI> See that only functions defined by the spec are in the driver's list.
+	 * <LI> See that any functions defined by the spec that work are in the driver's list.
+	 * </OL>
+	 * FAIL will be printed for any issues.
+	 * @param conn
+	 * @param specList
+	 * @param metaDataList
+	 * @throws SQLException
+	 */
+	private static void testEscapedFunctions(Connection conn, String[][] specList, String metaDataList)
+	throws SQLException
+	{
+		boolean[] seenFunction = new boolean[specList.length];
+		
+		System.out.println("TEST FUNCTIONS DECLARED IN DATABASEMETADATA LIST");
+		StringTokenizer st = new StringTokenizer(metaDataList, ",");
+		while (st.hasMoreTokens())
+		{
+			String function = st.nextToken();
+			
+			// find this function in the list
+			boolean isSpecFunction = false;
+			for (int f = 0; f < specList.length; f++)
+			{
+				String[] specDetails = specList[f];
+				if (function.equals(specDetails[0]))
+				{
+					// Matched spec.
+					if (seenFunction[f])
+						System.out.println("FAIL Function in list twice: " + function);
+					seenFunction[f] = true;
+					isSpecFunction = true;
+					
+					if (!executeEscaped(conn, specDetails))
+						System.out.println("FAIL Function failed to execute "+ function);
+					break;
+				}
+			}
+			
+			if (!isSpecFunction)
+			{
+				System.out.println("FAIL Non-JDBC spec function in list: " + function);
+			}
+		}
+		
+		// Now see if any speced functions are not in the metadata list
+		System.out.println("TEST FUNCTIONS NOT DECLARED IN DATABASEMETADATA LIST");
+		for (int f = 0; f < specList.length; f++)
+		{
+			if (seenFunction[f])
+				continue;
+			String[] specDetails = specList[f];
+			if (executeEscaped(conn, specDetails))
+				System.out.println("FAIL function works but not declared in list: " + specDetails[0]);
+			
+		}
+	}
+	
+	private static boolean executeEscaped(Connection conn, String[] specDetails)
+	{
+		
+		String sql = "VALUES { fn " + specDetails[0] + "(";
+		
+		for (int p = 0; p < specDetails.length - 1; p++)
+		{
+			if (p != 0)
+				sql = sql + ", ";
+			
+			sql = sql + specDetails[p + 1];
+		}
+		
+		sql = sql + ") }";
+		
+		System.out.print("Executing " + sql + " -- ");
+			
+		try {
+			PreparedStatement ps = conn.prepareStatement(sql);
+			ResultSet rs = ps.executeQuery();
+			
+			while (rs.next())
+			{
+				// truncate numbers to avoid multiple master files
+				// with double values.
+				String res = rs.getString(1);
+				
+				switch (rs.getMetaData().getColumnType(1))
+				{
+				case Types.DOUBLE:
+				case Types.REAL:
+				case Types.FLOAT:
+					if (res.length() > 4)
+						res = res.substring(0, 4);
+					break;
+				default:
+					break;
+				}
+				System.out.print("  = >" + res + "< ");
+			}
+			rs.close();
+			ps.close();
+			System.out.println(" << ");
+			return true;
+		} catch (SQLException e) {
+			System.out.println("");
+			showSQLExceptions(e);
+			return false;
+		}
+		
+	}
+	
+	
 }



Mime
View raw message