db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r792245 - in /db/derby/code/trunk/java: engine/org/apache/derby/catalog/ engine/org/apache/derby/iapi/services/io/ engine/org/apache/derby/iapi/sql/conn/ engine/org/apache/derby/iapi/sql/dictionary/ engine/org/apache/derby/impl/sql/catalog/...
Date Wed, 08 Jul 2009 17:57:27 GMT
Author: rhillegas
Date: Wed Jul  8 17:57:27 2009
New Revision: 792245

URL: http://svn.apache.org/viewvc?rev=792245&view=rev
Log:
DERBY-712: Commit Suran Jayathilaka's first increment of work for sequence generators: this patch adds two new system catalogs, SYSSEQUENCES and SYSPERMS.

Added:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PermDescriptor.java   (with props)
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SequenceDescriptor.java   (with props)
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSPERMSRowFactory.java   (with props)
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSSEQUENCESRowFactory.java   (with props)
Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/Dependable.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/Authorizer.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
    db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/compressTable.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DMDBugsTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AlterTableTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrimaryKeyTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SystemCatalogTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ViewsTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/Dependable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/Dependable.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/Dependable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/Dependable.java Wed Jul  8 17:57:27 2009
@@ -63,9 +63,11 @@
 	public static final String COLUMNS_PERMISSION           = "ColumnsPrivilege";
 	public static final String ROUTINE_PERMISSION           = "RoutinePrivilege";
 	public static final String ROLE_GRANT                   = "RoleGrant";
+    public static final String SEQUENCE                     = "Sequence";
+    public static final String PERM                         = "Perm";
 
 
-	/**
+    /**
 	  *	Get an object which can be written to disk and which,
 	  *	when read from disk, will find or reconstruct this in-memory
 	  * Dependable.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java Wed Jul  8 17:57:27 2009
@@ -610,6 +610,14 @@
      */
     static public final int COLUMN_DESCRIPTOR_FINDER_V01_ID =
             (MIN_ID_2 + 393);
+
+    /**
+    class org.apache.derby.impl.sql.catalog.SequenceDescriptorFinder
+     */
+    static public final int SEQUENCE_DESCRIPTOR_FINDER_V01_ID =
+            (MIN_ID_2 + 472);
+
+    static public final int PERM_DESCRIPTOR_FINDER_V01_ID = (MIN_ID_2 + 473);
         
     /******************************************************************
     **
@@ -1901,7 +1909,7 @@
      * Make sure this is updated when a new module is added
      */
     public static final int MAX_ID_2 =
-            (MIN_ID_2 + 471);
+            (MIN_ID_2 + 473);
 
     // DO NOT USE 4 BYTE IDS ANYMORE
     static public final int MAX_ID_4 =

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/Authorizer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/Authorizer.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/Authorizer.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/Authorizer.java Wed Jul  8 17:57:27 2009
@@ -57,7 +57,8 @@
 	public static final int DELETE_PRIV = 4;
 	public static final int TRIGGER_PRIV = 5;
 	public static final int EXECUTE_PRIV = 6;
-	public static final int PRIV_TYPE_COUNT = 7;
+	public static final int USAGE_PRIV = 7;
+    public static final int PRIV_TYPE_COUNT = 8;
 
 	/* Used to check who can create schemas or who can modify objects in schema */
 	public static final int CREATE_SCHEMA_PRIV = 16;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java Wed Jul  8 17:57:27 2009
@@ -29,6 +29,7 @@
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.services.io.FormatableBitSet;
 import org.apache.derby.iapi.services.uuid.UUIDFactory;
+import org.apache.derby.iapi.types.DataTypeDescriptor;
 
 /**
  * This is an implementation of the DataDescriptorGenerator interface
@@ -515,4 +516,53 @@
 									   withadminoption,
 									   isDef);
     }
+
+    /**
+     * Create a new sequence descriptor
+     * @param uuid
+     * @param sequenceName
+     * @return
+     */
+    public SequenceDescriptor newSequenceDescriptor(
+            SchemaDescriptor sd,
+            UUID uuid,
+            String sequenceName,
+            DataTypeDescriptor dataType,
+            long currentValue,
+            long startValue,
+            long minimumValue,
+            long maximumValue,
+            long increment,
+            boolean cycle) {
+        return new SequenceDescriptor(
+                dataDictionary,
+                sd,
+                uuid,
+                sequenceName,
+                dataType,
+                currentValue,
+                startValue,
+                minimumValue,
+                maximumValue,
+                increment,
+                cycle);
+    }
+
+    public PermDescriptor newPermDescriptor(
+            UUID uuid,
+            String objectType,
+            UUID permObjectId,
+            String permission,
+            String grantor,
+            String grantee,
+            boolean grantable) {
+        return new PermDescriptor(dataDictionary,
+                uuid,
+                objectType,
+                permObjectId,
+                permission,
+                grantor,
+                grantee,
+                grantable);
+    }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java Wed Jul  8 17:57:27 2009
@@ -189,8 +189,10 @@
 	public static final int SYSCOLPERMS_CATALOG_NUM = 17;
 	public static final int SYSROUTINEPERMS_CATALOG_NUM = 18;
     public static final int SYSROLES_CATALOG_NUM = 19;
+    public static final int SYSSEQUENCES_CATALOG_NUM = 20;
+    public static final int SYSPERMS_CATALOG_NUM = 21;
 
-	/* static finals for constraints 
+    /* static finals for constraints
 	 * (Here because they are needed by parser, compilation and execution.)
 	 */
 	public static final int NOTNULL_CONSTRAINT = 1;
@@ -1981,5 +1983,67 @@
 	 * @throws StandardException
 	 */
 	public void updateMetadataSPSes(TransactionController tc) throws StandardException;
-	
+
+    /**
+     * Drop a sequence descriptor.
+     * @param sequenceDescriptor
+     * @param tc
+     */
+    public void dropSequenceDescriptor(SequenceDescriptor sequenceDescriptor, TransactionController tc) throws StandardException;
+
+    /**
+     * get a descriptor for a Sequence by uuid
+     * @param uuid uuid of the sequence
+     * @return the SequenceDescriptor
+     * @throws StandardException error
+     */
+    public SequenceDescriptor getSequenceDescriptor(UUID uuid) throws StandardException;
+
+    /**
+     * get a descriptor for a Sequence by sequence name
+     * @param sequenceName Name of the sequence
+     * @param sd The scemadescriptor teh sequence belongs to
+     * @return The SequenceDescriptor
+     * @throws StandardException error
+     */
+    public SequenceDescriptor getSequenceDescriptor(SchemaDescriptor sd, String sequenceName)
+            throws StandardException;
+
+    /**
+     * Get permissions granted to one user for an object using the object's Id
+     * and the user's authorization Id.
+     *
+     * @param objectUUID
+     *
+     * @return The descriptor of the permissions for the object
+     *
+     * @exception StandardException
+     */
+    public PermDescriptor getPermissions(UUID objectUUID, String granteeAuthId)
+        throws StandardException;
+
+    /**
+     * Get one user's privileges for an object using the permUUID
+     *
+     * @param permUUID
+     *
+     * @return a PermDescriptor
+     *
+     * @exception StandardException
+     */
+    public PermDescriptor getPermissions(UUID permUUID)
+    throws StandardException;
+
+    /**
+     * Drops all permission descriptors for the given object
+     *
+     * @param objectID The UUID of the object from which to drop
+     *                  all permissions
+     * @param tc        TransactionController for the transaction
+     * @throws StandardException Thrown on error
+     */
+    public void dropAllPermDescriptors(UUID objectID, TransactionController tc)
+            throws StandardException;
+
+
 }

