db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From banda...@apache.org
Subject svn commit: r427458 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Tue, 01 Aug 2006 06:16:47 GMT
Author: bandaram
Date: Mon Jul 31 23:16:47 2006
New Revision: 427458

URL: http://svn.apache.org/viewvc?rev=427458&view=rev
Log:
DERBY-1608: Recognize newly added SYSFUC routines as system builtin functions. Builtin functions
don't need authorization checks and have execute permission to PUBLIC by default.

Submitted by Satheesh Bandaram (satheesh@gmail.com)

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevokeDDL.sql

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java?rev=427458&r1=427457&r2=427458&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
Mon Jul 31 23:16:47 2006
@@ -777,6 +777,10 @@
 		if( requiredRoutinePrivileges == null || routine == null)
 			return;
 
+		// Ignore SYSFUN routines for permission scheme
+		if (routine.getSchemaUUID().toString().equals(SchemaDescriptor.SYSFUN_SCHEMA_UUID))
+			return;
+
  		if (requiredRoutinePrivileges.get(routine.getUUID()) == null)
  			requiredRoutinePrivileges.put(routine.getUUID(), ReuseFactory.getInteger(1));
 	}

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out?rev=427458&r1=427457&r2=427458&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out
Mon Jul 31 23:16:47 2006
@@ -1579,4 +1579,71 @@
 TABLEPERMSID                        |GRANTEE                                            
                                                                            |GRANTOR     
                                                                                         
                         |TABLEID                             |&|&|&|&|&|&
 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 0 rows selected
+ij(MAMTA1)> -- DERBY-1608: Recognize new SYSFUC routines as system builtin routines
+-- Builtin functions don't need any permission checking. They are executable by all
+VALUES { fn ACOS(0.0707) };
+1                     
+----------------------
+1.5000372950430991    
+1 row selected
+ij(MAMTA1)> VALUES ACOS(0.0707);
+1                     
+----------------------
+1.5000372950430991    
+1 row selected
+ij(MAMTA1)> VALUES PI();
+1                     
+----------------------
+3.141592653589793     
+1 row selected
+ij(MAMTA1)> create table SYSFUN_MATH_TEST (d double);
+0 rows inserted/updated/deleted
+ij(MAMTA1)> insert into SYSFUN_MATH_TEST values null;
+1 row inserted/updated/deleted
+ij(MAMTA1)> insert into SYSFUN_MATH_TEST values 0.67;
+1 row inserted/updated/deleted
+ij(MAMTA1)> insert into SYSFUN_MATH_TEST values 1.34;
+1 row inserted/updated/deleted
+ij(MAMTA1)> select cast (ATAN(d) as DECIMAL(6,3)) AS ATAN FROM SYSFUN_MATH_TEST;
+ATAN    
+--------
+NULL    
+0.590   
+0.929   
+3 rows selected
+ij(MAMTA1)> select cast (COS(d) as DECIMAL(6,3)) AS COS FROM SYSFUN_MATH_TEST;
+COS     
+--------
+NULL    
+0.783   
+0.228   
+3 rows selected
+ij(MAMTA1)> select cast (SIN(d) as DECIMAL(6,3)) AS SIN FROM SYSFUN_MATH_TEST;
+SIN     
+--------
+NULL    
+0.620   
+0.973   
+3 rows selected
+ij(MAMTA1)> select cast (TAN(d) as DECIMAL(6,3)) AS TAN FROM SYSFUN_MATH_TEST;
+TAN     
+--------
+NULL    
+0.792   
+4.255   
+3 rows selected
+ij(MAMTA1)> select cast (DEGREES(d) as DECIMAL(6,3)) AS DEGREES FROM SYSFUN_MATH_TEST;
+DEGREES 
+--------
+NULL    
+38.388  
+76.776  
+3 rows selected
+ij(MAMTA1)> select cast (RADIANS(d) as DECIMAL(6,3)) AS RADIANS FROM SYSFUN_MATH_TEST;
+RADIANS 
+--------
+NULL    
+0.011   
+0.023   
+3 rows selected
 ij(MAMTA1)> 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevokeDDL.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevokeDDL.sql?rev=427458&r1=427457&r2=427458&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevokeDDL.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevokeDDL.sql
Mon Jul 31 23:16:47 2006
@@ -989,3 +989,26 @@
 
 select * from sys.systableperms where grantee='SAMMY';
 
+
+-- DERBY-1608: Recognize new SYSFUC routines as system builtin routines
+-- Builtin functions don't need any permission checking. They are executable by all
+
+VALUES { fn ACOS(0.0707) }; 
+
+VALUES ACOS(0.0707); 
+
+VALUES PI();
+
+create table SYSFUN_MATH_TEST (d double);
+insert into SYSFUN_MATH_TEST values null;
+insert into SYSFUN_MATH_TEST values 0.67;
+insert into SYSFUN_MATH_TEST values 1.34;
+
+select cast (ATAN(d) as DECIMAL(6,3)) AS ATAN FROM SYSFUN_MATH_TEST;
+
+select cast (COS(d) as DECIMAL(6,3)) AS COS FROM SYSFUN_MATH_TEST;
+select cast (SIN(d) as DECIMAL(6,3)) AS SIN FROM SYSFUN_MATH_TEST;
+select cast (TAN(d) as DECIMAL(6,3)) AS TAN FROM SYSFUN_MATH_TEST;
+
+select cast (DEGREES(d) as DECIMAL(6,3)) AS DEGREES FROM SYSFUN_MATH_TEST;
+select cast (RADIANS(d) as DECIMAL(6,3)) AS RADIANS FROM SYSFUN_MATH_TEST;



Mime
View raw message