db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r374471 - in /db/derby/code/trunk/java: engine/org/apache/derby/catalog/ engine/org/apache/derby/impl/jdbc/ engine/org/apache/derby/impl/sql/catalog/ engine/org/apache/derby/impl/sql/compile/ testing/org/apache/derbyTesting/functionTests/ma...
Date Thu, 02 Feb 2006 19:35:02 GMT
Author: djd
Date: Thu Feb  2 11:34:54 2006
New Revision: 374471

URL: http://svn.apache.org/viewcvs?rev=374471&view=rev
Log:
DERBY-475 DEBRY-592 Expand the builtin function table to handle zero parameter
functions and add the functions PI and LOG10 as builting and JDBC escaped functions.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
    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/odbc_metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/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/odbc_metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/functions.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/odbc_metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/functions.sql

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java?rev=374471&r1=374470&r2=374471&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java Thu Feb
 2 11:34:54 2006
@@ -54,6 +54,10 @@
 	These procedures are built-in to the SYSIBM schema which match the DB2 SYSIBM procedures.
 	Currently information on those can be found at url: 
 	ftp://ftp.software.ibm.com/ps/products/db2/info/vr8/pdf/letter/db2l2e80.pdf
+	
+	<P>
+	Also used for builtin-routines, such as SYSFUN functions, when direct calls
+	into Java libraries cannot be made.
 */
 public class SystemProcedures  {
 
@@ -1176,4 +1180,33 @@
 		ps.close();
 	}
 	