Added: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PermDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PermDescriptor.java?rev=792245&view=auto
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PermDescriptor.java (added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PermDescriptor.java Wed Jul  8 17:57:27 2009
@@ -0,0 +1,168 @@
+/*
+
+   Derby - Class org.apache.derby.iapi.sql.dictionary.SequenceDescriptor
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to you 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.iapi.sql.dictionary;
+
+import org.apache.derby.catalog.UUID;
+import org.apache.derby.catalog.DependableFinder;
+import org.apache.derby.catalog.Dependable;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.services.io.StoredFormatIds;
+import org.apache.derby.iapi.sql.depend.Provider;
+import org.apache.derby.impl.sql.catalog.DDdependableFinder;
+
+/**
+ * This class describes rows in the SYS.SYSPERMS system table, which keeps track of the
+ * permissions that have been granted but not revoked.
+ */
+public class PermDescriptor extends PermissionsDescriptor
+        implements Provider {
+    private String objectType;
+    private UUID permObjectId;
+    private String permission;
+    private boolean grantable;
+
+    /**
+     * Constructor
+     *
+     * @param dataDictionary data dictionary
+     * @param permUUID       unique identification in time and space of this perm
+     *                       descriptor
+     */
+
+    public PermDescriptor(DataDictionary dataDictionary, UUID permUUID, String objectType,
+                          UUID permObjectId, String permission, String grantor,
+                          String grantee, boolean isGrantable) {
+        super(dataDictionary, grantee, grantor);
+        setUUID(permUUID);
+        this.objectType = objectType;
+        this.permObjectId = permObjectId;
+        this.permission = permission;
+        this.grantable = isGrantable;
+    }
+
+    public PermDescriptor(DataDictionary dd, UUID permUUID)
+            throws StandardException {
+        /*
+    TODO When merging all permisions catalogs to this master catalog at a future date,
+    this pattern which uses a partially initialised key descriptor should be cleaned up.
+     */
+        this(dd, permUUID, null, null, null, null, null, false);
+    }
+
+    public String getObjectType() {
+        return objectType;
+    }
+
+    public UUID getPermObjectId() {
+        return permObjectId;
+    }
+
+    public String getPermission() {
+        return permission;
+    }
+
+    public boolean isGrantable() {
+        return grantable;
+    }
+
+    public int getCatalogNumber() {
+        return DataDictionary.SYSPERMS_CATALOG_NUM;
+    }
+
+    public String toString() {
+        if (SanityManager.DEBUG) {
+            return "permUUID: " + oid + "\n" +
+                    "objectType: " + objectType + "\n" +
+                    "permObjectId: " + permObjectId + "\n" +
+                    "permission: " + permission + "\n" +
+                    "grantable: " + grantable + "\n";
+        } else {
+            return "";
+        }
+    }
+
+    /**
+     * @return true iff the key part of this perm descriptor equals the key part of another perm
+     *         descriptor.
+     */
+    public boolean equals(Object other) {
+        if (!(other instanceof PermDescriptor))
+            return false;
+        PermDescriptor otherPerm = (PermDescriptor) other;
+        return super.keyEquals(otherPerm) &&
+                oid.equals(otherPerm.oid);
+    }
+
+    /**
+     * @return the hashCode for the key part of this permissions descriptor
+     */
+    public int hashCode() {
+        return super.keyHashCode() + oid.hashCode();
+    }
+
+    /**
+     * @see PermissionsDescriptor#checkOwner
+     */
+    public boolean checkOwner(String authorizationId) throws StandardException {
+        UUID sd = getDataDictionary().getAliasDescriptor(oid).getSchemaUUID();
+        if (getDataDictionary().getSchemaDescriptor(sd, null).getAuthorizationId()
+                .equals(authorizationId)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    //////////////////////////////////////////////
+    //
+    // PROVIDER INTERFACE
+    //
+    //////////////////////////////////////////////
+
+    /**
+     * Return the name of this Provider.  (Useful for errors.)
+     *
+     * @return String   The name of this provider.
+     */
+    public String getObjectName() {
+        return permission + "privilege on " + objectType;
+    }
+
+    /**
+     * Get the provider's type.
+     *
+     * @return char         The provider's type.
+     */
+    public String getClassType() {
+        return Dependable.PERM;
+    }
+
+    /**
+     * @return the stored form of this provider
+     * @see Dependable#getDependableFinder
+     */
+    public DependableFinder getDependableFinder() {
+        return new DDdependableFinder(StoredFormatIds.PERM_DESCRIPTOR_FINDER_V01_ID);
+    }
+
+}

Propchange: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PermDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SequenceDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SequenceDescriptor.java?rev=792245&view=auto
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SequenceDescriptor.java (added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SequenceDescriptor.java Wed Jul  8 17:57:27 2009
@@ -0,0 +1,209 @@
+/*
+
+   Derby - Class org.apache.derby.iapi.sql.dictionary.SequenceDescriptor
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to you 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.iapi.sql.dictionary;
+
+import org.apache.derby.catalog.UUID;
+import org.apache.derby.catalog.DependableFinder;
+import org.apache.derby.catalog.Dependable;
+import org.apache.derby.catalog.TypeDescriptor;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.services.io.StoredFormatIds;
+import org.apache.derby.iapi.sql.depend.Provider;
+import org.apache.derby.iapi.types.DataTypeDescriptor;
+import org.apache.derby.impl.sql.catalog.DDdependableFinder;
+
+/**
+ * This class is used by rows in the SYS.SYSSEQUENCES system table.
+ */
+public class SequenceDescriptor extends TupleDescriptor
+        implements Provider, UniqueSQLObjectDescriptor {
+
+    private UUID sequenceUUID;
+    private String sequenceName;
+    private final SchemaDescriptor schemaDescriptor;
+    private UUID schemaId;
+    private DataTypeDescriptor dataType;
+    private long currentValue;
+    private long startValue;
+    private long minimumValue;
+    private long maximumValue;
+    private long increment;
+    private boolean cycle;
+
+    /**
+     * Constructor
+     *
+     * @param dataDictionary data dictionary
+     * @param sequenceUUID   unique identification in time and space of this sequence
+     *                       descriptor
+     * @param sequenceName
+     */
+
+    public SequenceDescriptor(DataDictionary dataDictionary, SchemaDescriptor sd, UUID sequenceUUID, String sequenceName,
+                              DataTypeDescriptor dataType, long currentValue,
+                              long startValue, long minimumValue, long maximumValue, long increment, boolean cycle) {
+        super(dataDictionary);
+        if (SanityManager.DEBUG) {
+            if (sd.getSchemaName() == null) {
+                SanityManager.THROWASSERT("new SequenceDescriptor() schema " +
+                        "name is null for Sequence " + sequenceName);
+            }
+        }
+        this.sequenceUUID = sequenceUUID;
+        this.schemaDescriptor = sd;
+        this.sequenceName = sequenceName;
+        this.schemaId = sd.getUUID();
+        this.dataType = dataType;
+        this.currentValue = currentValue;
+        this.startValue = startValue;
+        this.minimumValue = minimumValue;
+        this.maximumValue = maximumValue;
+        this.increment = increment;
+        this.cycle = cycle;
+    }
+
+   /**
+	 * @see UniqueTupleDescriptor#getUUID
+	 */
+	public UUID	getUUID()
+	{
+		return sequenceUUID;
+	}
+
+    public String toString() {
+        if (SanityManager.DEBUG) {
+            return "sequenceUUID: " + sequenceUUID + "\n" +
+                    "sequenceName: " + sequenceName + "\n" +
+                    "schemaId: " + schemaId + "\n" +
+                    "dataType: " + dataType.getTypeName() + "\n" +
+                    "currentValue: " + currentValue + "\n" +
+                    "startValue: " + startValue + "\n" +
+                    "minimumValue: " + minimumValue + "\n" +
+                    "maximumValue: " + maximumValue + "\n" +
+                    "increment: " + increment + "\n" +
+                    "cycle: " + cycle + "\n";
+        } else {
+            return "";
+        }
+    }
+
+    public String getName() {
+        return sequenceName;
+    }
+
+    public SchemaDescriptor getSchemaDescriptor() throws StandardException {
+        return schemaDescriptor;
+    }
+
+    //////////////////////////////////////////////
+    //
+    // PROVIDER INTERFACE
+    //
+    //////////////////////////////////////////////
+
+    /**
+     * Get the provider's UUID
+     *
+     * @return The provider's UUID
+     */
+    public UUID getObjectID() {
+        return sequenceUUID;
+    }
+
+    /**
+     * Is this provider persistent?  A stored dependency will be required
+     * if both the dependent and provider are persistent.
+     *
+     * @return boolean              Whether or not this provider is persistent.
+     */
+    public boolean isPersistent() {
+        return true;
+    }
+
+    /**
+     * Return the name of this Provider.  (Useful for errors.)
+     *
+     * @return String   The name of this provider.
+     */
+    public String getObjectName() {
+        return (sequenceName);
+    }
+
+    /**
+     * Get the provider's type.
+     *
+     * @return char         The provider's type.
+     */
+    public String getClassType() {
+        return Dependable.SEQUENCE;
+    }
+
+    /**
+     * @return the stored form of this provider
+     * @see Dependable#getDependableFinder
+     */
+    public DependableFinder getDependableFinder() {
+        return new DDdependableFinder(StoredFormatIds.SEQUENCE_DESCRIPTOR_FINDER_V01_ID);
+    }
+
+    /*Accessor methods*/
+    public String getSequenceName() {
+        return sequenceName;
+    }
+
+    public UUID getSequenceUUID() {
+        return sequenceUUID;
+    }
+
+    public UUID getSchemaId() {
+        return schemaId;
+    }
+
+    public DataTypeDescriptor getDataType() {
+        return dataType;
+    }
+
+    public long getCurrentValue() {
+        return currentValue;
+    }
+
+    public long getStartValue() {
+        return startValue;
+    }
+
+    public long getMinimumValue() {
+        return minimumValue;
+    }
+
+    public long getMaximumValue() {
+        return maximumValue;
+    }
+
+    public long getIncrement() {
+        return increment;
+    }
+
+    public boolean isCycle() {
+        return cycle;
+    }
+}

Propchange: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/SequenceDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java Wed Jul  8 17:57:27 2009
@@ -407,6 +407,13 @@
             // added in 10.6.
             bootingDictionary.create_10_6_system_procedures(tc,
                     newlyCreatedRoutines);
+            
+            // On upgrade from versions before 10.6, create system catalogs
+            // added in 10.6
+            bootingDictionary.upgradeMakeCatalog(
+                    tc, DataDictionary.SYSSEQUENCES_CATALOG_NUM);
+            bootingDictionary.upgradeMakeCatalog(
+                    tc, DataDictionary.SYSPERMS_CATALOG_NUM);
         }
 
         if (fromMajorVersionNumber <= DataDictionary.DD_VERSION_DERBY_10_1)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=792245&r1=792244&r2=792245&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 Wed Jul  8 17:57:27 2009
@@ -65,6 +65,8 @@
 import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ViewDescriptor;
 import org.apache.derby.iapi.sql.dictionary.SystemColumn;
+import org.apache.derby.iapi.sql.dictionary.SequenceDescriptor;
+import org.apache.derby.iapi.sql.dictionary.PermDescriptor;
 
 import org.apache.derby.iapi.sql.depend.DependencyManager;
 
@@ -297,8 +299,10 @@
                                     "SYSTABLEPERMS",
                                     "SYSCOLPERMS",
                                     "SYSROUTINEPERMS",
-									"SYSROLES"
-									};
+									"SYSROLES",
+                                    "SYSSEQUENCES",
+                                    "SYSPERMS"
+                                    };
 
 	private	static final int		NUM_NONCORE = nonCoreNames.length;
 
@@ -2234,7 +2238,20 @@
 			return false;
 		}
 
