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);
}
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);
}
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);
}
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);
}
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;
}
Aggregations