+	/**
+	 * Method to return the constant PI.
+	 * SYSFUN.PI().
+	 * @return PI
+	 */
+	public static double PI()
+	{
+		return StrictMath.PI;
+	}
+	
+	/**
+	 * Constant for natural log(10).
+	 */
+	private static final double LOG10 = StrictMath.log(10.0d);
+	
+	/**
+	 * Base 10 log function. SYSFUN.LOG10
+	 * Calculated by
+	 * <code>
+	 * log(value) / log(10)
+	 * </code>
+	 * where log is the natural log.
+	 * @param value
+	 * @return
+	 */
+	public static double LOG10(double value)
+	{
+		return StrictMath.log(value) / LOG10;
+	}
 }

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=374471&r1=374470&r2=374471&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
Thu Feb  2 11:34:54 2006
@@ -426,7 +426,7 @@
      * @return the list
      */
 	public String getNumericFunctions() {
-		return "ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,MOD,RADIANS,SIN,SQRT,TAN";
+		return "ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,LOG10,MOD,PI,RADIANS,SIN,SQRT,TAN";
 	}
 
     /**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=374471&r1=374470&r2=374471&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
Thu Feb  2 11:34:54 2006
@@ -190,14 +190,32 @@
 	
 	/**
 	* SYSFUN functions. Table of functions that automatically appear
-	* in the SYSFUN schema. This simple table assumes a single parameter
+	* in the SYSFUN schema. These functions are resolved to directly
+	* if no schema name is given, e.g.
+	* 
+	* <code>
+	* SELECT COS(angle) FROM ROOM_WALLS
+	* </code>
+	* 
+	* Adding a function here is suitable when the function defintion
+	* can have a single return type and fixed parameter types.
+	* 
+	* Functions that need to have a return type based upon the
+	* input type(s) are not supported here. Typically those are
+	* added into the parser and methods added into the DataValueDescriptor interface.
+	* Examples are character based functions whose return type
+	* length is based upon the passed in type, e.g. passed a CHAR(10)
+	* returns a CHAR(10).
+	* 
+	* 
+	* This simple table assumes zero or a single parameter
 	* and RETURNS NULL ON NULL INPUT. The scheme could be expanded
 	* to handle other function options such as other parameters if needed.
 	*[0] = FUNCTION name
 	*[1] = RETURNS type
 	*[2] = Java class
 	*[3] = method name and signature
-	*[4] = parameter type (single parameter)
+	*[4] = parameter type (single parameter) or null for no parameters.
 	*
 	*/
 	private static final String[][] SYSFUN_FUNCTIONS = {
@@ -207,10 +225,12 @@
 			{"COS", "DOUBLE", "java.lang.StrictMath", "cos(double)", "DOUBLE"},
 			{"SIN", "DOUBLE", "java.lang.StrictMath", "sin(double)", "DOUBLE"},
 			{"TAN", "DOUBLE", "java.lang.StrictMath", "tan(double)", "DOUBLE"},
+			{"PI", "DOUBLE", "org.apache.derby.catalog.SystemProcedures", "PI()", null},
 			{"DEGREES", "DOUBLE", "java.lang.StrictMath", "toDegrees(double)", "DOUBLE"},
 			{"RADIANS", "DOUBLE", "java.lang.StrictMath", "toRadians(double)", "DOUBLE"},
 			{"LN", "DOUBLE", "java.lang.StrictMath", "log(double)", "DOUBLE"},
 			{"LOG", "DOUBLE", "java.lang.StrictMath", "log(double)", "DOUBLE"}, // Same as LN
+			{"LOG10", "DOUBLE", "org.apache.derby.catalog.SystemProcedures", "LOG10(double)", "DOUBLE"},
 			{"EXP", "DOUBLE", "java.lang.StrictMath", "exp(double)", "DOUBLE"},
 			{"CEIL", "DOUBLE", "java.lang.StrictMath", "ceil(double)", "DOUBLE"},
 			{"CEILING", "DOUBLE", "java.lang.StrictMath", "ceil(double)", "DOUBLE"}, // Same as CEIL
@@ -5714,15 +5734,34 @@
 					TypeDescriptor rt =
 						DataTypeDescriptor.getBuiltInDataTypeDescriptor(details[1]);
 
-					// details[4] - single argument type
-					TypeDescriptor[] pt = new TypeDescriptor[1];
-					pt[0] =
-						DataTypeDescriptor.getBuiltInDataTypeDescriptor(details[4]);
+					// details[4] - zero or single argument type
+					String paramType = details[4];
+					TypeDescriptor[] pt;
+					String[] paramNames;
+					int[] paramModes;
+					int paramCount;
+					if (paramType != null)
+					{			
+						paramNames = DataDictionaryImpl.SYSFUN_PNAME;
+						paramCount = 1;
+						paramModes = DataDictionaryImpl.SYSFUN_PMODE;
+						pt = new TypeDescriptor[1];
+						pt[0] =
+							DataTypeDescriptor.getBuiltInDataTypeDescriptor(paramType);
+					}
+					else
+					{
+						// no parameters
+						paramNames = null;
+						pt = null;
+						paramCount = 0;
+						paramModes = null;
+					}
 					
 					// details[3] = java method
 					RoutineAliasInfo ai = new RoutineAliasInfo(details[3],
-							1, DataDictionaryImpl.SYSFUN_PNAME,
-							pt, DataDictionaryImpl.SYSFUN_PMODE, 0,
+							paramCount, paramNames,
+							pt, paramModes, 0,
 							RoutineAliasInfo.PS_JAVA, RoutineAliasInfo.NO_SQL,
 							false, rt);
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj?rev=374471&r1=374470&r2=374471&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj Thu Feb
 2 11:34:54 2006
@@ -998,8 +998,8 @@
        a function in the SYSFUN schema.
     */
 	private static final String[] ESCAPED_SYSFUN_FUNCTIONS =
-        {"ACOS", "ASIN", "ATAN", "COS", "SIN", "TAN",
-         "DEGREES", "RADIANS", "EXP", "LOG", "CEILING", "FLOOR" };
+        {"ACOS", "ASIN", "ATAN", "COS", "SIN", "TAN", "PI",
+         "DEGREES", "RADIANS", "EXP", "LOG", "LOG10", "CEILING", "FLOOR" };
        
     /**
        Convert a JDBC escaped function name to a function

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=374471&r1=374470&r2=374471&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
Thu Feb  2 11:34:54 2006
@@ -75,7 +75,7 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,MOD,RADIANS,SIN,SQRT,TAN
+getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,LOG10,MOD,PI,RADIANS,SIN,SQRT,TAN
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
 getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
@@ -467,7 +467,9 @@
 Executing VALUES { fn EXP(2.3) } --   = >9.97<  << 
 Executing VALUES { fn FLOOR(3.22) } --   = >3.0<  << 
 Executing VALUES { fn LOG(34.1) } --   = >3.52<  << 
+Executing VALUES { fn LOG10(18.7) } --   = >1.27<  << 
 Executing VALUES { fn MOD(124, 7) } --   = >5<  << 
+Executing VALUES { fn PI() } --   = >3.14<  << 
 Executing VALUES { fn RADIANS(54) } --   = >0.94<  << 
 Executing VALUES { fn SIN(0.32) } --   = >0.31<  << 
 Executing VALUES { fn SQRT(6.22) } --   = >2.49<  << 
@@ -477,10 +479,6 @@
 SQLSTATE(42X01): Syntax error: Encountered "ATAN2" 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 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 RAND(17) } -- 

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=374471&r1=374470&r2=374471&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
Thu Feb  2 11:34:54 2006
@@ -105,7 +105,7 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,MOD,RADIANS,SIN,SQRT,TAN
+getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,LOG10,MOD,PI,RADIANS,SIN,SQRT,TAN
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
 getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
@@ -498,7 +498,9 @@
 Executing VALUES { fn EXP(2.3) } --   = >9.97<  << 
 Executing VALUES { fn FLOOR(3.22) } --   = >3.0<  << 
 Executing VALUES { fn LOG(34.1) } --   = >3.52<  << 
+Executing VALUES { fn LOG10(18.7) } --   = >1.27<  << 
 Executing VALUES { fn MOD(124, 7) } --   = >5<  << 
+Executing VALUES { fn PI() } --   = >3.14<  << 
 Executing VALUES { fn RADIANS(54) } --   = >0.94<  << 
 Executing VALUES { fn SIN(0.32) } --   = >0.31<  << 
 Executing VALUES { fn SQRT(6.22) } --   = >2.49<  << 
@@ -508,10 +510,6 @@
 SQLSTATE(42X01): Syntax error: Encountered "ATAN2" 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 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 RAND(17) } -- 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/metadata.out?rev=374471&r1=374470&r2=374471&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/metadata.out
Thu Feb  2 11:34:54 2006
@@ -75,7 +75,7 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,MOD,RADIANS,SIN,SQRT,TAN
+getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,LOG10,MOD,PI,RADIANS,SIN,SQRT,TAN
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
 getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
@@ -467,7 +467,9 @@
 Executing VALUES { fn EXP(2.3) } --   = >9.97<  << 
 Executing VALUES { fn FLOOR(3.22) } --   = >3.0<  << 
 Executing VALUES { fn LOG(34.1) } --   = >3.52<  << 
+Executing VALUES { fn LOG10(18.7) } --   = >1.27<  << 
 Executing VALUES { fn MOD(124, 7) } --   = >5<  << 
+Executing VALUES { fn PI() } --   = >3.14<  << 
 Executing VALUES { fn RADIANS(54) } --   = >0.94<  << 
 Executing VALUES { fn SIN(0.32) } --   = >0.31<  << 
 Executing VALUES { fn SQRT(6.22) } --   = >2.49<  << 
@@ -477,10 +479,6 @@
 SQLSTATE(42X01): Syntax error: Encountered "ATAN2" 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 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 RAND(17) } -- 

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=374471&r1=374470&r2=374471&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
Thu Feb  2 11:34:54 2006
@@ -75,7 +75,7 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,MOD,RADIANS,SIN,SQRT,TAN
+getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,LOG10,MOD,PI,RADIANS,SIN,SQRT,TAN
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
 getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
@@ -467,7 +467,9 @@
 Executing VALUES { fn EXP(2.3) } --   = >9.97<  << 
 Executing VALUES { fn FLOOR(3.22) } --   = >3.0<  << 
 Executing VALUES { fn LOG(34.1) } --   = >3.52<  << 
+Executing VALUES { fn LOG10(18.7) } --   = >1.27<  << 
 Executing VALUES { fn MOD(124, 7) } --   = >5<  << 
+Executing VALUES { fn PI() } --   = >3.14<  << 
 Executing VALUES { fn RADIANS(54) } --   = >0.94<  << 
 Executing VALUES { fn SIN(0.32) } --   = >0.31<  << 
 Executing VALUES { fn SQRT(6.22) } --   = >2.49<  << 
@@ -477,10 +479,6 @@
 SQLSTATE(42X01): Syntax error: Encountered "ATAN2" 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 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 RAND(17) } -- 

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=374471&r1=374470&r2=374471&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
Thu Feb  2 11:34:54 2006
@@ -105,7 +105,7 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,MOD,RADIANS,SIN,SQRT,TAN
+getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,LOG10,MOD,PI,RADIANS,SIN,SQRT,TAN
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
 getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
@@ -498,7 +498,9 @@
 Executing VALUES { fn EXP(2.3) } --   = >9.97<  << 
 Executing VALUES { fn FLOOR(3.22) } --   = >3.0<  << 
 Executing VALUES { fn LOG(34.1) } --   = >3.52<  << 
+Executing VALUES { fn LOG10(18.7) } --   = >1.27<  << 
 Executing VALUES { fn MOD(124, 7) } --   = >5<  << 
+Executing VALUES { fn PI() } --   = >3.14<  << 
 Executing VALUES { fn RADIANS(54) } --   = >0.94<  << 
 Executing VALUES { fn SIN(0.32) } --   = >0.31<  << 
 Executing VALUES { fn SQRT(6.22) } --   = >2.49<  << 
@@ -508,10 +510,6 @@
 SQLSTATE(42X01): Syntax error: Encountered "ATAN2" 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 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 RAND(17) } -- 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/functions.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/functions.out?rev=374471&r1=374470&r2=374471&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/functions.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/functions.out
Thu Feb  2 11:34:54 2006
@@ -583,7 +583,11 @@
 1 row inserted/updated/deleted
 ij> -- cast result to DECIMAL to reduce possible diffs
 -- with different vms and double values.;
-select cast (ACOS(d) as DECIMAL(6,3)) AS ACOS FROM SYSFUN_MATH_TEST;
+VALUES PI();
+1                     
+----------------------
+3.141592653589793     
+ij> select cast (ACOS(d) as DECIMAL(6,3)) AS ACOS FROM SYSFUN_MATH_TEST;
 ACOS     
 ---------
 NULL     
@@ -645,6 +649,12 @@
 NULL     
 1.954    
 3.819    
+ij> select cast (LOG10(d) as DECIMAL(6,3)) AS LOG10 FROM SYSFUN_MATH_TEST;
+LOG10    
+---------
+NULL     
+-0.173   
+0.127    
 ij> select cast (CEIL(d) as DECIMAL(6,3)) AS CEIL FROM SYSFUN_MATH_TEST;
 CEIL     
 ---------

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=374471&r1=374470&r2=374471&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
Thu Feb  2 11:34:54 2006
@@ -75,7 +75,7 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,MOD,RADIANS,SIN,SQRT,TAN
+getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,LOG10,MOD,PI,RADIANS,SIN,SQRT,TAN
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
 getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
@@ -467,7 +467,9 @@
 Executing VALUES { fn EXP(2.3) } --   = >9.97<  << 
 Executing VALUES { fn FLOOR(3.22) } --   = >3.0<  << 
 Executing VALUES { fn LOG(34.1) } --   = >3.52<  << 
+Executing VALUES { fn LOG10(18.7) } --   = >1.27<  << 
 Executing VALUES { fn MOD(124, 7) } --   = >5<  << 
+Executing VALUES { fn PI() } --   = >3.14<  << 
 Executing VALUES { fn RADIANS(54) } --   = >0.94<  << 
 Executing VALUES { fn SIN(0.32) } --   = >0.31<  << 
 Executing VALUES { fn SQRT(6.22) } --   = >2.49<  << 
@@ -477,10 +479,6 @@
 SQLSTATE(42X01): Syntax error: Encountered "ATAN2" 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 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 RAND(17) } -- 

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=374471&r1=374470&r2=374471&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
Thu Feb  2 11:34:54 2006
@@ -105,7 +105,7 @@
 storesLowerCaseQuotedIdentifiers(): false
 storesMixedCaseQuotedIdentifiers(): true
 getIdentifierQuoteString(): "
-getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,MOD,RADIANS,SIN,SQRT,TAN
+getNumericFunctions(): ABS,ACOS,ASIN,ATAN,CEILING,COS,DEGREES,EXP,FLOOR,LOG,LOG10,MOD,PI,RADIANS,SIN,SQRT,TAN
 getStringFunctions(): CONCAT,LENGTH,LCASE,LOCATE,LTRIM,RTRIM,SUBSTRING,UCASE
 getSystemFunctions(): USER
 getTimeDateFunctions(): CURDATE,CURTIME,HOUR,MINUTE,MONTH,SECOND,TIMESTAMPADD,TIMESTAMPDIFF,YEAR
@@ -498,7 +498,9 @@
 Executing VALUES { fn EXP(2.3) } --   = >9.97<  << 
 Executing VALUES { fn FLOOR(3.22) } --   = >3.0<  << 
 Executing VALUES { fn LOG(34.1) } --   = >3.52<  << 
+Executing VALUES { fn LOG10(18.7) } --   = >1.27<  << 
 Executing VALUES { fn MOD(124, 7) } --   = >5<  << 
+Executing VALUES { fn PI() } --   = >3.14<  << 
 Executing VALUES { fn RADIANS(54) } --   = >0.94<  << 
 Executing VALUES { fn SIN(0.32) } --   = >0.31<  << 
 Executing VALUES { fn SQRT(6.22) } --   = >2.49<  << 
@@ -508,10 +510,6 @@
 SQLSTATE(42X01): Syntax error: Encountered "ATAN2" 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 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 RAND(17) } -- 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/functions.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/functions.sql?rev=374471&r1=374470&r2=374471&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/functions.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/functions.sql
Thu Feb  2 11:34:54 2006
@@ -274,6 +274,8 @@
 -- cast result to DECIMAL to reduce possible diffs
 -- with different vms and double values.;
 
+VALUES PI();
+
 select cast (ACOS(d) as DECIMAL(6,3)) AS ACOS FROM SYSFUN_MATH_TEST;
 select cast (ASIN(d) as DECIMAL(6,3)) AS ASIN FROM SYSFUN_MATH_TEST;
 select cast (ATAN(d) as DECIMAL(6,3)) AS ATAN FROM SYSFUN_MATH_TEST;
@@ -289,6 +291,8 @@
        cast (LOG(d) as DECIMAL(6,3)) AS LOG
                        FROM SYSFUN_MATH_TEST;
 select cast (EXP(d) as DECIMAL(6,3)) AS EXP FROM SYSFUN_MATH_TEST;
+
+select cast (LOG10(d) as DECIMAL(6,3)) AS LOG10 FROM SYSFUN_MATH_TEST;
 
 select cast (CEIL(d) as DECIMAL(6,3)) AS CEIL FROM SYSFUN_MATH_TEST;
 select cast (CEILING(d) as DECIMAL(6,3)) AS CEILING FROM SYSFUN_MATH_TEST;



Mime
View raw message