-		return true;
+        // This catalog was added in 10.6. Don't look for this catalog if we
+        // have soft-upgraded from an older release.
+        if( dictionaryVersion.majorVersionNumber >= DataDictionary.DD_VERSION_DERBY_10_6)
+        {
+            if (isSchemaReferenced(tc, getNonCoreTI(SYSSEQUENCES_CATALOG_NUM),
+                                   SYSSEQUENCESRowFactory.SYSSEQUENCES_INDEX2_ID,
+                                   2,
+                                   schemaIdOrderable))
+            {
+                return false;
+            }
+        }
+
+        return true;
 	}
 
 	/**
@@ -8926,7 +8943,19 @@
 											 luuidFactory, exFactory, dvf));
 
 				break;
-			}
+
+              case SYSSEQUENCES_CATALOG_NUM:
+				retval = new TabInfoImpl(new SYSSEQUENCESRowFactory(
+											 luuidFactory, exFactory, dvf));
+
+				break;
+
+              case SYSPERMS_CATALOG_NUM:
+				retval = new TabInfoImpl(new SYSPERMSRowFactory(
+											 luuidFactory, exFactory, dvf));
+
+				break;            
+            }
 
 			initSystemIndexVariables(retval);
 
@@ -12644,4 +12673,172 @@
 		createSystemSps(tc);		
 	}
 
+    /**
+     * Drops a sequence descriptor
+     *
+     * @param descriptor The descriptor to drop
+     * @param tc         The TransactionController.
+     * @throws StandardException Thrown on failure
+     */
+    public void dropSequenceDescriptor(SequenceDescriptor descriptor, TransactionController tc)
+            throws StandardException {
+        DataValueDescriptor sequenceIdOrderable;
+        TabInfoImpl ti = getNonCoreTI(SYSSEQUENCES_CATALOG_NUM);
+
+        sequenceIdOrderable = getIDValueAsCHAR(descriptor.getUUID());
+
+        /* Set up the start/stop position for the scan */
+        ExecIndexRow keyRow = (ExecIndexRow) exFactory.getIndexableRow(1);
+        keyRow.setColumn(1, sequenceIdOrderable);
+
+        ti.deleteRow(tc, keyRow, SYSSEQUENCESRowFactory.SYSSEQUENCES_INDEX1_ID);
+    }
+
+    public SequenceDescriptor getSequenceDescriptor(UUID uuid) throws StandardException {
+        DataValueDescriptor UUIDStringOrderable;
+
+        TabInfoImpl ti = getNonCoreTI(SYSSEQUENCES_CATALOG_NUM);
+
+        /* Use UUIDStringOrderable in both start and stop position for
+           * scan.
+           */
+        UUIDStringOrderable = getIDValueAsCHAR(uuid);
+
+        /* Set up the start/stop position for the scan */
+        ExecIndexRow keyRow = exFactory.getIndexableRow(1);
+        keyRow.setColumn(1, UUIDStringOrderable);
+
+        return (SequenceDescriptor)
+                getDescriptorViaIndex(
+                        SYSSEQUENCESRowFactory.SYSSEQUENCES_INDEX1_ID,
+                        keyRow,
+                        (ScanQualifier[][]) null,
+                        ti,
+                        (TupleDescriptor) null,
+                        (List) null,
+                        false);
+    }
+
+    /**
+     * Get the sequence descriptor given a sequence name and a schema Id.
+     *
+     * @param sequenceName The sequence name, guaranteed to be unique only within its schema.
+     * @param sd           The schema descriptor.
+     * @return The SequenceDescriptor for the constraints.
+     * @throws StandardException Thrown on failure
+     */
+    public SequenceDescriptor getSequenceDescriptor(SchemaDescriptor sd, String sequenceName)
+            throws StandardException {
+        DataValueDescriptor schemaIDOrderable;
+        DataValueDescriptor sequenceNameOrderable;
+        TabInfoImpl ti = getNonCoreTI(SYSSEQUENCES_CATALOG_NUM);
+
+        /* Use sequenceNameOrderable and schemaIdOrderable in both start
+           * and stop position for scan.
+           */
+        sequenceNameOrderable = new SQLVarchar(sequenceName);
+        schemaIDOrderable = getIDValueAsCHAR(sd.getUUID());
+
+        /* Set up the start/stop position for the scan */
+        ExecIndexRow keyRow = exFactory.getIndexableRow(2);
+        keyRow.setColumn(1, schemaIDOrderable);
+        keyRow.setColumn(2, sequenceNameOrderable);
+
+        return (SequenceDescriptor)
+                getDescriptorViaIndex(
+                        SYSSEQUENCESRowFactory.SYSSEQUENCES_INDEX2_ID,
+                        keyRow,
+                        (ScanQualifier[][]) null,
+                        ti,
+                        (TupleDescriptor) null,
+                        (List) null,
+                        false);
+    }
+
+    /**
+     * Get an object's permission descriptor from the system tables, without going through the cache.
+     * This method is called to fill the permissions cache.
+     *
+     * @return a PermDescriptor that describes the table permissions granted to the grantee on an objcet
+     * , null if no table-level permissions have been granted to him on the table.
+     * @throws StandardException
+     */
+    PermDescriptor getUncachedPermDescriptor(PermDescriptor key)
+            throws StandardException {
+
+        return (PermDescriptor)
+                getUncachedPermissionsDescriptor(SYSPERMS_CATALOG_NUM,
+                        SYSPERMSRowFactory.PERMS_UUID_IDX_NUM, key);
+
+
+    } // end of getUncachedPermDescriptor
+
+    /**
+     * Get permissions granted to one user for an object using the object's Id
+     * and the user's authorization Id.
+     *
+     * @param objectUUID
+     *
+     * @return The descriptor of the permissions for the object
+     *
+     * @exception StandardException
+     */
+    public PermDescriptor getPermissions(UUID objectUUID, String granteeAuthId)
+        throws StandardException {
+        PermDescriptor key = new PermDescriptor(this, null, null, objectUUID, null, null, granteeAuthId, false);
+        return getUncachedPermDescriptor(key);
+    }
+
+    /**
+     * Get one user's privileges for an object using the permUUID.
+     *
+     * @param permUUID
+     * @return The descriptor of the user's permissions for the object.
+     * @throws StandardException
+     */
+    public PermDescriptor getPermissions(UUID permUUID)
+            throws StandardException {
+        PermDescriptor key = new PermDescriptor(this, permUUID);
+        return getUncachedPermDescriptor(key);
+    }
+
+    /**
+     * Drops all permission descriptors for the object whose Id is given.
+     *
+     * @param objectID The UUID of the object from which to drop
+     *                 all the permission descriptors
+     * @param tc       TransactionController for the transaction
+     * @throws StandardException Thrown on error
+     */
+    public void dropAllPermDescriptors(UUID objectID, TransactionController tc)
+            throws StandardException {
+        TabInfoImpl ti = getNonCoreTI(SYSPERMS_CATALOG_NUM);
+        SYSPERMSRowFactory rf = (SYSPERMSRowFactory) ti.getCatalogRowFactory();
+        DataValueDescriptor objIdOrderable;
+        ExecRow curRow;
+        PermissionsDescriptor perm;
+
+        // In Derby authorization mode, permission catalogs may not be present
+        if (!usesSqlAuthorization)
+            return;
+
+        /* Use objIDOrderable in both start and stop position for scan. */
+        objIdOrderable = getIDValueAsCHAR(objectID);
+
+        /* Set up the start/stop position for the scan */
+        ExecIndexRow keyRow = exFactory.getIndexableRow(1);
+        keyRow.setColumn(1, objIdOrderable);
+
+        while ((curRow = ti.getRow(tc, keyRow, rf.PERMS_OBJECTID_IDX_NUM)) != null) {
+            perm = (PermDescriptor) rf.buildDescriptor(curRow, (TupleDescriptor) null, this);
+            removePermEntryInCache(perm);
+
+            // Build new key based on UUID and drop the entry as we want to drop
+            // only this row
+            ExecIndexRow uuidKey;
+            uuidKey = rf.buildIndexKeyRow(rf.PERMS_UUID_IDX_NUM, perm);
+            ti.deleteRow(tc, uuidKey, rf.PERMS_UUID_IDX_NUM);
+        }
+    }
 }
