db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From banda...@apache.org
Subject svn commit: r356133 [3/6] - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/db/ engine/org/apache/derby/iapi/reference/ engine/org/apache/derby/iapi/sql/compile/ engine/org/apache/derby/iapi/sql/conn/ engine/org/apache/derby/iapi/sql/diction...
Date Mon, 12 Dec 2005 03:58:19 GMT
Added: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java?rev=356133&view=auto
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java (added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java Sun Dec 11 19:57:33 2005
@@ -0,0 +1,215 @@
+/*
+
+   Derby - Class org.apache.derby.impl.sql.compile.PrivilegeNode
+
+   Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package	org.apache.derby.impl.sql.compile;
+
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.depend.Provider;
+import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;
+import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
+import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;
+import org.apache.derby.catalog.types.RoutineAliasInfo;
+import org.apache.derby.catalog.AliasInfo;
+import org.apache.derby.iapi.reference.SQLState;
+import org.apache.derby.impl.sql.execute.PrivilegeInfo;
+import org.apache.derby.catalog.TypeDescriptor;
+
+import java.util.HashMap;
+
+/**
+ * This node represents a set of privileges that are granted or revoked on one object.
+ */
+public class PrivilegeNode extends QueryTreeNode
+{
+    // Privilege object type
+    public static final int TABLE_PRIVILEGES = 0;
+    public static final int ROUTINE_PRIVILEGES = 1;
+
+    private int objectType;
+    private Object objectOfPrivilege;
+    private TablePrivilegesNode specificPrivileges; // Null for routines
+
+    /**
+     * initialize a PrivilegesNode
+     *
+     * @param objectType (an Integer)
+     * @param objectOfPrivilege (a TableName or RoutineDesignator)
+     * @param specificPrivileges null for routines
+     */
+    public void init( Object objectType, Object objectOfPrivilege, Object specificPrivileges)
+    {
+        this.objectType = ((Integer) objectType).intValue();
+        this.objectOfPrivilege = objectOfPrivilege;
+        this.specificPrivileges = (TablePrivilegesNode) specificPrivileges;
+        if( SanityManager.DEBUG)
+        {
+            SanityManager.ASSERT( objectOfPrivilege != null,
+                                  "null privilge object");
+            switch( this.objectType)
+            {
+            case TABLE_PRIVILEGES:
+                SanityManager.ASSERT( objectOfPrivilege instanceof TableName,
+                                      "incorrect name type, " + objectOfPrivilege.getClass().getName()
+                                      + ", used with table privilege");
+                SanityManager.ASSERT( specificPrivileges != null,
+                                      "null specific privileges used with table privilege");
+                break;
+
+            case ROUTINE_PRIVILEGES:
+                SanityManager.ASSERT( objectOfPrivilege instanceof RoutineDesignator,
+                                      "incorrect name type, " + objectOfPrivilege.getClass().getName()
+                                      + ", used with table privilege");
+                SanityManager.ASSERT( specificPrivileges == null,
+                                      "non-null specific privileges used with execute privilege");
+                break;
+
+            default:
+                SanityManager.THROWASSERT( "Invalid privilege objectType: " + this.objectType);
+            }
+        }
+    } // end of init
+
+    /**
+     * Bind this GrantNode. Resolve all table, column, and routine references. Register
+     * a dependency on the object of the privilege if it has not already been done
+     *
+     * @dependencies The list of privilege objects that this statement has already seen.
+     *               If the object of this privilege is not in the list then this statement is registered
+     *               as dependent on the object.
+     *
+     * @return the bound node
+     *
+     * @exception StandardException	Standard error policy.
+     */
+	public QueryTreeNode bind( HashMap dependencies ) throws StandardException
+	{
+        Provider dependencyProvider = null;
+        SchemaDescriptor sd = null;
+        
+        switch( objectType)
+        {
+        case TABLE_PRIVILEGES:
+            TableName tableName = (TableName) objectOfPrivilege;
+            sd = getSchemaDescriptor( tableName.getSchemaName(), true);
+            TableDescriptor td = getTableDescriptor( tableName.getTableName(), sd);
+            if( td == null)
+                throw StandardException.newException( SQLState.LANG_TABLE_NOT_FOUND, tableName);
+
+			// Don't allow authorization on SESSION schema tables. Causes confusion if
+			// a temporary table is created later with same name.
+			if (isSessionSchema(sd.getSchemaName()))
+				throw StandardException.newException(SQLState.LANG_OPERATION_NOT_ALLOWED_ON_SESSION_SCHEMA_TABLES);
+
+            specificPrivileges.bind( td);
+            dependencyProvider = td;
+            break;
+
+        case ROUTINE_PRIVILEGES:
+            RoutineDesignator rd = (RoutineDesignator) objectOfPrivilege;
+            sd = getSchemaDescriptor( rd.name.getSchemaName(), true);
+
+            AliasDescriptor proc = null;
+            RoutineAliasInfo routineInfo = null;
+            java.util.List list = getDataDictionary().getRoutineList(
+                sd.getUUID().toString(), rd.name.getTableName(),
+                rd.isFunction ? AliasInfo.ALIAS_NAME_SPACE_FUNCTION_AS_CHAR : AliasInfo.ALIAS_NAME_SPACE_PROCEDURE_AS_CHAR
+                );
+
+            if( rd.paramTypeList == null)
+            {
+                // No signature was specified. Make sure that there is exactly one routine with that name.
+                if( list.size() > 1)
+                    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());
+                proc = (AliasDescriptor) list.get(0);
+            }
+            else
+            {
+                // The full signature was specified
+                boolean found = false;
+                for (int i = list.size() - 1; (!found) && i >= 0; i--)
+                {
+                    proc = (AliasDescriptor) list.get(i);
+
+                    routineInfo = (RoutineAliasInfo) proc.getAliasInfo();
+                    int parameterCount = routineInfo.getParameterCount();
+                    if (parameterCount != rd.paramTypeList.size())
+                        continue;
+                    TypeDescriptor[] parameterTypes = routineInfo.getParameterTypes();
+                    found = true;
+                    for( int parmIdx = 0; parmIdx < parameterCount; parmIdx++)
+                    {
+                        if( ! parameterTypes[parmIdx].equals( rd.paramTypeList.get( parmIdx)))
+                        {
+                            found = false;
+                            break;
+                        }
+                    }
+                }
+                if( ! found)
+                {
+                    // reconstruct the signature for the error message
+                    StringBuffer sb = new StringBuffer( rd.name.getFullTableName());
+                    sb.append( "(");
+                    for( int i = 0; i < rd.paramTypeList.size(); i++)
+                    {
+                        if( i > 0)
+                            sb.append(",");
+                        sb.append( rd.paramTypeList.get(i).toString());
+                    }
+                    throw StandardException.newException(SQLState.LANG_NO_SUCH_METHOD_ALIAS, sb.toString());
+                }
+            }
+            rd.setAliasDescriptor( proc);
+            dependencyProvider = proc;
+            break;
+        }
+        if( dependencyProvider != null)
+        {
+            if( dependencies.get( dependencyProvider) == null)
+            {
+                getCompilerContext().createDependency( dependencyProvider);
+                dependencies.put( dependencyProvider, dependencyProvider);
+            }
+        }
+        return this;
+    } // end of bind
+
+    /**
+     * @return PrivilegeInfo for this node
+     */
+    PrivilegeInfo makePrivilegeInfo()
+    {
+        switch( objectType)
+        {
+        case TABLE_PRIVILEGES:
+            return specificPrivileges.makePrivilegeInfo();
+
+        case ROUTINE_PRIVILEGES:
+            return ((RoutineDesignator) objectOfPrivilege).makePrivilegeInfo();
+        }
+        return null;
+    }
+}

