use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.
the class DataDictionaryImpl method getAliasDescriptor.
/**
* Get a AliasDescriptor given its UUID.
*
* @param uuid The UUID
*
* @return The AliasDescriptor for the alias.
*
* @exception StandardException Thrown on failure
*/
public AliasDescriptor getAliasDescriptor(UUID uuid) throws StandardException {
DataValueDescriptor UUIDStringOrderable;
TabInfoImpl ti = getNonCoreTI(SYSALIASES_CATALOG_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(SYSALIASESRowFactory.SYSALIASES_INDEX2_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, AliasDescriptor.class, false);
}
use of org.apache.derby.iapi.types.DataValueDescriptor 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.types.DataValueDescriptor in project derby by apache.
the class DataDictionaryImpl method getStatisticsDescriptors.
/**
* Returns all the statistics descriptors for the given table.
* <p>
* NOTE: As opposed to most other data dictionary lookups, this operation is
* performed with isolation level READ_UNCOMMITTED. The reason is to avoid
* deadlocks with inserts into the statistics system table.
*
* @param td {@code TableDescriptor} for which I need statistics
* @return A list of tuple descriptors, possibly empty.
*/
public List<StatisticsDescriptor> getStatisticsDescriptors(TableDescriptor td) throws StandardException {
TabInfoImpl ti = getNonCoreTI(SYSSTATISTICS_CATALOG_NUM);
List<StatisticsDescriptor> statDescriptorList = newSList();
DataValueDescriptor UUIDStringOrderable;
/* set up the start/stop position for the scan */
UUIDStringOrderable = getIDValueAsCHAR(td.getUUID());
ExecIndexRow keyRow = exFactory.getIndexableRow(1);
keyRow.setColumn(1, UUIDStringOrderable);
getDescriptorViaIndex(SYSSTATISTICSRowFactory.SYSSTATISTICS_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, statDescriptorList, StatisticsDescriptor.class, false, TransactionController.ISOLATION_READ_UNCOMMITTED, getTransactionCompile());
return statDescriptorList;
}
use of org.apache.derby.iapi.types.DataValueDescriptor 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.types.DataValueDescriptor in project derby by apache.
the class DataDictionaryImpl method dropViewDescriptor.
/**
* Drops the view descriptor from the data dictionary.
*
* @param vd A descriptor for the view to be dropped
* @param tc TransactionController to use
*
* @exception StandardException Thrown on error
*/
public void dropViewDescriptor(ViewDescriptor vd, TransactionController tc) throws StandardException {
DataValueDescriptor viewIdOrderable;
TabInfoImpl ti = getNonCoreTI(SYSVIEWS_CATALOG_NUM);
/* Use aliasNameOrderable in both start
* and stop position for scan.
*/
viewIdOrderable = getIDValueAsCHAR(vd.getUUID());
/* Set up the start/stop position for the scan */
ExecIndexRow keyRow = (ExecIndexRow) exFactory.getIndexableRow(1);
keyRow.setColumn(1, viewIdOrderable);
ti.deleteRow(tc, keyRow, SYSVIEWSRowFactory.SYSVIEWS_INDEX1_ID);
}
Aggregations