+

Added: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSPERMSRowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSPERMSRowFactory.java?rev=792245&view=auto
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSPERMSRowFactory.java (added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSPERMSRowFactory.java Wed Jul  8 17:57:27 2009
@@ -0,0 +1,310 @@
+/*
+
+   Derby - Class org.apache.derby.impl.sql.catalog.SYSPERMSRowFactory
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to you 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.catalog;
+
+import org.apache.derby.catalog.UUID;
+import org.apache.derby.iapi.types.SQLChar;
+import org.apache.derby.iapi.types.SQLVarchar;
+import org.apache.derby.iapi.types.DataValueDescriptor;
+import org.apache.derby.iapi.types.DataValueFactory;
+import org.apache.derby.iapi.sql.execute.ExecutionFactory;
+import org.apache.derby.iapi.sql.execute.ExecRow;
+import org.apache.derby.iapi.sql.execute.ExecIndexRow;
+import org.apache.derby.iapi.sql.dictionary.PermissionsDescriptor;
+import org.apache.derby.iapi.sql.dictionary.TupleDescriptor;
+import org.apache.derby.iapi.sql.dictionary.PermDescriptor;
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;
+import org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator;
+import org.apache.derby.iapi.sql.dictionary.SystemColumn;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.services.uuid.UUIDFactory;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+
+import java.sql.Types;
+
+/**
+ * Factory for creating a SYSPERMS row.
+ */
+
+public class SYSPERMSRowFactory extends PermissionsCatalogRowFactory {
+    private static final String TABLENAME_STRING = "SYSPERMS";
+
+    private static final int SYSPERMS_COLUMN_COUNT = 7;
+    /* Column #s for sysinfo (1 based) */
+    private static final int SYSPERMS_PERMISSIONID = 1;
+    private static final int SYSPERMS_OBJECTTYPE = 2;
+    private static final int SYSPERMS_OBJECTID = 3;
+    private static final int SYSPERMS_PERMISSION = 4;
+    private static final int SYSPERMS_GRANTOR = 5;
+    private static final int SYSPERMS_GRANTEE = 6;
+    private static final int SYSPERMS_IS_GRANTABLE = 7;
+
+    private static final int[][] indexColumnPositions =
+            {
+                    {SYSPERMS_PERMISSIONID},
+                    {SYSPERMS_OBJECTID}
+            };
+
+    // UUID
+    static final int PERMS_UUID_IDX_NUM = 0;
+
+    // object Id
+    public static final int PERMS_OBJECTID_IDX_NUM = 1;
+
+    private static final boolean[] uniqueness = { true, false };
+
+    private static final String[] uuids = {
+            "9810800c-0121-c5e1-a2f5-00000043e718", // catalog UUID
+            "6ea6ffac-0121-c5e3-f286-00000043e718", // heap UUID
+            "5cc556fc-0121-c5e6-4e43-00000043e718",  // uuid index
+            "7a92cf84-0122-51e6-2c5e-00000047b548"   // object id index
+    };
+
+
+
+    /**
+     * Constructor
+     *
+     * @param uuidf UUIDFactory
+     * @param ef    ExecutionFactory
+     * @param dvf   DataValueFactory
+     */
+    SYSPERMSRowFactory(UUIDFactory uuidf,
+                       ExecutionFactory ef,
+                       DataValueFactory dvf) {
+        super(uuidf, ef, dvf);
+        initInfo(SYSPERMS_COLUMN_COUNT, TABLENAME_STRING,
+                indexColumnPositions, uniqueness, uuids);
+    }
+
+    /**
+     * builds an index key row given for a given index number.
+     */
+    public ExecIndexRow buildIndexKeyRow(int indexNumber,
+                                         PermissionsDescriptor perm)
+            throws StandardException {
+        ExecIndexRow row = null;
+
+        switch (indexNumber) {
+            case PERMS_UUID_IDX_NUM:
+                row = getExecutionFactory().getIndexableRow(1);
+                String permUUIDStr = ((PermDescriptor) perm).getUUID().toString();
+                row.setColumn(1, new SQLChar(permUUIDStr));
+                break;
+        }
+        return row;
+    } // end of buildIndexKeyRow
+
+    /**
+     * Or a set of permissions in with a row from this catalog table
+     *
+     * @param row         an existing row
+     * @param perm        a permission descriptor of the appropriate class for this PermissionsCatalogRowFactory class.
+     * @param colsChanged An array with one element for each column in row. It is updated to
+     *                    indicate which columns in row were changed
+     * @return The number of columns that were changed.
+     * @throws StandardException standard error policy
+     */
+    public int orPermissions(ExecRow row, PermissionsDescriptor perm, boolean[] colsChanged)
+            throws StandardException {
+        return 0;
+    }
+
+    /**
+     * Remove a set of permissions from a row from this catalog table
+     *
+     * @param row         an existing row
+     * @param perm        a permission descriptor of the appropriate class for this PermissionsCatalogRowFactory class.
+     * @param colsChanged An array with one element for each column in row. It is updated to
+     *                    indicate which columns in row were changed
+     * @return -1 if there are no permissions left in the row, otherwise the number of columns that were changed.
+     * @throws StandardException standard error policy
+     */
+    public int removePermissions(ExecRow row, PermissionsDescriptor perm, boolean[] colsChanged)
+            throws StandardException {
+        return -1; // There is only one kind of routine privilege so delete the whole row.
+    } // end of removePermissions
+
+    void setUUIDOfThePassedDescriptor(ExecRow row, PermissionsDescriptor perm) throws StandardException {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    /**
+     * Make a SYSPERMS row
+     *
+     * @param td     a permission descriptor
+     * @param parent unused
+     * @return Row suitable for inserting into SYSPERMS.
+     * @throws org.apache.derby.iapi.error.StandardException
+     *          thrown on failure
+     */
+    public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent)
+            throws StandardException {
+        ExecRow row;
+        String permIdString = null;
+        String objectType = "SEQUENCE";
+        String objectIdString = null;
+        String permission = "USAGE";
+        String grantor = null;
+        String grantee = null;
+        boolean grantable = false;
+
+
+        if (td != null) {
+            PermDescriptor sd = (PermDescriptor) td;
+            UUID pid = sd.getUUID();
+            permIdString = pid.toString();
+
+            objectType = sd.getObjectType();
+
+            UUID oid = sd.getPermObjectId();
+            objectIdString = oid.toString();
+
+            permission = sd.getPermission();
+            grantor = sd.getGrantor();
+            grantee = sd.getGrantee();
+            grantable = sd.isGrantable();
+        }
+
+        /* Build the row to insert */
+        row = getExecutionFactory().getValueRow(SYSPERMS_COLUMN_COUNT);
+
+        /* 1st column is UUID */
+        row.setColumn(1, new SQLChar(permIdString));
+
+        /* 2nd column is OBJECTTYPE */
+        row.setColumn(2, new SQLVarchar(objectType));
+
+        /* 3rd column is OBJECTID */
+        row.setColumn(3, new SQLChar(objectIdString));
+
+        /* 4nd column is OBJECTTYPE */
+        row.setColumn(4, new SQLChar(permission));
+
+        /* 5nd column is GRANTOR */
+        row.setColumn(5, new SQLVarchar(grantor));
+
+        /* 6nd column is GRANTEE */
+        row.setColumn(6, new SQLVarchar(grantee));
+
+        /* 7nd column is IS_GRANTABLE */
+        row.setColumn(7, new SQLChar(grantable ? "Y" : "N"));
+
+        return row;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    //  ABSTRACT METHODS TO BE IMPLEMENTED BY CHILDREN OF CatalogRowFactory
+    //
+    ///////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Make an  Tuple Descriptor out of a SYSPERMS row
+     *
+     * @param row                   a SYSPERMS row
+     * @param parentTupleDescriptor unused
+     * @param dd                    dataDictionary
+     * @return a  descriptor equivalent to a SYSPERMS row
+     * @throws org.apache.derby.iapi.error.StandardException
+     *          thrown on failure
+     */
+    public TupleDescriptor buildDescriptor
+            (ExecRow row,
+             TupleDescriptor parentTupleDescriptor,
+             DataDictionary dd)
+            throws StandardException {
+
+        DataValueDescriptor col;
+        PermDescriptor descriptor;
+        String permIdString;
+        String objectType;
+        String objectIdString;
+        String permission;
+        String grantor;
+        String grantee;
+        String isGrantable;
+
+        DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
+
+        if (SanityManager.DEBUG) {
+            SanityManager.ASSERT(row.nColumns() == SYSPERMS_COLUMN_COUNT,
+                    "Wrong number of columns for a SYSPERMS row");
+        }
+
+        // first column is uuid of this permission descriptor (char(36))
+        col = row.getColumn(SYSPERMS_PERMISSIONID);
+        permIdString = col.getString();
+
+        // second column is objectType (varchar(36))
+        col = row.getColumn(SYSPERMS_OBJECTTYPE);
+        objectType = col.getString();
+
+        // third column is objectid (varchar(36))
+        col = row.getColumn(SYSPERMS_OBJECTID);
+        objectIdString = col.getString();
+
+        // fourth column is permission (varchar(128))
+        col = row.getColumn(SYSPERMS_PERMISSION);
+        permission = col.getString();
+
+        // fifth column is grantor auth Id (varchar(128))
+        col = row.getColumn(SYSPERMS_GRANTOR);
+        grantor = col.getString();
+
+        // sixth column is grantee auth Id (varchar(128))
+        col = row.getColumn(SYSPERMS_GRANTEE);
+        grantee = col.getString();
+
+        // seventh column is isGrantable (char(1))
+        col = row.getColumn(SYSPERMS_IS_GRANTABLE);
+        isGrantable = col.getString();
+
+        descriptor = ddg.newPermDescriptor
+                (getUUIDFactory().recreateUUID(permIdString),
+                        objectType,
+                        getUUIDFactory().recreateUUID(objectIdString),
+                        permission,
+                        grantor,
+                        grantee,
+                        isGrantable.equals("Y") ? true : false);
+
+        return descriptor;
+    }
+
+    /**
+     * Builds a list of columns suitable for creating this Catalog.
+     *
+     * @return array of SystemColumn suitable for making this catalog.
+     */
+    public SystemColumn[] buildColumnList() {
+        return new SystemColumn[]{
+                SystemColumnImpl.getUUIDColumn("UUID", false),
+                SystemColumnImpl.getColumn("OBJECTTYPE", Types.VARCHAR, false, 36),
+                SystemColumnImpl.getUUIDColumn("OBJECTID", false),
+                SystemColumnImpl.getColumn("PERMISSION", Types.CHAR, false, 36),
+                SystemColumnImpl.getIdentifierColumn("GRANTOR", false),
+                SystemColumnImpl.getIdentifierColumn("GRANTEE", false),
+                SystemColumnImpl.getIndicatorColumn("ISGRANTABLE")
+        };
+    }
+}

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

Added: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSSEQUENCESRowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSSEQUENCESRowFactory.java?rev=792245&view=auto
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSSEQUENCESRowFactory.java (added)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSSEQUENCESRowFactory.java Wed Jul  8 17:57:27 2009
@@ -0,0 +1,293 @@
+/*
+
+   Derby - Class org.apache.derby.impl.sql.catalog.SYSSEQUENCESRowFactory
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to you 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.catalog;
+
+import org.apache.derby.catalog.UUID;
+import org.apache.derby.catalog.TypeDescriptor;
+import org.apache.derby.iapi.sql.execute.ExecutionFactory;
+import org.apache.derby.iapi.sql.execute.ExecRow;
+import org.apache.derby.iapi.sql.dictionary.CatalogRowFactory;
+import org.apache.derby.iapi.sql.dictionary.TupleDescriptor;
+import org.apache.derby.iapi.sql.dictionary.SystemColumn;
+import org.apache.derby.iapi.sql.dictionary.SequenceDescriptor;
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;
+import org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.services.uuid.UUIDFactory;
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.types.DataValueFactory;
+import org.apache.derby.iapi.types.DataValueDescriptor;
+import org.apache.derby.iapi.types.SQLChar;
+import org.apache.derby.iapi.types.SQLVarchar;
+import org.apache.derby.iapi.types.UserType;
+import org.apache.derby.iapi.types.SQLLongint;
+import org.apache.derby.iapi.types.DataTypeDescriptor;
+
+import java.sql.Types;
+
+/**
+ * Factory for creating a SYSSEQUENCES row.
+ */
+
+public class SYSSEQUENCESRowFactory extends CatalogRowFactory {
+
+    private static final String TABLENAME_STRING = "SYSSEQUENCES";
+
+    private static final int SYSSEQUENCES_COLUMN_COUNT = 10;
+    /* Column #s for sysinfo (1 based) */
+    private static final int SYSSEQUENCES_SEQUENCEID = 1;
+    private static final int SYSSEQUENCES_SEQUENCENAME = 2;
+    private static final int SYSSEQUENCES_SCHEMAID = 3;
+    private static final int SYSSEQUENCES_SEQUENCEDATATYPE = 4;
+    private static final int SYSSEQUENCES_CURRENT_VALUE = 5;
+    private static final int SYSSEQUENCES_START_VALUE = 6;
+    private static final int SYSSEQUENCES_MINIMUM_VALUE = 7;
+    private static final int SYSSEQUENCES_MAXIMUM_VALUE = 8;
+    private static final int SYSSEQUENCES_INCREMENT = 9;
+    private static final int SYSSEQUENCES_CYCLE_OPTION = 10;
+
+    private static final int[][] indexColumnPositions =
+            {
+                    {SYSSEQUENCES_SEQUENCEID},
+                    {SYSSEQUENCES_SCHEMAID, SYSSEQUENCES_SEQUENCENAME}
+            };
+
+    // (Sequence)_ID
+    static final int SYSSEQUENCES_INDEX1_ID = 0;
+    // (seqeqnce)_NAME_SCHEMAID
+    static final int SYSSEQUENCES_INDEX2_ID = 1;
+
+    private static final boolean[] uniqueness = null;
+
+    private static final String[] uuids = {
+            "9810800c-0121-c5e2-e794-00000043e718", // catalog UUID
+            "6ea6ffac-0121-c5e6-29e6-00000043e718", // heap UUID
+            "7a92cf84-0121-c5fa-caf1-00000043e718", // INDEX1
+            "6b138684-0121-c5e9-9114-00000043e718"  // INDEX2
+    };
+
+
+    /**
+     * Constructor
+     *
+     * @param uuidf UUIDFactory
+     * @param ef    ExecutionFactory
+     * @param dvf   DataValueFactory
+     */
+    SYSSEQUENCESRowFactory(UUIDFactory uuidf,
+                           ExecutionFactory ef,
+                           DataValueFactory dvf) {
+        super(uuidf, ef, dvf);
+        initInfo(SYSSEQUENCES_COLUMN_COUNT, TABLENAME_STRING,
+                indexColumnPositions, uniqueness, uuids);
+    }
+
+    /**
+     * Make a SYSSEQUENCES row
+     *
+     * @param td     a sequence descriptor
+     * @param parent unused
+     * @return Row suitable for inserting into SYSSEQUENCES.
+     * @throws org.apache.derby.iapi.error.StandardException
+     *          thrown on failure
+     */
+
+    public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent)
+            throws StandardException {
+        ExecRow row;
+        String oidString = null;
+        String sequenceName = null;
+        String schemaIdString = null;
+        TypeDescriptor typeDesc = null;
+        long currentValue = 0;
+        long startValue = 0;
+        long minimumValue = 0;
+        long maximumValue = 0;
+        long increment = 0;
+        boolean cycle = false;
+
+
+        if (td != null) {
+            SequenceDescriptor sd = (SequenceDescriptor) td;
+
+            UUID oid = sd.getUUID();
+            oidString = oid.toString();
+            sequenceName = sd.getSequenceName();
+
+            UUID schemaId = sd.getSchemaId();
+            schemaIdString = schemaId.toString();
+
+            typeDesc = sd.getDataType().getCatalogType();
+
+            currentValue = sd.getCurrentValue();
+            startValue = sd.getStartValue();
+            minimumValue = sd.getMinimumValue();
+            maximumValue = sd.getMaximumValue();
+            increment = sd.getIncrement();
+            cycle = sd.isCycle();
+        }
+
+        /* Build the row to insert */
+        row = getExecutionFactory().getValueRow(SYSSEQUENCES_COLUMN_COUNT);
+
+        /* 1st column is UUID */
+        row.setColumn(SYSSEQUENCES_SEQUENCEID, new SQLChar(oidString));
+
+        /* 2nd column is SEQUENCENAME */
+        row.setColumn(SYSSEQUENCES_SEQUENCENAME, new SQLVarchar(sequenceName));
+
+        /* 3nd column is SCHEMAID */
+        row.setColumn(SYSSEQUENCES_SCHEMAID, new SQLChar(schemaIdString));
+
+        /* 4th column is SEQUENCEDATATYPE */
+        row.setColumn(SYSSEQUENCES_SEQUENCEDATATYPE, new UserType(typeDesc));
+
+        /* 5th column is CURRENTVALUE */
+        row.setColumn(SYSSEQUENCES_CURRENT_VALUE, new SQLLongint(currentValue));
+
+        /* 6th column is STARTVALUE */
+        row.setColumn(SYSSEQUENCES_START_VALUE, new SQLLongint(startValue));
+
+        /* 7th column is MINIMUMVALUE */
+        row.setColumn(SYSSEQUENCES_MINIMUM_VALUE, new SQLLongint(minimumValue));
+
+        /* 8th column is MAXIMUMVALUE */
+        row.setColumn(SYSSEQUENCES_MAXIMUM_VALUE, new SQLLongint(maximumValue));
+
+        /* 9th column is INCREMENT */
+        row.setColumn(SYSSEQUENCES_INCREMENT, new SQLLongint(increment));
+
+        /* 10th column is CYCLEOPTION */
+        row.setColumn(SYSSEQUENCES_CYCLE_OPTION, new SQLChar(cycle ? "Y" : "N"));
+
+        return row;
+    }
+
+    /**
+     * Make an  Tuple Descriptor out of a SYSSEQUENCES row
+     *
+     * @param row                   a SYSSEQUENCES row
+     * @param parentTupleDescriptor unused
+     * @param dd                    dataDictionary
+     * @return a  descriptor equivalent to a SYSSEQUENCES row
+     * @throws org.apache.derby.iapi.error.StandardException
+     *          thrown on failure
+     */
+    public TupleDescriptor buildDescriptor
+            (ExecRow row,
+             TupleDescriptor parentTupleDescriptor,
+             DataDictionary dd)
+            throws StandardException {
+
+        DataValueDescriptor col;
+        SequenceDescriptor descriptor;
+        UUID ouuid;
+        String sequenceName;
+        UUID suuid;
+        long currentValue;
+        long startValue;
+        long minimumValue;
+        long maximumValue;
+        long increment;
+        String cycleOption;
+
+        DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
+
+        if (SanityManager.DEBUG) {
+            SanityManager.ASSERT(row.nColumns() == SYSSEQUENCES_COLUMN_COUNT,
+                    "Wrong number of columns for a SYSSEQUENCES row");
+        }
+
+        // first column is uuid of this sequence descriptor (char(36))
+        col = row.getColumn(SYSSEQUENCES_SEQUENCEID);
+        String oidString = col.getString();
+        ouuid = getUUIDFactory().recreateUUID(oidString);
+
+        // second column is sequenceName (varchar(128))
+        col = row.getColumn(SYSSEQUENCES_SEQUENCENAME);
+        sequenceName = col.getString();
+
+        // third column is uuid of this sequence descriptors schema (char(36))
+        col = row.getColumn(SYSSEQUENCES_SCHEMAID);
+        String schemaIdString = col.getString();
+        suuid = getUUIDFactory().recreateUUID(schemaIdString);
+
+        // fourth column is the data type of this sequene generator
+        DataTypeDescriptor dataType = (DataTypeDescriptor) row.getColumn(SYSSEQUENCES_SEQUENCEDATATYPE).
+                getObject();
+
+        col = row.getColumn(SYSSEQUENCES_CURRENT_VALUE);
+        currentValue = col.getLong();
+
+        col = row.getColumn(SYSSEQUENCES_START_VALUE);
+        startValue = col.getLong();
+
+        col = row.getColumn(SYSSEQUENCES_MINIMUM_VALUE);
+        minimumValue = col.getLong();
+
+        col = row.getColumn(SYSSEQUENCES_MAXIMUM_VALUE);
+        maximumValue = col.getLong();
+
+        col = row.getColumn(SYSSEQUENCES_INCREMENT);
+        increment = col.getLong();
+
+        col = row.getColumn(SYSSEQUENCES_CYCLE_OPTION);
+        cycleOption = col.getString();
+
+        descriptor = ddg.newSequenceDescriptor
+                (dd.getSchemaDescriptor(suuid, null),
+                        ouuid,
+                        sequenceName,
+                        dataType,
+                        currentValue,
+                        startValue,
+                        minimumValue,
+                        maximumValue,
+                        increment,
+                        cycleOption.equals("Y") ? true : false);
+
+        return descriptor;
+    }
+
+    /**
+     * Builds a list of columns suitable for creating this Catalog.
+     *
+     * @return array of SystemColumn suitable for making this catalog.
+     */
+    public SystemColumn[] buildColumnList() {
+        return new SystemColumn[]{
+
+                SystemColumnImpl.getUUIDColumn("SEQUENCEID", false),
+                SystemColumnImpl.getIdentifierColumn("SEQUENCENAME", false),
+                SystemColumnImpl.getUUIDColumn("SCHEMAID", false),
+                SystemColumnImpl.getJavaColumn("SEQUENCEDATATYPE",
+                        "org.apache.derby.catalog.TypeDescriptor", false),
+                SystemColumnImpl.getColumn("CURRENTVALUE", Types.BIGINT, true),
+                SystemColumnImpl.getColumn("STARTVALUE", Types.BIGINT, false),
+                SystemColumnImpl.getColumn("MINIMUMVALUE", Types.BIGINT, false),
+                SystemColumnImpl.getColumn("MAXIMUMVALUE", Types.BIGINT, false),
+                SystemColumnImpl.getColumn("INCREMENT", Types.BIGINT, false),
+                SystemColumnImpl.getIndicatorColumn("CYCLEOPTION")
+        };
+    }
+}
+

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

Modified: db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java (original)
+++ db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java Wed Jul  8 17:57:27 2009
@@ -49,6 +49,8 @@
 import org.apache.derby.iapi.sql.dictionary.SPSDescriptor;
 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
 import org.apache.derby.iapi.sql.dictionary.RoleGrantDescriptor;
+import org.apache.derby.iapi.sql.dictionary.SequenceDescriptor;
+import org.apache.derby.iapi.sql.dictionary.PermDescriptor;
 import org.apache.derby.iapi.sql.dictionary.RoleClosureIterator;
 import org.apache.derby.iapi.sql.dictionary.SubKeyConstraintDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
@@ -818,4 +820,36 @@
 	public void updateMetadataSPSes(TransactionController tc) throws StandardException {
 		// TODO Auto-generated method stub		
 	}
+
+    public void dropSequenceDescriptor(SequenceDescriptor sequenceDescriptor,
+                                       TransactionController tc) throws StandardException {
+        // TODO Auto-generated method stub
+    }
+
+    public SequenceDescriptor getSequenceDescriptor(UUID uuid) throws StandardException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public SequenceDescriptor getSequenceDescriptor(SchemaDescriptor sd, String sequenceName)
+            throws StandardException {
+        // TODO Auto-generated method stub
+        return null;
+    }   
+
+    public PermDescriptor getPermissions(UUID permUUID) throws StandardException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public PermDescriptor getPermissions(UUID objectID, String granteeAuthId) 
+            throws StandardException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void dropAllPermDescriptors(UUID objectID, TransactionController tc)
+            throws StandardException {
+        // TODO Auto-generated method stub
+    }
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/compressTable.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/compressTable.out?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/compressTable.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/compressTable.out Wed Jul  8 17:57:27 2009
@@ -1087,9 +1087,11 @@
 SYS                                                                                                                             |SYSFILES                                                                                                                        |1          
 SYS                                                                                                                             |SYSFOREIGNKEYS                                                                                                                  |1          
 SYS                                                                                                                             |SYSKEYS                                                                                                                         |1          
+SYS                                                                                                                             |SYSPERMS                                                                                                                        |1          
 SYS                                                                                                                             |SYSROLES                                                                                                                        |1          
 SYS                                                                                                                             |SYSROUTINEPERMS                                                                                                                 |1          
 SYS                                                                                                                             |SYSSCHEMAS                                                                                                                      |1          
+SYS                                                                                                                             |SYSSEQUENCES                                                                                                                    |1          
 SYS                                                                                                                             |SYSSTATEMENTS                                                                                                                   |1          
 SYS                                                                                                                             |SYSSTATISTICS                                                                                                                   |1          
 SYS                                                                                                                             |SYSTABLEPERMS                                                                                                                   |1          

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/ij7.out Wed Jul  8 17:57:27 2009
@@ -34,9 +34,11 @@
 SYS                 |SYSFILES                      |                    
 SYS                 |SYSFOREIGNKEYS                |                    
 SYS                 |SYSKEYS                       |                    
+SYS                 |SYSPERMS                      |                    
 SYS                 |SYSROLES                      |                    
 SYS                 |SYSROUTINEPERMS               |                    
 SYS                 |SYSSCHEMAS                    |                    
+SYS                 |SYSSEQUENCES                  |                    
 SYS                 |SYSSTATEMENTS                 |                    
 SYS                 |SYSSTATISTICS                 |                    
 SYS                 |SYSTABLEPERMS                 |                    
@@ -78,9 +80,11 @@
 SYS                 |SYSFILES                      |                    
 SYS                 |SYSFOREIGNKEYS                |                    
 SYS                 |SYSKEYS                       |                    
+SYS                 |SYSPERMS                      |                    
 SYS                 |SYSROLES                      |                    
 SYS                 |SYSROUTINEPERMS               |                    
 SYS                 |SYSSCHEMAS                    |                    
+SYS                 |SYSSEQUENCES                  |                    
 SYS                 |SYSSTATEMENTS                 |                    
 SYS                 |SYSSTATISTICS                 |                    
 SYS                 |SYSTABLEPERMS                 |                    

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DMDBugsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DMDBugsTest.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DMDBugsTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DMDBugsTest.java Wed Jul  8 17:57:27 2009
@@ -78,7 +78,7 @@
 	                  {{"","APP","TSYN","SYNONYM","",null,null,null,null,null}});
 
 		rs = dmd.getTables( "%", "%", "%", new String[] {"SYSTEM TABLE"});