Propchange: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java?rev=356133&r1=356132&r2=356133&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java Sun Dec 11 19:57:33 2005
@@ -595,46 +595,72 @@
 	}
 
 	/**
-	 * Bind the result columns by their names.  This is useful for update
+	 * Bind the result columns by their names.  This is useful for GRANT and REVOKE statements
+     * like "GRANT SELECT ON t(c1,c1,c3) TO george", where the user specified a column list.
+	 * This method does not check for duplicate column names.
+	 *
+	 * @param tableDescriptor	The descriptor for the table
+	 *
+	 * @return	Nothing
+	 *
+	 * @exception StandardException		Thrown on error
+	 */
+	public void bindResultColumnsByName(TableDescriptor targetTableDescriptor)
+					throws StandardException
+	{
+		int			size = size();
+
+		for (int index = 0; index < size; index++)
+		{
+			ResultColumn rc = (ResultColumn) elementAt(index);
+
+			rc.bindResultColumnByName(
+						targetTableDescriptor,
+						index + 1
+					);
+		}
+	} // end of bindResultColumnsByName( TableDescriptor)
+
+	/**
+	 * Bind the result columns by their names.  This is useful for update, grant, and revoke
 	 * statements, and for INSERT statements like "insert into t (a, b, c)
 	 * values (1, 2, 3)" where the user specified a column list.
-	 * Also, verify that the result column list does not contain any duplicates.
+	 * If the statment is an insert or update verify that the result column list does not contain any duplicates.
 	 * NOTE: We pass the ResultColumns position in the ResultColumnList so
 	 * that the VirtualColumnId gets set.
 	 *
 	 * @param tableDescriptor	The descriptor for the table being
 	 *				updated or inserted into
-	 * @param statement			DMLStatementNode containing this list
+	 * @param statement			DMLStatementNode containing this list, null if no duplicate checking is to be done
 	 *
-	 * @return	Nothing
+	 * @return A FormatableBitSet representing the set of columns with respect to the table
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	public void bindResultColumnsByName(TableDescriptor targetTableDescriptor,
-						DMLStatementNode statement)
+	public FormatableBitSet bindResultColumnsByName(TableDescriptor targetTableDescriptor,
+                                                    DMLStatementNode statement)
 					throws StandardException
 	{
 		int			size = size();
-		Hashtable	ht = new Hashtable(size + 2, (float) .999);
+		FormatableBitSet columnBitSet = new FormatableBitSet( targetTableDescriptor.getNumberOfColumns());
 
 		for (int index = 0; index < size; index++)
 		{
 			ResultColumn rc = (ResultColumn) elementAt(index);
 
-			/* Verify that this column's name is unique within the list */
-			String colName = rc.getName();
-
-			Object object = ht.put(colName, colName);
+			rc.bindResultColumnByName(
+						targetTableDescriptor,
+						index + 1
+					);
+            int colIdx = rc.getColumnPosition() - 1;
+            if( SanityManager.DEBUG)
+                SanityManager.ASSERT( colIdx >= 0 && colIdx < targetTableDescriptor.getNumberOfColumns(),
+                                      "Invalid column position found for " + rc.getName());
+			/* Verify that this column's name is unique within the list if requested */
+            if( statement != null && columnBitSet.isSet( colIdx))
+            {
+                String colName = rc.getName();
 
-			if (object != null &&
-				((String) object).equals(colName))
-			{
-				if (SanityManager.DEBUG)
-				{
-					SanityManager.ASSERT((statement instanceof UpdateNode) ||
-										 (statement instanceof InsertNode),
-						"statement is expected to be instanceof UpdateNode or InsertNode");
-				}
 				if (statement instanceof UpdateNode)
 				{
 					throw StandardException.newException(SQLState.LANG_DUPLICATE_COLUMN_NAME_UPDATE, colName);
@@ -644,12 +670,9 @@
 					throw StandardException.newException(SQLState.LANG_DUPLICATE_COLUMN_NAME_INSERT, colName);
 				}
 			}
-
-			rc.bindResultColumnByName(
-						targetTableDescriptor,
-						index + 1
-					);
+            columnBitSet.set( colIdx);
 		}
