Search in sources :

Example 6 with TupleDescriptor

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

the class DataDictionaryImpl method getSubKeyConstraint.

/**
 * Get a SubKeyConstraintDescriptor from syskeys or sysforeignkeys for
 * the specified constraint id.  For primary foreign and and unique
 * key constraints.
 *
 * @param constraintId	The UUID for the constraint.
 * @param type	The type of the constraint
 *		(e.g. DataDictionary.FOREIGNKEY_CONSTRAINT)
 *
 * @return SubKeyConstraintDescriptor	The Sub descriptor for the constraint.
 *
 * @exception StandardException		Thrown on failure
 */
public SubKeyConstraintDescriptor getSubKeyConstraint(UUID constraintId, int type) throws StandardException {
    DataValueDescriptor constraintIDOrderable = null;
    TabInfoImpl ti;
    int indexNum;
    int baseNum;
    if (type == DataDictionary.FOREIGNKEY_CONSTRAINT) {
        baseNum = SYSFOREIGNKEYS_CATALOG_NUM;
        indexNum = SYSFOREIGNKEYSRowFactory.SYSFOREIGNKEYS_INDEX1_ID;
    } else {
        baseNum = SYSKEYS_CATALOG_NUM;
        indexNum = SYSKEYSRowFactory.SYSKEYS_INDEX1_ID;
    }
    ti = getNonCoreTI(baseNum);
    /* Use constraintIDOrderable in both start and stop positions for scan */
    constraintIDOrderable = getIDValueAsCHAR(constraintId);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = (ExecIndexRow) exFactory.getIndexableRow(1);
    keyRow.setColumn(1, constraintIDOrderable);
    return getDescriptorViaIndex(indexNum, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SubKeyConstraintDescriptor.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) SQLLongint(org.apache.derby.iapi.types.SQLLongint)

Example 7 with TupleDescriptor

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

the class DataDictionaryImpl method getTableDescriptorIndex1Scan.

/**
 * Scan systables_index1 (tablename, schemaid) for a match.
 *
 * @return TableDescriptor	The matching descriptor, if any.
 *
 * @exception StandardException		Thrown on failure
 */
private TableDescriptor getTableDescriptorIndex1Scan(String tableName, String schemaUUID) throws StandardException {
    DataValueDescriptor schemaIDOrderable;
    DataValueDescriptor tableNameOrderable;
    TableDescriptor td;
    TabInfoImpl ti = coreInfo[SYSTABLES_CORE_NUM];
    /* Use tableNameOrderable and schemaIdOrderable in both start 
		 * and stop position for scan. 
		 */
    tableNameOrderable = new SQLVarchar(tableName);
    schemaIDOrderable = new SQLChar(schemaUUID);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(2);
    keyRow.setColumn(1, tableNameOrderable);
    keyRow.setColumn(2, schemaIDOrderable);
    td = getDescriptorViaIndex(SYSTABLESRowFactory.SYSTABLES_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, TableDescriptor.class, false);
    return finishTableDescriptor(td);
}
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) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow) TableDescriptor(org.apache.derby.iapi.sql.dictionary.TableDescriptor)

Example 8 with TupleDescriptor

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

the class DataDictionaryImpl method getSubCheckConstraint.

/**
 * Get a SubCheckConstraintDescriptor from syschecks for
 * the specified constraint id.  (Useful for check constraints.)
 *
 * @param constraintId	The UUID for the constraint.
 *
 * @return SubCheckConstraintDescriptor	The Sub descriptor for the constraint.
 *
 * @exception StandardException		Thrown on failure
 */
private SubCheckConstraintDescriptor getSubCheckConstraint(UUID constraintId) throws StandardException {
    DataValueDescriptor constraintIDOrderable = null;
    TabInfoImpl ti = getNonCoreTI(SYSCHECKS_CATALOG_NUM);
    /* Use constraintIDOrderable in both start and stop positions for scan */
    constraintIDOrderable = getIDValueAsCHAR(constraintId);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = (ExecIndexRow) exFactory.getIndexableRow(1);
    keyRow.setColumn(1, constraintIDOrderable);
    return getDescriptorViaIndex(SYSCHECKSRowFactory.SYSCHECKS_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SubCheckConstraintDescriptor.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 9 with TupleDescriptor

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

the class DataDictionaryImpl method getColumnDescriptorByDefaultId.

/**
 * Drop all table descriptors for a schema.
 *
 * @param schema	A descriptor for the schema to drop the tables
 *			from.
 *
 * @return  Nothing.
 *
 * @exception StandardException		Thrown on failure
 */
/*
	public void dropAllTableDescriptors(SchemaDescriptor schema)
						throws StandardException
	{
		if (SanityManager.DEBUG) SanityManager.NOTREACHED();
	}
	*/
/**
 * Get a ColumnDescriptor given its Default ID.
 *
 * @param uuid	The UUID of the default
 *
 * @return The ColumnDescriptor for the column.
 *
 * @exception StandardException		Thrown on failure
 */
public ColumnDescriptor getColumnDescriptorByDefaultId(UUID uuid) throws StandardException {
    DataValueDescriptor UUIDStringOrderable;
    TabInfoImpl ti = coreInfo[SYSCOLUMNS_CORE_NUM];
    /* Use UUIDStringOrderable in both start and stop positions 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(SYSCOLUMNSRowFactory.SYSCOLUMNS_INDEX2_ID, keyRow, (ScanQualifier[][]) null, ti, (DefaultDescriptor) null, (List<TupleDescriptor>) null, ColumnDescriptor.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 10 with TupleDescriptor

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

the class DataDictionaryImpl method getSPSDescriptorIndex2Scan.

/**
 * Scan sysstatements_index2 (stmtid) for a match.
 * Note that we do not do a lookup of parameter info.
 *
 * @return SPSDescriptor	The matching descriptor, if any.
 *
 * @exception StandardException		Thrown on failure
 */
private SPSDescriptor getSPSDescriptorIndex2Scan(String stmtUUID) throws StandardException {
    DataValueDescriptor stmtIDOrderable;
    TabInfoImpl ti = getNonCoreTI(SYSSTATEMENTS_CATALOG_NUM);
    /* Use stmtIdOrderable in both start 
		 * and stop position for scan. 
		 */
    stmtIDOrderable = new SQLChar(stmtUUID);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(1);
    keyRow.setColumn(1, stmtIDOrderable);
    SPSDescriptor spsd = getDescriptorViaIndex(SYSSTATEMENTSRowFactory.SYSSTATEMENTS_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SPSDescriptor.class, false);
    return spsd;
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) SQLChar(org.apache.derby.iapi.types.SQLChar) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow) SPSDescriptor(org.apache.derby.iapi.sql.dictionary.SPSDescriptor)

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