-		assertEquals(20, JDBC.assertDrainResults(rs));
+		assertEquals(22, JDBC.assertDrainResults(rs));
 		s.executeUpdate("DROP VIEW APP.V");
 		s.executeUpdate("DROP TABLE APP.TAB");
 		s.executeUpdate("DROP SYNONYM APP.TSYN");

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AlterTableTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AlterTableTest.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AlterTableTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AlterTableTest.java Wed Jul  8 17:57:27 2009
@@ -866,7 +866,9 @@
                     {"SYSTABLEPERMS", "1"},
                     {"SYSCOLPERMS", "1"},
                     {"SYSROUTINEPERMS", "1"},
-                    {"SYSROLES", "1"}
+                    {"SYSROLES", "1"},
+                    {"SYSSEQUENCES", "1"},
+                    {"SYSPERMS", "1"}
                 };
 
         JDBC.assertFullResultSet(rs, expRS, true);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java Wed Jul  8 17:57:27 2009
@@ -606,7 +606,7 @@
     //The query below will work for the same reason. 
     checkLangBasedQuery(s, "SELECT count(*) FROM SYS.SYSTABLES WHERE CASE " +
     		" WHEN 1=1 THEN TABLENAME ELSE TABLEID END = TABLENAME",
-    		new String[][] {{"23"} });
+    		new String[][] {{"25"} });
 
     //Do some testing using CONCATENATION
     //following will fail because result string of concatenation has 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java Wed Jul  8 17:57:27 2009