+		return columnBitSet;
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java?rev=356133&r1=356132&r2=356133&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java Sun Dec 11 19:57:33 2005
@@ -682,7 +682,7 @@
 			if (targetTableDescriptor != null)
 			{
 				resultColumns.bindResultColumnsByName(
-						targetTableDescriptor, statement);
+						targetTableDescriptor, (DMLStatementNode)statement);
 			}
 			else
 			{

Added: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RevokeNode.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RevokeNode.java?rev=356133&view=auto
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RevokeNode.java (added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RevokeNode.java Sun Dec 11 19:57:33 2005
@@ -0,0 +1,111 @@
+/*
+
+   Derby - Class org.apache.derby.impl.sql.compile.RevokeNode
+
+   Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package	org.apache.derby.impl.sql.compile;
+
+import org.apache.derby.iapi.sql.execute.ConstantAction;
+import org.apache.derby.impl.sql.execute.PrivilegeInfo;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.error.StandardException;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This class represents a REVOKE statement.
+ */
+public class RevokeNode extends MiscellaneousStatementNode
+{
+    PrivilegeNode privileges;
+    List grantees;
+
+	/**
+	 * Convert this object to a String.  See comments in QueryTreeNode.java
+	 * for how this should be done for tree printing.
+	 *
+	 * @return	This object as a String
+	 */
+
+	public String toString()
+	{
+		if (SanityManager.DEBUG)
+		{
+            StringBuffer sb = new StringBuffer();
+            for( Iterator it = grantees.iterator(); it.hasNext();)
+            {
+                if( sb.length() > 0)
+                    sb.append( ",");
+                sb.append( it.next().toString());
+            }
+			return super.toString() +
+                   privileges.toString() +
+                   "TO: \n" + sb.toString() + "\n";
+		}
+		else
+		{
+			return "";
+		}
+    } // end of toString
+
+	public String statementToString()
+	{
+        return "REVOKE";
+    }
+
+    
+    /**
+     * Initialize a RevokeNode.
+     *
+     * @param privileges PrivilegesNode
+     * @param grantees List
+     */
+    public void init( Object privileges,
+                      Object grantees)
+    {
+        this.privileges = (PrivilegeNode) privileges;
+        this.grantees = (List) grantees;
+    }
+
+    /**
+     * Bind this RevokeNode. Resolve all table, column, and routine references.
+     *
+     * @return the bound RevokeNode
+     *
+     * @exception StandardException	Standard error policy.
+     */
+	public QueryTreeNode bind() throws StandardException
+	{
+        privileges = (PrivilegeNode) privileges.bind( new HashMap());
+        return this;
+    } // end of bind
+
+
+	/**
+	 * Create the Constant information that will drive the guts of Execution.
+	 *
+	 * @exception StandardException	Standard error policy.
+	 */
+	public ConstantAction makeConstantAction() throws StandardException
+	{
+        return getGenericConstantActionFactory().getRevokeConstantAction( privileges.makePrivilegeInfo(),
+                                                                          grantees);
+    }
+}

Propchange: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RevokeNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RoutineDesignator.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RoutineDesignator.java?rev=356133&view=auto
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RoutineDesignator.java (added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RoutineDesignator.java Sun Dec 11 19:57:33 2005
@@ -0,0 +1,70 @@
+/*
+
+   Derby - Class org.apache.derby.impl.sql.compile.RoutineDesignator
+
+   Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+	  http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package	org.apache.derby.impl.sql.compile;
+
+import org.apache.derby.iapi.error.StandardException;
+
+import org.apache.derby.impl.sql.execute.PrivilegeInfo;
+import org.apache.derby.impl.sql.execute.RoutinePrivilegeInfo;
+import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;
+
+import java.util.List;
+
+/**
+ * This node represents a routine signature.
+ */
+public class RoutineDesignator
+{
+	boolean isSpecific;
+	TableName name; // TableName is a misnomer it is really just a schema qualified name
+	boolean isFunction; // else a procedure
+	/**
+	 * A list of DataTypeDescriptors
+	 * if null then the signature is not specified and this designator is ambiguous if there is
+	 * more than one function (procedure) with this name.
+	 */
+	List paramTypeList;
+	AliasDescriptor aliasDescriptor;
+
+	public RoutineDesignator( boolean isSpecific,
+							  TableName name,
+							  boolean isFunction,
+							  List paramTypeList)
+	{
+		this.isSpecific = isSpecific;
+		this.name = name;
+		this.isFunction = isFunction;
+		this.paramTypeList = paramTypeList;
+	}
+
+	void setAliasDescriptor( AliasDescriptor aliasDescriptor)
+	{
+		this.aliasDescriptor = aliasDescriptor;
+	}
+	
+	/**
+	 * @return PrivilegeInfo for this node
+	 */
+	PrivilegeInfo makePrivilegeInfo()
+	{
+		return new RoutinePrivilegeInfo( aliasDescriptor);
+	}
+}

Propchange: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RoutineDesignator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TablePrivilegesNode.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TablePrivilegesNode.java?rev=356133&view=auto
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TablePrivilegesNode.java (added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TablePrivilegesNode.java Sun Dec 11 19:57:33 2005
@@ -0,0 +1,94 @@
+/*
+
+   Derby - Class org.apache.derby.impl.sql.compile.TablePrivilegesNode
+
+   Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+	  http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package	org.apache.derby.impl.sql.compile;
+
+import org.apache.derby.iapi.error.StandardException;
+
+import org.apache.derby.impl.sql.execute.PrivilegeInfo;
+import org.apache.derby.impl.sql.execute.TablePrivilegeInfo;
+import org.apache.derby.iapi.services.io.FormatableBitSet;
+import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
+
+/**
+ * This class represents a set of privileges on one table.
+ */
+public class TablePrivilegesNode extends QueryTreeNode
+{
+	private boolean[] actionAllowed = new boolean[ TablePrivilegeInfo.ACTION_COUNT];
+	private ResultColumnList[] columnLists = new ResultColumnList[ TablePrivilegeInfo.ACTION_COUNT];
+	private FormatableBitSet[] columnBitSets = new FormatableBitSet[ TablePrivilegeInfo.ACTION_COUNT];
+	private TableDescriptor td;
+
+	/**
+	 * Add all actions
+	 */
+	public void addAll()
+	{
+		for( int i = 0; i < TablePrivilegeInfo.ACTION_COUNT; i++)
+		{
+			actionAllowed[i] = true;
+			columnLists[i] = null;
+		}
+	} // end of addAll
+
+	/**
+	 * Add one action to the privileges for this table
+	 *
+	 * @param action The action type
+	 * @param privilegeColumnList The set of privilege columns. Null for all columns
+	 *
+	 * @exception StandardException standard error policy.
+	 */
+	public void addAction( int action, ResultColumnList privilegeColumnList)
+	{
+		actionAllowed[ action] = true;
+		if( privilegeColumnList == null)
+			columnLists[ action] = null;
+		else if( columnLists[ action] == null)
+			columnLists[ action] = privilegeColumnList;
+		else
+			columnLists[ action].appendResultColumns( privilegeColumnList, false);
+	} // end of addAction
+
+	/**
+	 * Bind.
+	 *
+	 * @param td The table descriptor
+	 */
+	public void bind( TableDescriptor td) throws StandardException
+	{
+		this.td = td;
+		
+		for( int action = 0; action < TablePrivilegeInfo.ACTION_COUNT; action++)
+		{
+			if( columnLists[ action] != null)
+				columnBitSets[action] = columnLists[ action].bindResultColumnsByName( td, (DMLStatementNode) null);
+		}
+	}
+	
+	/**
+	 * @return PrivilegeInfo for this node
+	 */
+	public PrivilegeInfo makePrivilegeInfo()
+	{
+		return new TablePrivilegeInfo( td, actionAllowed, columnBitSets);
+	}
+}

Propchange: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TablePrivilegesNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=356133&r1=356132&r2=356133&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 Sun Dec 11 19:57:33 2005
@@ -76,12 +76,15 @@
 import org.apache.derby.impl.sql.compile.TableName;
 import org.apache.derby.impl.sql.compile.TernaryOperatorNode;
 import org.apache.derby.impl.sql.compile.ParameterNode;
+import org.apache.derby.impl.sql.compile.PrivilegeNode;
 import org.apache.derby.impl.sql.compile.ConstraintDefinitionNode;
 import org.apache.derby.impl.sql.compile.DMLModStatementNode;
+import org.apache.derby.impl.sql.compile.RoutineDesignator;
 import org.apache.derby.impl.sql.compile.StatementNode;
 import org.apache.derby.impl.sql.compile.TableElementList;
 import org.apache.derby.impl.sql.compile.TableElementNode;
 import org.apache.derby.impl.sql.compile.TableOperatorNode;
+import org.apache.derby.impl.sql.compile.TablePrivilegesNode;
 import org.apache.derby.impl.sql.compile.TransactionStatementNode;
 import org.apache.derby.impl.sql.compile.TriggerReferencingStruct;
 import org.apache.derby.impl.sql.compile.UnionNode;
@@ -103,11 +106,13 @@
 import org.apache.derby.impl.sql.compile.TokenMgrError;
 import org.apache.derby.impl.sql.compile.SQLParserConstants;
 import org.apache.derby.impl.sql.compile.CharStream;
+import org.apache.derby.impl.sql.execute.TablePrivilegeInfo;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ViewDescriptor;
 
+import org.apache.derby.iapi.sql.conn.Authorizer;
 import org.apache.derby.iapi.sql.execute.ConstantAction;
 import org.apache.derby.iapi.sql.execute.ExecutionContext;
 
@@ -124,6 +129,7 @@
 
 import org.apache.derby.iapi.error.StandardException;
 
+import org.apache.derby.iapi.reference.Property;
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.reference.JDBC30Translation;
 import org.apache.derby.iapi.reference.Limits;
@@ -148,6 +154,8 @@
 import org.apache.derby.iapi.util.StringUtil;
 
 import java.sql.Types;
+import java.util.List;
+import java.util.ArrayList;
 import java.util.Hashtable;
 import java.util.Properties;
 import java.util.Vector;
@@ -311,6 +319,23 @@
 				version, feature);
 	}
 
+    /**
+		Utility method for checking that the underlying database uses SQL standard
+		permission checking (GRANT/REVOKE).
+
+		@param command "GRANT" or "REVOKE"
+    */
+	private void checkSqlStandardAccess( String command) throws StandardException
+	{
+		if( getLanguageConnectionContext().getAuthorizer().usesSqlStandardPermissions())
+			return;
+
+		throw StandardException.newException(SQLState.LANG_GRANT_REVOKE_WITH_LEGACY_ACCESS,
+											command,
+											Property.DEFAULT_CONNECTION_MODE_PROPERTY,
+											Property.SQL_STANDARD_ACCESS);
+	}
+
 	/*
 	** Make sure that a select list in a parser-rewritten tree does
 	** not contain two columns by the same name. This is the patch
@@ -1653,6 +1678,12 @@
                                                 getContextManager());
     }
     
+	private void checkAuthorizationLength( String authorization)
+		throws StandardException
+	{
+		checkIdentifierLengthLimit( authorization, Limits.DB2_MAX_USERID_LENGTH);
+	}
+
     /**
         Check to see if the required claues have been added
         to a procedure or function defintion.
@@ -1941,6 +1972,7 @@
 |	<DATA: "data">
 |	<DATE: "date">
 |	<DAY: "day">
+|	<DEFINER: "definer">
 |   <DYNAMIC: "dynamic">
 |	<FORTRAN: "fortran">
 |   <GENERATED: "generated">
@@ -1949,6 +1981,7 @@
 |	<INITIAL: "initial">
 |   <INOUT: "inout">
 |	<INTERVAL: "interval">
+|	<INVOKER: "invoker">
 |	<LANGUAGE: "language">
 |	<LARGE: "large">
 |	<LENGTH: "length">
@@ -1976,6 +2009,7 @@
 |	<ROW: "row">
 |	<SAVEPOINT: "savepoint">
 |	<SCALE: "scale">
+|	<SECURITY: "security">
 |	<SERIALIZABLE: "serializable">
 |	<SQL_TSI_FRAC_SECOND: "sql_tsi_frac_second">
 |	<SQL_TSI_SECOND: "sql_tsi_second">
@@ -2528,8 +2562,10 @@
         statementNode = globalTemporaryTableDeclaration() |
         statementNode = preparableSQLDataStatement() |
         statementNode = spsSetStatement() |
-	statementNode = truncateTableStatement() |
-	statementNode = execStatement()
+		statementNode = truncateTableStatement() |
+		statementNode = grantStatement() |
+		statementNode = revokeStatement() |
+		statementNode = execStatement()
         // statementNode = SQLTransactionStatement()
     )
     {
@@ -9118,13 +9154,14 @@
 	6 - Short - SQL allowed.
 	7 - Boolean - CALLED ON NULL INPUT (always TRUE for procedures)
 	8 - TypeDescriptor - return type (always NULL for procedures)
+	9 - External security - invoker/definer
 */
 
 QueryTreeNode
 procedureDefinition() throws StandardException :
 {
 	TableName procedureName;
-	Object[] procedureElements = new Object[9];
+	Object[] procedureElements = new Object[10];
 }
 {
 		<PROCEDURE> procedureName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH)
@@ -9162,6 +9199,7 @@
 	|
 		<LANGUAGE>  <JAVA> { clauseValue = "JAVA"; clausePosition = 3; }
 	|
+		LOOKAHEAD({(getToken(1).kind == EXTERNAL && getToken(2).kind == NAME)})
 		<EXTERNAL> <NAME> clauseValue = string() { clausePosition = 4; }
 	|
 		<PARAMETER> <STYLE> clauseValue = parameterStyle() { clausePosition = 5; }
@@ -9177,6 +9215,9 @@
 		}
 
 	|   clauseValue = calledOnNullInput(isProcedure) { clausePosition = 7; }
+	|
+		LOOKAHEAD({(getToken(1).kind == EXTERNAL && getToken(2).kind == SECURITY)})	
+		clauseValue = externalSecurity() { clausePosition = 9; }
 	)
 
 	{
@@ -9294,7 +9335,7 @@
 functionDefinition() throws StandardException :
 {
 	TableName functionName;
-	Object[] functionElements = new Object[9];
+	Object[] functionElements = new Object[10];
 }
 {
 		<FUNCTION> functionName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH)
@@ -11561,6 +11602,354 @@
 }
 
 /*
+ * <A NAME="external-security clause">externalSecurity</A>
+ */
+Boolean
+externalSecurity() throws StandardException :
+{
+	Boolean invocationType;
+}
+{
+	<EXTERNAL> <SECURITY>
+	{
+		// GrantRevoke TODO: This needs to check for 10.2 version
+		checkVersion( DataDictionary.DD_VERSION_DERBY_10_1, "EXTERNAL SECURITY");
+		checkSqlStandardAccess( "EXTERNAL SECURITY");
+	}
+	( invocationType = securityDefinerInvoker())
+	{
+		return invocationType;
+	}
+}
+
+Boolean
+securityDefinerInvoker() :
+{}
+{
+	<DEFINER>
+	{
+		return Boolean.FALSE;
+	}
+	| <INVOKER>
+	{
+		return Boolean.TRUE;
+	}
+}
+
+/*
+ * <A NAME="grantStatement">grantStatement</A>
+ */
+QueryTreeNode
+grantStatement() throws StandardException :
+{
+    QueryTreeNode node;
+}
+{
+	<GRANT>
+	{
+		// GrantRevoke TODO: This needs to check for 10.2 version
+		checkVersion( DataDictionary.DD_VERSION_DERBY_10_1, "GRANT");
+		checkSqlStandardAccess( "GRANT");
+	}
+	( node = tableGrantStatement() | node = routineGrantStatement() )
+	{
+		return node;
+	}
+}
+
+/*
+ * <A NAME="tableGrantStatement">tableGrantStatement</A>
+ */
+QueryTreeNode
+tableGrantStatement() throws StandardException :
+{
+    PrivilegeNode privileges = null;
+    List grantees;
+}
+{
+       privileges = tablePrivileges()
+       <TO> grantees = granteeList()
+    {
+        return nodeFactory.getNode( C_NodeTypes.GRANT_NODE,
+                                    privileges, grantees,
+                                    getContextManager());
+    }
+}// end of tableGrantStatement
+
+/*
+ * <A NAME="tablePrivileges">tablePrivileges</A>
+ */
+PrivilegeNode tablePrivileges() throws StandardException :
+{
+    TablePrivilegesNode tablePrivilegesNode = null;
+    TableName objectName = null;
+}
+{
+    tablePrivilegesNode = tableActions()
+      <ON> [ <TABLE> ] objectName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH)
+    {
+        return (PrivilegeNode) nodeFactory.getNode( C_NodeTypes.PRIVILEGE_NODE,
+                                                    ReuseFactory.getInteger( PrivilegeNode.TABLE_PRIVILEGES),
+                                                    objectName, tablePrivilegesNode,
+                                                    getContextManager());
+    }
+} // end of   tablePrivilege                               
+
+/*
+ * <A NAME="tableActions">tableActions</A>
+ */
+TablePrivilegesNode tableActions() throws StandardException :
+{
+    TablePrivilegesNode tableActionsNode = (TablePrivilegesNode)
+      nodeFactory.getNode( C_NodeTypes.TABLE_PRIVILEGES_NODE, getContextManager());
+}
+{
+    <ALL> <PRIVILEGES>
+    {
+        tableActionsNode.addAll();
+        return tableActionsNode;
+    }
+|
+    tableAction( tableActionsNode) ( <COMMA> tableAction( tableActionsNode) )*
+    {
+        return tableActionsNode;
+    }
+} // end of tableActions
+
+/*
+ * <A NAME="routineGrantStatement">routineGrantStatement</A>
+ */
+QueryTreeNode
+routineGrantStatement() throws StandardException :
+{
+    List grantees;
+    RoutineDesignator routine = null;
+}
+{
+    <EXECUTE> <ON> routine = routineDesignator()
+    <TO> grantees = granteeList()
+    {
+        PrivilegeNode routinePrivilege = (PrivilegeNode)
+          nodeFactory.getNode( C_NodeTypes.PRIVILEGE_NODE,
+                               ReuseFactory.getInteger( PrivilegeNode.ROUTINE_PRIVILEGES),
+                               routine, null,
+                               getContextManager());
+        return nodeFactory.getNode( C_NodeTypes.GRANT_NODE,
+                                    routinePrivilege, grantees,
+                                    getContextManager());
+    }
+}// end of routineGrantStatement
+
+/*
+ * <A NAME="routineAlias">routineAlias</A>
+ */
+RoutineDesignator routineDesignator() throws StandardException :
+{
+    Token procOrFunction;
+    RoutineDesignator routine = null;
+    TableName name = null;
+    List paramTypeList = null;
+}
+{
+    ( procOrFunction = <FUNCTION> | procOrFunction = <PROCEDURE> )
+      name = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH)
+      [ <LEFT_PAREN> paramTypeList = parameterTypeList() <RIGHT_PAREN> ]
+    {
+        return new RoutineDesignator( false,
+                                      name,
+                                      (procOrFunction.kind == FUNCTION),
+                                      paramTypeList);
+    }
+} // end of routineDesignator
+
+
+/*
+ * <A NAME="parameterTypeList">parameterTypeList</A>
+ */
+List parameterTypeList( ) throws StandardException :
+{
+    ArrayList list = new ArrayList();
+    DataTypeDescriptor dtd;
+}
+{
+    [ dtd = dataTypeCommon()
+        {
+            list.add( dtd);
+        }
+      ( <COMMA> dtd = dataTypeCommon()
+        {
+            list.add( dtd);
+        }
+      ) * ]
+    {
+        return list;
+    }
+} // end of parameterTypeList
+
+
+/*
+ * <A NAME="tableAction">tableAction</A>
+ */
+void tableAction( TablePrivilegesNode tablePrivilegesNode)  throws StandardException :
+{
+    ResultColumnList columnList = null;
+}
+{
+    <SELECT> [ columnList = privilegeColumnList() ]
+    {
+        tablePrivilegesNode.addAction( TablePrivilegeInfo.SELECT_ACTION, columnList);
+    }
+|
+    <DELETE>
+    {
+        tablePrivilegesNode.addAction( TablePrivilegeInfo.DELETE_ACTION, (ResultColumnList) null);
+    }
+|
+    <INSERT>
+    {
+        tablePrivilegesNode.addAction( TablePrivilegeInfo.INSERT_ACTION, (ResultColumnList) null);
+    }
+|
+    <UPDATE> [ columnList = privilegeColumnList() ]
+    {
+        tablePrivilegesNode.addAction( TablePrivilegeInfo.UPDATE_ACTION, columnList);
+    }
+|
+    <REFERENCES> [ columnList = privilegeColumnList() ]
+    {
+        tablePrivilegesNode.addAction( TablePrivilegeInfo.REFERENCES_ACTION, columnList);
+    }
+|
+    <TRIGGER>
+    {
+        tablePrivilegesNode.addAction( TablePrivilegeInfo.TRIGGER_ACTION, (ResultColumnList) null);
+    }
+} // end of tableAction
+
+/*
+ * <A NAME="privilegeColumnList">privilegeColumnList</A>
+ */
+ResultColumnList privilegeColumnList() throws StandardException :
+{
+    ResultColumnList cl = (ResultColumnList) nodeFactory.getNode( C_NodeTypes.RESULT_COLUMN_LIST,
+                                                                  getContextManager());
+}
+{
+    <LEFT_PAREN> columnNameList( cl) <RIGHT_PAREN>
+    {
+        return cl;
+    }
+} // end of privilegeColumnList
+
+/*
+ * <A NAME="granteeList">granteeList</A>
+ */
+List granteeList() throws StandardException :
+{
+    ArrayList list = new ArrayList();
+}
+{
+    grantee( list) ( <COMMA> grantee( list) ) *
+    {
+        return list;
+    }
+}
+
+void
+grantee( List list)  throws StandardException :
+{
+	Token tok;
+    String str;
+}
+{
+    tok = <IDENTIFIER>
+    {
+        checkAuthorizationLength( tok.image);
+        list.add( tok.image);
+    }
+|
+    tok = <PUBLIC>
+    {
+        list.add( Authorizer.PUBLIC_AUTHORIZATION_ID);
+    }
+|
+    str = delimitedIdentifier()
+    {
+        checkAuthorizationLength( str);
+        list.add( str);
+    }
+|
+    str = nonReservedKeyword()
+    {
+        checkAuthorizationLength( str);
+        list.add( str);
+    }
+}
+
+/*
+ * <A NAME="revokeStatement">revokeStatement</A>
+ */
+QueryTreeNode
+revokeStatement() throws StandardException :
+{
+    QueryTreeNode node;
+}
+{
+    <REVOKE>
+      {
+          checkVersion( DataDictionary.DD_VERSION_DERBY_10_1, "REVOKE");
+          checkSqlStandardAccess( "REVOKE");
+      }
+    ( node = tableRevokeStatement() | node = routineRevokeStatement() )
+    {
+        return node;
+    }
+}
+
+/*
+ * <A NAME="tableRevokeStatement">tableRevokeStatement</A>
+ */
+QueryTreeNode
+tableRevokeStatement() throws StandardException :
+{
+    PrivilegeNode privileges = null;
+    List grantees;
+}
+{
+       privileges = tablePrivileges()
+       <FROM> grantees = granteeList()
+    {
+        return nodeFactory.getNode( C_NodeTypes.REVOKE_NODE,
+                                    privileges, grantees,
+                                    getContextManager());
+    }
+}// end of tableRevokeStatement
+
+/*
+ * <A NAME="routineRevokeStatement">routineRevokeStatement</A>
+ */
+QueryTreeNode
+routineRevokeStatement() throws StandardException :
+{
+    List grantees;
+    RoutineDesignator routine = null;
+}
+{
+    <EXECUTE> <ON> routine = routineDesignator()
+    <FROM> grantees = granteeList() <RESTRICT>
+    {
+        PrivilegeNode routinePrivilege = (PrivilegeNode)
+          nodeFactory.getNode( C_NodeTypes.PRIVILEGE_NODE,
+                               ReuseFactory.getInteger( PrivilegeNode.ROUTINE_PRIVILEGES),
+                               routine, null,
+                               getContextManager());
+        return nodeFactory.getNode( C_NodeTypes.REVOKE_NODE,
+                                    routinePrivilege, grantees,
+                                    getContextManager());
+    }
+}// end of routineRevokeStatement
+
+/*
  * <A NAME="identifier">identifier</A>
  */
 String
