Search in sources :

Example 26 with TupleDescriptor

use of org.apache.derby.iapi.sql.dictionary.TupleDescriptor in project derby by apache.

the class DataDictionaryImpl method getSequenceDescriptor.

/**
 * 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);
    SequenceDescriptor sequenceDescriptor = getDescriptorViaIndex(SYSSEQUENCESRowFactory.SYSSEQUENCES_INDEX2_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SequenceDescriptor.class, false);
    putSequenceID(sequenceDescriptor);
    return sequenceDescriptor;
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar) SequenceDescriptor(org.apache.derby.iapi.sql.dictionary.SequenceDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 27 with TupleDescriptor

use of org.apache.derby.iapi.sql.dictionary.TupleDescriptor in project derby by apache.

the class DataDictionaryImpl method computeSequenceRowLocation.

/**
 * Computes the RowLocation in SYSSEQUENCES for a particular sequence. Also
 * constructs the sequence descriptor.
 *
 * @param tc			Transaction Controller to use.
 * @param sequenceIDstring UUID of the sequence as a string
 * @param rowLocation OUTPUT param for returing the row location
 * @param sequenceDescriptor OUTPUT param for return the sequence descriptor
 *
 * @exception StandardException thrown on failure.
 */
public void computeSequenceRowLocation(TransactionController tc, String sequenceIDstring, RowLocation[] rowLocation, SequenceDescriptor[] sequenceDescriptor) throws StandardException {
    TabInfoImpl ti = getNonCoreTI(SYSSEQUENCES_CATALOG_NUM);
    ExecIndexRow keyRow = null;
    keyRow = (ExecIndexRow) exFactory.getIndexableRow(1);
    keyRow.setColumn(1, new SQLChar(sequenceIDstring));
    rowLocation[0] = ti.getRowLocation(tc, keyRow, SYSSEQUENCESRowFactory.SYSSEQUENCES_INDEX1_ID);
    sequenceDescriptor[0] = getDescriptorViaIndex(SYSSEQUENCESRowFactory.SYSSEQUENCES_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SequenceDescriptor.class, false, TransactionController.ISOLATION_REPEATABLE_READ, tc);
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) SQLChar(org.apache.derby.iapi.types.SQLChar) ScanQualifier(org.apache.derby.iapi.sql.execute.ScanQualifier) ColumnDescriptorList(org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList) ConglomerateDescriptorList(org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptorList) ArrayList(java.util.ArrayList) TriggerDescriptorList(org.apache.derby.iapi.sql.dictionary.TriggerDescriptorList) List(java.util.List) ConstraintDescriptorList(org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList) LinkedList(java.util.LinkedList) SequenceDescriptor(org.apache.derby.iapi.sql.dictionary.SequenceDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 28 with TupleDescriptor

use of org.apache.derby.iapi.sql.dictionary.TupleDescriptor in project derby by apache.

the class DataDictionaryImpl method getRoleGrantDescriptor.

/**
 * @see DataDictionary#getRoleGrantDescriptor(UUID)
 */
public RoleGrantDescriptor getRoleGrantDescriptor(UUID uuid) throws StandardException {
    DataValueDescriptor UUIDStringOrderable;
    TabInfoImpl ti = getNonCoreTI(SYSROLES_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 getDescriptorViaIndex(SYSROLESRowFactory.SYSROLES_INDEX_UUID_IDX, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, RoleGrantDescriptor.class, false);
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 29 with TupleDescriptor

use of org.apache.derby.iapi.sql.dictionary.TupleDescriptor in project derby by apache.

the class DataDictionaryImpl method getRoleGrantDescriptor.

/**
 * Get the target role by searching for a matching row
 * in SYSROLES by rolename, grantee and grantor.  Read only scan.
 * Uses index on roleid, grantee and grantor columns.
 *
 * @param roleName	    The name of the role we're interested in.
 * @param grantee       The grantee
 * @param grantor       The grantor
 *
 * @return	            The descriptor for the role grant
 *
 * @exception StandardException  Thrown on error
 *
 * @see DataDictionary#getRoleGrantDescriptor(String, String, String)
 */
public RoleGrantDescriptor getRoleGrantDescriptor(String roleName, String grantee, String grantor) throws StandardException {
    DataValueDescriptor roleNameOrderable;
    DataValueDescriptor granteeOrderable;
    DataValueDescriptor grantorOrderable;
    TabInfoImpl ti = getNonCoreTI(SYSROLES_CATALOG_NUM);
    /* Use aliasNameOrderable, granteeOrderable and
		 * grantorOrderable in both start and stop position for scan.
		 */
    roleNameOrderable = new SQLVarchar(roleName);
    granteeOrderable = new SQLVarchar(grantee);
    grantorOrderable = new SQLVarchar(grantor);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(3);
    keyRow.setColumn(1, roleNameOrderable);
    keyRow.setColumn(2, granteeOrderable);
    keyRow.setColumn(3, grantorOrderable);
    return getDescriptorViaIndex(SYSROLESRowFactory.SYSROLES_INDEX_ID_EE_OR_IDX, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, RoleGrantDescriptor.class, false);
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 30 with TupleDescriptor

use of org.apache.derby.iapi.sql.dictionary.TupleDescriptor in project derby by apache.

the class DataDictionaryImpl method getAliasDescriptor.

/**
 * Get a AliasDescriptor by alias name and name space.
 * NOTE: caller responsible for handling no match.
 *
 *	   @param schemaId		schema identifier
 * @param aliasName		The alias name.
 * @param nameSpace		The alias type.
 *
 * @return AliasDescriptor	AliasDescriptor for the alias name and name space
 *
 * @exception StandardException		Thrown on failure
 */
public AliasDescriptor getAliasDescriptor(String schemaId, String aliasName, char nameSpace) throws StandardException {
    DataValueDescriptor aliasNameOrderable;
    DataValueDescriptor nameSpaceOrderable;
    TabInfoImpl ti = getNonCoreTI(SYSALIASES_CATALOG_NUM);
    /* Use aliasNameOrderable and aliasTypeOrderable in both start 
		 * and stop position for scan. 
		 */
    aliasNameOrderable = new SQLVarchar(aliasName);
    char[] charArray = new char[1];
    charArray[0] = nameSpace;
    nameSpaceOrderable = new SQLChar(new String(charArray));
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(3);
    keyRow.setColumn(1, new SQLChar(schemaId));
    keyRow.setColumn(2, aliasNameOrderable);
    keyRow.setColumn(3, nameSpaceOrderable);
    return getDescriptorViaIndex(SYSALIASESRowFactory.SYSALIASES_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, AliasDescriptor.class, false);
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) SQLChar(org.apache.derby.iapi.types.SQLChar) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Aggregations

TupleDescriptor (org.apache.derby.iapi.sql.dictionary.TupleDescriptor)30 ExecIndexRow (org.apache.derby.iapi.sql.execute.ExecIndexRow)27 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)24 SQLVarchar (org.apache.derby.iapi.types.SQLVarchar)13 SQLChar (org.apache.derby.iapi.types.SQLChar)8 ArrayList (java.util.ArrayList)5 ScanQualifier (org.apache.derby.iapi.sql.execute.ScanQualifier)5 LinkedList (java.util.LinkedList)4 List (java.util.List)4 ColumnDescriptorList (org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList)4 ConglomerateDescriptorList (org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptorList)4 ConstraintDescriptorList (org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList)4 TableDescriptor (org.apache.derby.iapi.sql.dictionary.TableDescriptor)4 TriggerDescriptorList (org.apache.derby.iapi.sql.dictionary.TriggerDescriptorList)4 UUID (org.apache.derby.catalog.UUID)3 AliasDescriptor (org.apache.derby.iapi.sql.dictionary.AliasDescriptor)3 SequenceDescriptor (org.apache.derby.iapi.sql.dictionary.SequenceDescriptor)3 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)3 FormatableBitSet (org.apache.derby.iapi.services.io.FormatableBitSet)2 SPSDescriptor (org.apache.derby.iapi.sql.dictionary.SPSDescriptor)2