db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r765087 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/ engine/org/apache/derby/loc/ shared/org/apache/derby/shared/common/reference/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Wed, 15 Apr 2009 08:49:03 GMT
Author: kahatlen
Date: Wed Apr 15 08:49:02 2009
New Revision: 765087

URL: http://svn.apache.org/viewvc?rev=765087&view=rev
Log:
DERBY-3610: Confusing error message when granting execute privilege

Fix contributed by Hiranya Jayathilaka.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java?rev=765087&r1=765086&r2=765087&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java Wed
Apr 15 08:49:02 2009
@@ -164,8 +164,15 @@
                     throw StandardException.newException( ( rd.isFunction ? SQLState.LANG_AMBIGUOUS_FUNCTION_NAME
                                                             : SQLState.LANG_AMBIGUOUS_PROCEDURE_NAME),
                                                           rd.name.getFullTableName());
-                if( list.size() != 1)
-                    throw StandardException.newException(SQLState.LANG_NO_SUCH_METHOD_ALIAS,
rd.name.getFullTableName());
+                if( list.size() != 1) {
+                    if (rd.isFunction) {
+                        throw StandardException.newException(SQLState.LANG_NO_SUCH_FUNCTION,

+                                rd.name.getFullTableName());
+                    } else {
+                        throw StandardException.newException(SQLState.LANG_NO_SUCH_PROCEDURE,

+                                rd.name.getFullTableName());
+                    }
+                }
                 proc = (AliasDescriptor) list.get(0);
             }
             else

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml?rev=765087&r1=765086&r2=765087&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml Wed Apr 15 08:49:02
2009
@@ -2064,10 +2064,22 @@
             </msg>
 
             <msg>
-                <name>42Y03</name>
+                <name>42Y03.S.0</name>
                 <text>'{0}' is not recognized as a function or procedure.</text>
                 <arg>statement</arg>
             </msg>
+            
+            <msg>
+                <name>42Y03.S.1</name>
+                <text>'{0}' is not recognized as a procedure.</text>
+                <arg>statement</arg>
+            </msg>
+            
+            <msg>
+                <name>42Y03.S.2</name>
+                <text>'{0}' is not recognized as a function.</text>
+                <arg>statement</arg>
+            </msg>
 
             <msg>
                 <name>42Y04</name>

Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=765087&r1=765086&r2=765087&view=diff
==============================================================================
--- db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
(original)
+++ db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
Wed Apr 15 08:49:02 2009
@@ -911,7 +911,9 @@
 	String LANG_INVALID_USER_AGGREGATE_DEFINITION2                     = "42Y00";
 	String LANG_INVALID_CHECK_CONSTRAINT                               = "42Y01";
 	// String LANG_NO_ALTER_TABLE_COMPRESS_ON_TARGET_TABLE                = "42Y02";
-	String LANG_NO_SUCH_METHOD_ALIAS                                   = "42Y03";
+	String LANG_NO_SUCH_METHOD_ALIAS                                   = "42Y03.S.0";
+	String LANG_NO_SUCH_PROCEDURE                                      = "42Y03.S.1";
+	String LANG_NO_SUCH_FUNCTION                                       = "42Y03.S.2";
 	String LANG_INVALID_FULL_STATIC_METHOD_NAME                        = "42Y04";
 	String LANG_NO_SUCH_FOREIGN_KEY                                    = "42Y05";
 	//String LANG_METHOD_ALIAS_NOT_FOUND                                 = "42Y06";

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeTest.java?rev=765087&r1=765086&r2=765087&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeTest.java
Wed Apr 15 08:49:02 2009
@@ -624,6 +624,7 @@
             grant("execute", "function s1", "nosuch", users[1]);
     	} catch (SQLException e) {
         	assertSQLState("42Y03", e);
+            assertEquals("'S1.NOSUCH' is not recognized as a function.", e.getMessage());
         }
     }
     
@@ -632,6 +633,7 @@
             grant("execute", "function s1", "p1", users[1]);
     	} catch (SQLException e) {
         	assertSQLState("42Y03", e);
+            assertEquals("'S1.P1' is not recognized as a function.", e.getMessage());
         }
     }
     
@@ -648,6 +650,7 @@
             grant("execute", "procedure s1", "nosuch", users[1]);
     	} catch (SQLException e) {
         	assertSQLState("42Y03", e);
+            assertEquals("'S1.NOSUCH' is not recognized as a procedure.", e.getMessage());
         }
     }
     
@@ -656,6 +659,7 @@
             grant("execute", "procedure s1", "f2", users[1]);
     	} catch (SQLException e) {
         	assertSQLState("42Y03", e);
+            assertEquals("'S1.F2' is not recognized as a procedure.", e.getMessage());
         }
     }
     



Mime
View raw message