@@ -11926,6 +12315,7 @@
 	|	tok = <DYNAMIC>
     |   tok = <DATABASE>
 	|	tok = <DB2SQL>
+	|	tok = <DEFINER>
 	|	tok = <DOCUMENT>
 	|	tok = <EACH>
 	|	tok = <EXCLUSIVE>
@@ -11938,6 +12328,7 @@
 	|	tok = <INITIAL>
 // SQL92 says it is reserved, but we want it to be non-reserved.
 	|	tok = <INTERVAL>
+	|	tok = <INVOKER>
 	|   tok = <JAVA>
 	|	tok = <LANGUAGE>
 	|	tok = <LARGE>
@@ -11995,6 +12386,7 @@
 	|	tok = <SCALE>
 	|	tok = <SAVEPOINT>
 	|	tok = <SEQUENTIAL>
+	|	tok = <SECURITY>
 	|	tok = <SERIALIZABLE>
 	|	tok = <SETS>
 	|	tok = <SHARE>

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericAuthorizer.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericAuthorizer.java?rev=356133&r1=356132&r2=356133&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericAuthorizer.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericAuthorizer.java Sun Dec 11 19:57:33 2005
@@ -20,6 +20,7 @@
 
 package org.apache.derby.impl.sql.conn;
 