@@ -7789,6 +7789,8 @@
             {"SYSCOLPERMS"},
             {"SYSROUTINEPERMS"},
             {"SYSROLES"},
+            {"SYSSEQUENCES"},
+            {"SYSPERMS"},
             {"T1"},
             {"T2"},
             {"T2"},

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrimaryKeyTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrimaryKeyTest.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrimaryKeyTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrimaryKeyTest.java Wed Jul  8 17:57:27 2009
@@ -230,7 +230,9 @@
                         {"SYSTABLEPERMS","1"},
                         {"SYSCOLPERMS","1"},
                         {"SYSROUTINEPERMS","1"},
-						{"SYSROLES", "1"}};
+						{"SYSROLES", "1"},
+                        {"SYSSEQUENCES", "1"},
+                        {"SYSPERMS", "1"}};
                 JDBC.assertFullResultSet(rs,expectedCheckTables); 
 		//-- drop tables
 		assertUpdateCount(s , 0 , "drop table pos1");

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SystemCatalogTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SystemCatalogTest.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SystemCatalogTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SystemCatalogTest.java Wed Jul  8 17:57:27 2009
@@ -238,8 +238,15 @@
 				{"SYSFOREIGNKEYS", "UPDATERULE", "5", "CHAR(1) NOT NULL"},
 				{"SYSKEYS", "CONGLOMERATEID", "2", "CHAR(36) NOT NULL"},
 				{"SYSKEYS", "CONSTRAINTID", "1", "CHAR(36) NOT NULL"},