+import org.apache.derby.iapi.sql.Activation;
 import org.apache.derby.iapi.reference.Property;
 import org.apache.derby.iapi.util.IdUtil;
 import org.apache.derby.iapi.util.StringUtil;
@@ -31,7 +32,13 @@
 import org.apache.derby.iapi.services.property.PropertyUtil;
 import org.apache.derby.iapi.services.property.PersistentSet;
 import org.apache.derby.catalog.types.RoutineAliasInfo;
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;
+import org.apache.derby.iapi.sql.dictionary.StatementPermission;
+import org.apache.derby.iapi.store.access.TransactionController;
+
 import java.util.Properties;
+import java.util.List;
+import java.util.Iterator;
 
 class GenericAuthorizer
 implements Authorizer
@@ -41,6 +48,7 @@
 	private static final int NO_ACCESS = 0;
 	private static final int READ_ACCESS = 1;
 	private static final int FULL_ACCESS = 2;
+	private static final int SQL_STANDARD_ACCESS = 3;
 	
 	//
 	//Configurable userAccessLevel - derived from Database level
@@ -82,10 +90,21 @@
 	}
 
 	/**
+	  Used for operations that do not involve tables or routines.
+     
+	  @see Authorizer#authorize
+	  @exception StandardException Thrown if the operation is not allowed
+	*/
+	public void authorize( int operation) throws StandardException
+	{
+		authorize( (Activation) null, operation);
+	}
+
+	/**
 	  @see Authorizer#authorize
 	  @exception StandardException Thrown if the operation is not allowed
 	 */
-	public void authorize(int operation) throws StandardException
+	public void authorize( Activation activation, int operation) throws StandardException
 	{
 		int sqlAllowed = lcc.getStatementContext().getSQLAllowed();
 
@@ -124,6 +143,23 @@
 			if (SanityManager.DEBUG)
 				SanityManager.THROWASSERT("Bad operation code "+operation);
 		}
+
+        if( activation != null)
+        {
+            List requiredPermissionsList = null;
+			// GrantRevoke TODO: Need this logic for enforcing permissions later.
+			// List requiredPermissionsList = activation.getPreparedStatement().getRequiredPermissionsList();
+            if( requiredPermissionsList != null && ! requiredPermissionsList.isEmpty())
+            {
+                DataDictionary dd = lcc.getDataDictionary();
+                TransactionController tc = activation.getTransactionController();
+                for( Iterator iter = requiredPermissionsList.iterator();
+                     iter.hasNext();)
+                {
+                    ((StatementPermission) iter.next()).check( tc, dd, authorizationId, false);
+                }                    
+            }
+		}
 	}
 
 	private static StandardException externalRoutineException(int operation, int sqlAllowed) {
@@ -178,6 +214,7 @@
 	private int getDefaultAccessLevel() throws StandardException
 	{
 		PersistentSet tc = lcc.getTransactionExecute();
+
 		String modeS = (String)
 			PropertyUtil.getServiceProperty(
 									tc,
@@ -190,6 +227,8 @@
 			return READ_ACCESS;
 		else if(StringUtil.SQLEqualsIgnoreCase(modeS, Property.FULL_ACCESS))
 			return FULL_ACCESS;
+		else if(StringUtil.SQLEqualsIgnoreCase(modeS, Property.SQL_STANDARD_ACCESS))
+            return FULL_ACCESS; 
 		else
 		{
 			if (SanityManager.DEBUG)
@@ -245,4 +284,17 @@
 		if (userAccessLevel == NO_ACCESS)
 			throw StandardException.newException(SQLState.AUTH_DATABASE_CONNECTION_REFUSED);
 	}
+
+    public boolean usesSqlStandardPermissions() throws StandardException
+    {
+		// RESOLVE use getDefaultAccessLevel() when SQL standard permissions are fully implemented
+		// GrantRevoke TODO: May need to make database property value override system value
+		PersistentSet tc = lcc.getTransactionExecute();
+		String modeS = (String)
+		PropertyUtil.getServiceProperty(tc,
+									Property.DEFAULT_CONNECTION_MODE_PROPERTY);
+		if( modeS == null)
+            return false;
+		return StringUtil.SQLEqualsIgnoreCase(modeS, Property.SQL_STANDARD_ACCESS);
+    } // end of usesSqlStandardPermissions
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java?rev=356133&r1=356132&r2=356133&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java Sun Dec 11 19:57:33 2005
@@ -52,6 +52,7 @@
 
 import org.apache.derby.iapi.services.io.FormatableBitSet;
 
+import java.util.List;
 import java.util.Properties;
 
 import java.sql.Timestamp;
@@ -1014,5 +1015,31 @@
 		(SchemaDescriptor sd, String fullTableName, String objectName, boolean forTable)
 	{
 		return new DropStatisticsConstantAction(sd, fullTableName, objectName, forTable);
+	}
+
+	/**
+	 * Make the constant action for a Grant statement
+	 *
+	 * @param privileges The list of privileges to be granted
+	 * @param grantees The list of grantees
+	 * @param withGrantOption true if WITH GRANT OPTION, false if not.
+	 */
+	public ConstantAction getGrantConstantAction( PrivilegeInfo privileges,
+								List grantees)
+	{
+		return new GrantRevokeConstantAction( true, privileges, grantees);
+	}
+
+	/**
+	 * Make the constant action for a Revoke statement
+	 * 
+	 * @param privileges The list of privileges to be revokeed
+	 * @param grantees The list of grantees
+	 * @param withGrantOption true if WITH GRANT OPTION, false if not.
+	 */
+	public ConstantAction getRevokeConstantAction( PrivilegeInfo privileges,
+								List grantees)
+	{
+		return new GrantRevokeConstantAction( false, privileges, grantees);
 	}
 }

Added: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GrantRevokeConstantAction.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GrantRevokeConstantAction.java?rev=356133&view=auto
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GrantRevokeConstantAction.java (added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GrantRevokeConstantAction.java Sun Dec 11 19:57:33 2005
@@ -0,0 +1,77 @@
+/*
+
+   Derby - Class org.apache.derby.impl.sql.execute.GrantRevokeConstantAction
+
+   Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+	  http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package org.apache.derby.impl.sql.execute;
+
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.catalog.UUID;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.sql.Activation;
+
+import java.util.List;
+
+class GrantRevokeConstantAction extends GenericConstantAction
+{
+	private boolean grant;
+	private PrivilegeInfo privileges;
+	private List grantees;
+
+	GrantRevokeConstantAction( boolean grant,
+							   PrivilegeInfo privileges,
+							   List grantees)
+	{
+		this.grant = grant;
+		this.privileges = privileges;
+		this.grantees = grantees;
+	}
+
+	public	String	toString()
+	{
+		return grant ? "GRANT" : "REVOKE";
+	}
+
+
+	/**
+	 *	This is the guts of the Execution-time logic for GRANT/REVOKE
+	 *
+	 *	@see ConstantAction#executeConstantAction
+	 *
+	 * @exception StandardException		Thrown on failure
+	 */
+	public void	executeConstantAction( Activation activation )
+						throws StandardException
+	{
+		privileges.executeGrantRevoke( activation, grant, grantees);
+	}
+
+	/**
+	 * Does this constant action modify the passed in table
+	 * uuid?  By modify we mean add or drop things tied to
+	 * this table (e.g. index, trigger, constraint).
+	 * @param tableId the other table id
+	 *
+	 * @exception   StandardException thrown on failure
+	 */
+	public boolean modifiesTableId(UUID tableId)
+		throws StandardException
+	{
+		return false;
+	}
+}

Propchange: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GrantRevokeConstantAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/PrivilegeInfo.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/PrivilegeInfo.java?rev=356133&view=auto
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/PrivilegeInfo.java (added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/PrivilegeInfo.java Sun Dec 11 19:57:33 2005
@@ -0,0 +1,74 @@
+/*
+
+   Derby - Class org.apache.derby.impl.sql.execute.PrivilegeInfo
+
+   Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+	  http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package org.apache.derby.impl.sql.execute;
+
+import org.apache.derby.catalog.UUID;
+import org.apache.derby.iapi.sql.dictionary.TupleDescriptor;
+import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.Activation;
+import org.apache.derby.iapi.reference.SQLState;
+
+import org.apache.derby.iapi.error.StandardException;
+
+import java.util.List;
+
+public abstract class PrivilegeInfo
+{
+
+	/**
+	 *	This is the guts of the Execution-time logic for GRANT/REVOKE
+	 *
+	 * @param activation
+	 * @param grant true if grant, false if revoke
+	 * @param grantees a list of authorization ids (strings)
+	 *
+	 * @exception StandardException		Thrown on failure
+	 */
+	abstract public void executeGrantRevoke( Activation activation,
+											 boolean grant,
+											 List grantees)
+		throws StandardException;
+
+	/**
+	 * Determines whether a user is the owner of an object (table, function, or procedure).
+	 *
+	 * @param user
+	 * @param objectDescriptor
+	 * @param sd
+	 *
+	 * @return true iff the user is the owner of the schema
+	 *
+	 * @exception StandardException if user does not own the object
+	 */
+	protected void checkOwnership( String user,
+								   TupleDescriptor objectDescriptor,
+								   SchemaDescriptor sd)
+		throws StandardException
+	{
+		if( ! user.equals( sd.getAuthorizationId()))
+			throw StandardException.newException( SQLState.AUTH_NOT_OWNER,
+												  user,
+												  objectDescriptor.getDescriptorType(),
+												  sd.getSchemaName(),
+												  objectDescriptor.getDescriptorName());
+	}
+}

Propchange: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/PrivilegeInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RoutinePrivilegeInfo.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RoutinePrivilegeInfo.java?rev=356133&view=auto
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RoutinePrivilegeInfo.java (added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RoutinePrivilegeInfo.java Sun Dec 11 19:57:33 2005
@@ -0,0 +1,83 @@
+/*
+
+   Derby - Class org.apache.derby.impl.sql.execute.RoutinePrivilegeInfo
+
+   Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+	  http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package org.apache.derby.impl.sql.execute;
+
+import org.apache.derby.iapi.sql.Activation;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
+import org.apache.derby.iapi.store.access.TransactionController;
+import org.apache.derby.iapi.sql.dictionary.RoutinePermsDescriptor;
+import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;
+import org.apache.derby.iapi.sql.dictionary.StatementRoutinePermission;
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;
+import org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator;
+import org.apache.derby.iapi.error.StandardException;
+
+import java.util.Iterator;
+import java.util.List;
+
+public class RoutinePrivilegeInfo extends PrivilegeInfo
+{
+	private AliasDescriptor aliasDescriptor;
+
+	public RoutinePrivilegeInfo( AliasDescriptor aliasDescriptor)
+	{
+		this.aliasDescriptor = aliasDescriptor;
+	}
+	
+	/**
+	 *	This is the guts of the Execution-time logic for GRANT/REVOKE of a routine execute privilege
+	 *
+	 * @param activation
+	 * @param grant true if grant, false if revoke
+	 * @param grantees a list of authorization ids (strings)
+	 * @param withGrantOption true if grant with grant option, false if not. always false if !grant
+	 *
+	 * @exception StandardException		Thrown on failure
+	 */
+	public void executeGrantRevoke( Activation activation,
+									boolean grant,
+									List grantees)
+		throws StandardException
+	{
+		// Check that the current user has permission to grant the privileges.
+		LanguageConnectionContext lcc = activation.getLanguageConnectionContext();
+		DataDictionary dd = lcc.getDataDictionary();
+		String currentUser = lcc.getAuthorizationId();
+		TransactionController tc = lcc.getTransactionExecute();
+
+		// Check that the current user has permission to grant the privileges.
+		checkOwnership( currentUser,
+						aliasDescriptor,
+						dd.getSchemaDescriptor( aliasDescriptor.getSchemaUUID(), tc));
+		
+		DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
+
+		RoutinePermsDescriptor routinePermsDesc = ddg.newRoutinePermsDescriptor( aliasDescriptor, currentUser);
+
+		dd.startWriting(lcc);
+		for( Iterator itr = grantees.iterator(); itr.hasNext();)
+		{
+			String grantee = (String) itr.next();
+			dd.addRemovePermissionsDescriptor( grant, routinePermsDesc, grantee, tc);
+		}
+	} // end of executeConstantAction
+}

Propchange: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RoutinePrivilegeInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java?rev=356133&view=auto
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java (added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java Sun Dec 11 19:57:33 2005
@@ -0,0 +1,159 @@
+/*
+
+   Derby - Class org.apache.derby.impl.sql.execute.TablePrivilegeInfo
+
+   Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+	  http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package org.apache.derby.impl.sql.execute;
+
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.services.io.FormatableBitSet;
+import org.apache.derby.iapi.sql.Activation;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
+import org.apache.derby.iapi.store.access.TransactionController;
+import org.apache.derby.iapi.sql.dictionary.PermissionsDescriptor;
+import org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor;
+import org.apache.derby.iapi.sql.dictionary.ColPermsDescriptor;
+import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;
+import org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator;
+
+import java.util.List;
+import java.util.Iterator;
+
+public class TablePrivilegeInfo extends PrivilegeInfo
+{
+	// Action types
+	public static final int SELECT_ACTION = 0;
+	public static final int DELETE_ACTION = 1;
+	public static final int INSERT_ACTION = 2;
+	public static final int UPDATE_ACTION = 3;
+	public static final int REFERENCES_ACTION = 4;
+	public static final int TRIGGER_ACTION = 5;
+	public static final int ACTION_COUNT = 6;
+
+	private static final String YES_WITH_GRANT_OPTION = "Y";
+	private static final String YES_WITHOUT_GRANT_OPTION = "y";
+	private static final String NO = "N";
+
+	private static final String[][] actionString =
+	{{"s", "S"}, {"d", "D"}, {"i", "I"}, {"u", "U"}, {"r", "R"}, {"t", "T"}};
+
+	private TableDescriptor td;
+	private boolean[] actionAllowed;
+	private FormatableBitSet[] columnBitSets;
+	
+	/**
+	 * @param actionAllowed actionAllowed[action] is true if action is in the privilege set.
+	 * @param columnNames columnNames[action] is the list of columns associated with the action, null if
+	 *					the privilege applies to all columns.
+	 */
+	public TablePrivilegeInfo( TableDescriptor td,
+							   boolean[] actionAllowed,
+							   FormatableBitSet[] columnBitSets)
+	{
+		this.actionAllowed = actionAllowed;
+		this.columnBitSets = columnBitSets;
+		this.td = td;
+	}
+	
+	/**
+	 *	This is the guts of the Execution-time logic for GRANT/REVOKE of a table privilege
+	 *
+	 * @param activation
+	 * @param grant true if grant, false if revoke
+	 * @param grantees a list of authorization ids (strings)
+	 *
+	 * @exception StandardException		Thrown on failure
+	 */
+	public void executeGrantRevoke( Activation activation,
+									boolean grant,
+									List grantees)
+		throws StandardException
+	{
+		LanguageConnectionContext lcc = activation.getLanguageConnectionContext();
+		DataDictionary dd = lcc.getDataDictionary();
+		String currentUser = lcc.getAuthorizationId();
+		TransactionController tc = lcc.getTransactionExecute();
+
+		// Check that the current user has permission to grant the privileges.
+		checkOwnership( currentUser, td, td.getSchemaDescriptor());
+		
+		DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
+
+		TablePermsDescriptor tablePermsDesc =
+		  ddg.newTablePermsDescriptor( td,
+									   getPermString( SELECT_ACTION, false),
+									   getPermString( DELETE_ACTION, false),
+									   getPermString( INSERT_ACTION, false),
+									   getPermString( UPDATE_ACTION, false),
+									   getPermString( REFERENCES_ACTION, false),
+									   getPermString( TRIGGER_ACTION, false),
+									   currentUser);
+			
+		ColPermsDescriptor[] colPermsDescs = new ColPermsDescriptor[ columnBitSets.length];
+		for( int i = 0; i < columnBitSets.length; i++)
+		{
+			if( columnBitSets[i] != null ||
+				// If it is a revoke and no column list is specified then revoke all column permissions.
+				// A null column bitSet in a ColPermsDescriptor indicates that all the column permissions
+				// should be removed.
+				(!grant) && hasColumnPermissions(i) && actionAllowed[i]
+				)
+			{
+				colPermsDescs[i] = ddg.newColPermsDescriptor( td,
+															  getActionString(i, false),
+															  columnBitSets[i],
+															  currentUser);
+			}
+		}
+
+
+		dd.startWriting(lcc);
+		// Add or remove the privileges to/from the SYS.SYSTABLEPERMS and SYS.SYSCOLPERMS tables
+		for( Iterator itr = grantees.iterator(); itr.hasNext();)
+		{
+			String grantee = (String) itr.next();
+			if( tablePermsDesc != null)
+				dd.addRemovePermissionsDescriptor( grant, tablePermsDesc, grantee, tc);
+			for( int i = 0; i < columnBitSets.length; i++)
+			{
+				if( colPermsDescs[i] != null)
+					dd.addRemovePermissionsDescriptor( grant, colPermsDescs[i], grantee, tc);
+			}
+		}
+	} // end of executeConstantAction
+
+	private String getPermString( int action, boolean forGrantOption)
+	{
+		if( actionAllowed[ action] && columnBitSets[action] == null)
+			return forGrantOption ? YES_WITH_GRANT_OPTION : YES_WITHOUT_GRANT_OPTION;
+		else
+			return NO;
+	} // end of getPermString
+
+	private String getActionString( int action, boolean forGrantOption)
+	{
+		return actionString[action][forGrantOption ? 1 : 0];
+	}
+
+	private boolean hasColumnPermissions( int action)
+	{
+		return action == SELECT_ACTION || action == UPDATE_ACTION || action == REFERENCES_ACTION;
+	}
+}

Propchange: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties?rev=356133&r1=356132&r2=356133&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties Sun Dec 11 19:57:33 2005
@@ -463,8 +463,8 @@
 42X43=The ResultSetMetaData returned for the class/object ''{0}'' was null. In order to use this class as an external virtual table, the ResultSetMetaData cannot be null. 
 42X44=Invalid length ''{0}'' in column specification.
 42X45={0} is an invalid type for argument number {1} of {2}.
-# 42X46=
-# 42X47=
+42X46=There are multiple functions named ''{0}''. Use a the full signature or the specific name.
+42X47=There are multiple procedures named ''{0}''. Use a the full signature or the specific name.
 42X48=Value ''{1}'' is not a valid precision for {0}.
 42X49=Value ''{0}'' is not a valid integer literal.
 42X50=No method was found that matched the method call {0}.{1}({2}), tried all combinations of object and primitive types and any possible type conversion for any  parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible.
@@ -675,6 +675,8 @@
 42Z57.U=Execution stopped after optimizing by StopAfterOptimizing debug flag.
 42Z58.U=Execution stopped after generating by StopAfterGenerating debug flag.
 
+42Z60={0} not allowed unless database property {1} has value ''{2}''.
+
 ## More RUNTIMESTATISTICS messages
 42Z80.U=serializable
 42Z81.U=read committed
@@ -1036,6 +1038,14 @@
 28502.C=The user name ''{0}'' is not valid. 
 28503=User(s) ''{0}'' must not be in both read-only and full-access authorization lists.
 28504=Repeated user(s) ''{1}'' in access list ''{0}'';
+28505=Internal Error: invalid {0} id in statement permission list.
+28506=User ''{0}'' does not have {1} permission on table ''{2}''.''{3}''.
+28507=User ''{0}'' does not have {1} permission on table ''{2}''.''{3}'' for grant.
+28508=User ''{0}'' does not have {1} permission on column ''{2}'' of table ''{3}''.''{4}''.
+28509=User ''{0}'' does not have {1} permission on column ''{2}'' of table ''{3}''.''{4}'' for grant.
+2850A=User ''{0}'' does not have execute permission on {1} ''{2}''.''{3}''.
+2850B=User ''{0}'' does not have execute permission on {1} ''{2}''.''{3}'' for grant.
+2850C=User ''{0}'' is not the owner of {1} ''{2}''.''{3}''.
 04501.C=Database connection refused.
 
 

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=356133&r1=356132&r2=356133&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 Sun Dec 11 19:57:33 2005
@@ -177,6 +177,7 @@
 TABLE_CAT[VARCHAR],TABLE_SCHEM[VARCHAR],TABLE_NAME[VARCHAR],TABLE_TYPE[VARCHAR],REMARKS[VARCHAR]
 ,SYS,SYSALIASES,SYSTEM TABLE,
 ,SYS,SYSCHECKS,SYSTEM TABLE,
+,SYS,SYSCOLPERMS,SYSTEM TABLE,
 ,SYS,SYSCOLUMNS,SYSTEM TABLE,
 ,SYS,SYSCONGLOMERATES,SYSTEM TABLE,
 ,SYS,SYSCONSTRAINTS,SYSTEM TABLE,
@@ -184,9 +185,12 @@
 ,SYS,SYSFILES,SYSTEM TABLE,
 ,SYS,SYSFOREIGNKEYS,SYSTEM TABLE,
 ,SYS,SYSKEYS,SYSTEM TABLE,
+,SYS,SYSREQUIREDPERM,SYSTEM TABLE,
+,SYS,SYSROUTINEPERMS,SYSTEM TABLE,
 ,SYS,SYSSCHEMAS,SYSTEM TABLE,
 ,SYS,SYSSTATEMENTS,SYSTEM TABLE,
 ,SYS,SYSSTATISTICS,SYSTEM TABLE,
+,SYS,SYSTABLEPERMS,SYSTEM TABLE,
 ,SYS,SYSTABLES,SYSTEM TABLE,
 ,SYS,SYSTRIGGERS,SYSTEM TABLE,
 ,SYS,SYSVIEWS,SYSTEM TABLE,
@@ -195,6 +199,7 @@
 TABLE_CAT[VARCHAR],TABLE_SCHEM[VARCHAR],TABLE_NAME[VARCHAR],TABLE_TYPE[VARCHAR],REMARKS[VARCHAR]
 ,SYS,SYSALIASES,SYSTEM TABLE,
 ,SYS,SYSCHECKS,SYSTEM TABLE,
+,SYS,SYSCOLPERMS,SYSTEM TABLE,
 ,SYS,SYSCOLUMNS,SYSTEM TABLE,
 ,SYS,SYSCONGLOMERATES,SYSTEM TABLE,
 ,SYS,SYSCONSTRAINTS,SYSTEM TABLE,
@@ -202,9 +207,12 @@
 ,SYS,SYSFILES,SYSTEM TABLE,
 ,SYS,SYSFOREIGNKEYS,SYSTEM TABLE,
 ,SYS,SYSKEYS,SYSTEM TABLE,
+,SYS,SYSREQUIREDPERM,SYSTEM TABLE,
+,SYS,SYSROUTINEPERMS,SYSTEM TABLE,
 ,SYS,SYSSCHEMAS,SYSTEM TABLE,
 ,SYS,SYSSTATEMENTS,SYSTEM TABLE,
 ,SYS,SYSSTATISTICS,SYSTEM TABLE,
+,SYS,SYSTABLEPERMS,SYSTEM TABLE,
 ,SYS,SYSTABLES,SYSTEM TABLE,
 ,SYS,SYSTRIGGERS,SYSTEM TABLE,
 ,SYS,SYSVIEWS,SYSTEM TABLE,

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=356133&r1=356132&r2=356133&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 Sun Dec 11 19:57:33 2005
@@ -207,6 +207,7 @@
 TABLE_CAT[VARCHAR],TABLE_SCHEM[VARCHAR],TABLE_NAME[VARCHAR],TABLE_TYPE[VARCHAR],REMARKS[VARCHAR]
 ,SYS,SYSALIASES,SYSTEM TABLE,
 ,SYS,SYSCHECKS,SYSTEM TABLE,
+,SYS,SYSCOLPERMS,SYSTEM TABLE,
 ,SYS,SYSCOLUMNS,SYSTEM TABLE,
 ,SYS,SYSCONGLOMERATES,SYSTEM TABLE,
 ,SYS,SYSCONSTRAINTS,SYSTEM TABLE,
@@ -214,9 +215,12 @@
 ,SYS,SYSFILES,SYSTEM TABLE,
 ,SYS,SYSFOREIGNKEYS,SYSTEM TABLE,
 ,SYS,SYSKEYS,SYSTEM TABLE,
+,SYS,SYSREQUIREDPERM,SYSTEM TABLE,
+,SYS,SYSROUTINEPERMS,SYSTEM TABLE,
 ,SYS,SYSSCHEMAS,SYSTEM TABLE,
 ,SYS,SYSSTATEMENTS,SYSTEM TABLE,
 ,SYS,SYSSTATISTICS,SYSTEM TABLE,
+,SYS,SYSTABLEPERMS,SYSTEM TABLE,
 ,SYS,SYSTABLES,SYSTEM TABLE,
 ,SYS,SYSTRIGGERS,SYSTEM TABLE,
 ,SYS,SYSVIEWS,SYSTEM TABLE,
@@ -225,6 +229,7 @@
 TABLE_CAT[VARCHAR],TABLE_SCHEM[VARCHAR],TABLE_NAME[VARCHAR],TABLE_TYPE[VARCHAR],REMARKS[VARCHAR]
 ,SYS,SYSALIASES,SYSTEM TABLE,
 ,SYS,SYSCHECKS,SYSTEM TABLE,
+,SYS,SYSCOLPERMS,SYSTEM TABLE,
 ,SYS,SYSCOLUMNS,SYSTEM TABLE,
 ,SYS,SYSCONGLOMERATES,SYSTEM TABLE,
 ,SYS,SYSCONSTRAINTS,SYSTEM TABLE,
@@ -232,9 +237,12 @@
 ,SYS,SYSFILES,SYSTEM TABLE,
 ,SYS,SYSFOREIGNKEYS,SYSTEM TABLE,
 ,SYS,SYSKEYS,SYSTEM TABLE,
+,SYS,SYSREQUIREDPERM,SYSTEM TABLE,
+,SYS,SYSROUTINEPERMS,SYSTEM TABLE,
 ,SYS,SYSSCHEMAS,SYSTEM TABLE,
 ,SYS,SYSSTATEMENTS,SYSTEM TABLE,
 ,SYS,SYSSTATISTICS,SYSTEM TABLE,
+,SYS,SYSTABLEPERMS,SYSTEM TABLE,
 ,SYS,SYSTABLES,SYSTEM TABLE,
 ,SYS,SYSTRIGGERS,SYSTEM TABLE,
 ,SYS,SYSVIEWS,SYSTEM TABLE,



Mime
View raw message