-				{"SYSROLES", "GRANTEE", "3", "VARCHAR(128) NOT NULL"},
-				{"SYSROLES", "GRANTOR", "4", "VARCHAR(128) NOT NULL"},
+                {"SYSPERMS", "GRANTEE", "6", "VARCHAR(128) NOT NULL"},
+                {"SYSPERMS", "GRANTOR", "5", "VARCHAR(128) NOT NULL"},
+                {"SYSPERMS", "ISGRANTABLE", "7", "CHAR(1) NOT NULL"},
+                {"SYSPERMS", "OBJECTID", "3", "CHAR(36) NOT NULL"},
+                {"SYSPERMS", "OBJECTTYPE", "2", "VARCHAR(36) NOT NULL"},
+                {"SYSPERMS", "PERMISSION", "4", "CHAR(36) NOT NULL"},
+                {"SYSPERMS", "UUID", "1", "CHAR(36) NOT NULL"},
+                {"SYSROLES", "GRANTEE", "3", "VARCHAR(128) NOT NULL"},
+                {"SYSROLES", "GRANTOR", "4", "VARCHAR(128) NOT NULL"},
 				{"SYSROLES", "ISDEF", "6", "CHAR(1) NOT NULL"},
 				{"SYSROLES", "ROLEID", "2", "VARCHAR(128) NOT NULL"},
 				{"SYSROLES", "UUID", "1", "CHAR(36) NOT NULL"},
@@ -252,8 +259,18 @@
 				{"SYSSCHEMAS", "AUTHORIZATIONID", "3", "VARCHAR(128) NOT NULL"},
 				{"SYSSCHEMAS", "SCHEMAID", "1", "CHAR(36) NOT NULL"},
 				{"SYSSCHEMAS", "SCHEMANAME", "2", "VARCHAR(128) NOT NULL"},
+                {"SYSSEQUENCES", "CURRENTVALUE", "5", "BIGINT"},
+                {"SYSSEQUENCES", "CYCLEOPTION", "10", "CHAR(1) NOT NULL"},
+                {"SYSSEQUENCES", "INCREMENT", "9", "BIGINT NOT NULL"},
+                {"SYSSEQUENCES", "MAXIMUMVALUE", "8", "BIGINT NOT NULL"},
+                {"SYSSEQUENCES", "MINIMUMVALUE", "7", "BIGINT NOT NULL"},
+                {"SYSSEQUENCES", "SCHEMAID", "3", "CHAR(36) NOT NULL"},
+                {"SYSSEQUENCES", "SEQUENCEDATATYPE", "4", "org.apache.derby.catalog.TypeDescriptor NOT NULL"},
+                {"SYSSEQUENCES", "SEQUENCEID", "1", "CHAR(36) NOT NULL"},
+                {"SYSSEQUENCES", "SEQUENCENAME", "2", "VARCHAR(128) NOT NULL"},
+                {"SYSSEQUENCES", "STARTVALUE", "6", "BIGINT NOT NULL"},                
 				{"SYSSTATEMENTS", "COMPILATIONSCHEMAID", "8", "CHAR(36)"},
-				{"SYSSTATEMENTS", "LASTCOMPILED", "7", "TIMESTAMP"},
+                {"SYSSTATEMENTS", "LASTCOMPILED", "7", "TIMESTAMP"},
 				{"SYSSTATEMENTS", "SCHEMAID", "3", "CHAR(36) NOT NULL"},
 				{"SYSSTATEMENTS", "STMTID", "1", "CHAR(36) NOT NULL"},
 				{"SYSSTATEMENTS", "STMTNAME", "2", "VARCHAR(128) NOT NULL"},
@@ -354,18 +371,24 @@
 				{"SYSFOREIGNKEYS", "SYSFOREIGNKEYS_INDEX1", "true"},
 				{"SYSKEYS", "SYSKEYS_HEAP", "false"},
 				{"SYSKEYS", "SYSKEYS_INDEX1", "true"},
-				{"SYSROLES", "SYSROLES_HEAP", "false"},
+                {"SYSPERMS", "SYSPERMS_HEAP", "false"},
+                {"SYSPERMS", "SYSPERMS_INDEX2", "true"},
+                {"SYSPERMS", "SYSPERMS_INDEX1", "true"},
+                {"SYSROLES", "SYSROLES_HEAP", "false"},
 				{"SYSROLES", "SYSROLES_INDEX3", "true"},
 				{"SYSROLES", "SYSROLES_INDEX2", "true"},
 				{"SYSROLES", "SYSROLES_INDEX1", "true"},
-				{"SYSROUTINEPERMS", "SYSROUTINEPERMS_HEAP", "false"},
+                {"SYSROUTINEPERMS", "SYSROUTINEPERMS_HEAP", "false"},
 				{"SYSROUTINEPERMS", "SYSROUTINEPERMS_INDEX3", "true"},
 				{"SYSROUTINEPERMS", "SYSROUTINEPERMS_INDEX2", "true"},
 				{"SYSROUTINEPERMS", "SYSROUTINEPERMS_INDEX1", "true"},
 				{"SYSSCHEMAS", "SYSSCHEMAS_HEAP", "false"},
 				{"SYSSCHEMAS", "SYSSCHEMAS_INDEX2", "true"},
 				{"SYSSCHEMAS", "SYSSCHEMAS_INDEX1", "true"},
-				{"SYSSTATEMENTS", "SYSSTATEMENTS_HEAP", "false"},
+                {"SYSSEQUENCES", "SYSSEQUENCES_HEAP", "false"},
+                {"SYSSEQUENCES", "SYSSEQUENCES_INDEX2", "true"},
+                {"SYSSEQUENCES", "SYSSEQUENCES_INDEX1", "true"},
+                {"SYSSTATEMENTS", "SYSSTATEMENTS_HEAP", "false"},
 				{"SYSSTATEMENTS", "SYSSTATEMENTS_INDEX2", "true"},
 				{"SYSSTATEMENTS", "SYSSTATEMENTS_INDEX1", "true"},
 				{"SYSSTATISTICS", "SYSSTATISTICS_HEAP", "false"},

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ViewsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ViewsTest.java?rev=792245&r1=792244&r2=792245&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ViewsTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ViewsTest.java Wed Jul  8 17:57:27 2009
@@ -538,7 +538,9 @@
             {"SYSTABLEPERMS", "1"},
             {"SYSCOLPERMS", "1"},
             {"SYSROUTINEPERMS", "1"},
-            {"SYSROLES", "1"}
+            {"SYSROLES", "1"},
+            {"SYSSEQUENCES", "1"},
+            {"SYSPERMS", "1"}    
         };
         
         JDBC.assertFullResultSet(rs, expRS, true);
@@ -647,7 +649,9 @@
             {"SYSTABLEPERMS", "1"},
             {"SYSCOLPERMS", "1"},
             {"SYSROUTINEPERMS", "1"},
-            {"SYSROLES", "1"}
+            {"SYSROLES", "1"},
+            {"SYSSEQUENCES", "1"},
+            {"SYSPERMS", "1"}
         };
         
         JDBC.assertFullResultSet(rs, expRS, true);



Mime
View raw message