use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.
the class DataDictionaryImpl method getConglomerateDescriptor.
/**
* Gets a conglomerate descriptor for the named index in the given schema,
* getting an exclusive row lock on the matching row in
* sys.sysconglomerates (for DDL concurrency) if requested.
*
* @param indexName The name of the index we're looking for
* @param sd The schema descriptor
* @param forUpdate Whether or not to get an exclusive row
* lock on the row in sys.sysconglomerates.
*
* @return A ConglomerateDescriptor describing the requested
* conglomerate. Returns NULL if no such conglomerate.
*
* @exception StandardException Thrown on failure
*/
public ConglomerateDescriptor getConglomerateDescriptor(String indexName, SchemaDescriptor sd, boolean forUpdate) throws StandardException {
ExecIndexRow keyRow2 = null;
DataValueDescriptor nameOrderable;
DataValueDescriptor schemaIDOrderable = null;
TabInfoImpl ti = coreInfo[SYSCONGLOMERATES_CORE_NUM];
nameOrderable = new SQLVarchar(indexName);
schemaIDOrderable = getIDValueAsCHAR(sd.getUUID());
/* Set up the start/stop position for the scan */
keyRow2 = exFactory.getIndexableRow(2);
keyRow2.setColumn(1, nameOrderable);
keyRow2.setColumn(2, schemaIDOrderable);
return getDescriptorViaIndex(SYSCONGLOMERATESRowFactory.SYSCONGLOMERATES_INDEX2_ID, keyRow2, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, ConglomerateDescriptor.class, forUpdate);
}
use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.
the class DataDictionaryImpl method dropAllRoutinePermDescriptors.
/**
* Drops all routine permission descriptors for the given routine.
*
* @param routineID The UUID of the routine from which to drop
* all the permission descriptors
* @param tc TransactionController for the transaction
*
* @exception StandardException Thrown on error
*/
public void dropAllRoutinePermDescriptors(UUID routineID, TransactionController tc) throws StandardException {
TabInfoImpl ti = getNonCoreTI(SYSROUTINEPERMS_CATALOG_NUM);
SYSROUTINEPERMSRowFactory rf = (SYSROUTINEPERMSRowFactory) ti.getCatalogRowFactory();
DataValueDescriptor routineIdOrderable;
ExecRow curRow;
PermissionsDescriptor perm;
// In Derby authorization mode, permission catalogs may not be present
if (!usesSqlAuthorization)
return;
/* Use tableIDOrderable in both start and stop position for scan. */
routineIdOrderable = getIDValueAsCHAR(routineID);
/* Set up the start/stop position for the scan */
ExecIndexRow keyRow = exFactory.getIndexableRow(1);
keyRow.setColumn(1, routineIdOrderable);
while ((curRow = ti.getRow(tc, keyRow, rf.ALIASID_INDEX_NUM)) != null) {
perm = (PermissionsDescriptor) 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.ROUTINEPERMSID_INDEX_NUM, perm);
ti.deleteRow(tc, uuidKey, rf.ROUTINEPERMSID_INDEX_NUM);
}
}
use of org.apache.derby.iapi.types.DataValueDescriptor 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.types.DataValueDescriptor in project derby by apache.
the class DataDictionaryImpl method dropDependentsStoredDependencies.
/**
* @inheritDoc
*/
public void dropDependentsStoredDependencies(UUID dependentsUUID, TransactionController tc, boolean wait) throws StandardException {
ExecIndexRow keyRow1 = null;
DataValueDescriptor dependentIDOrderable;
TabInfoImpl ti = getNonCoreTI(SYSDEPENDS_CATALOG_NUM);
/* Use dependentIDOrderable in both start
* and stop position for index 1 scan.
*/
dependentIDOrderable = getIDValueAsCHAR(dependentsUUID);
/* Set up the start/stop position for the scan */
keyRow1 = (ExecIndexRow) exFactory.getIndexableRow(1);
keyRow1.setColumn(1, dependentIDOrderable);
ti.deleteRow(tc, keyRow1, SYSDEPENDSRowFactory.SYSDEPENDS_INDEX1_ID, wait);
}
use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.
the class DataDictionaryImpl method clearSPSPlans.
/**
* Mark all SPS plans in the data dictionary invalid. This does
* not invalidate cached plans. This function is for use by
* the boot-up code.
* @exception StandardException Thrown on error
*/
void clearSPSPlans() throws StandardException {
TabInfoImpl ti = getNonCoreTI(SYSSTATEMENTS_CATALOG_NUM);
faultInTabInfo(ti);
TransactionController tc = getTransactionExecute();
FormatableBitSet columnToReadSet = new FormatableBitSet(SYSSTATEMENTSRowFactory.SYSSTATEMENTS_COLUMN_COUNT);
FormatableBitSet columnToUpdateSet = new FormatableBitSet(SYSSTATEMENTSRowFactory.SYSSTATEMENTS_COLUMN_COUNT);
columnToUpdateSet.set(SYSSTATEMENTSRowFactory.SYSSTATEMENTS_VALID - 1);
columnToUpdateSet.set(SYSSTATEMENTSRowFactory.SYSSTATEMENTS_CONSTANTSTATE - 1);
DataValueDescriptor[] replaceRow = new DataValueDescriptor[SYSSTATEMENTSRowFactory.SYSSTATEMENTS_COLUMN_COUNT];
/* Set up a couple of row templates for fetching CHARS */
replaceRow[SYSSTATEMENTSRowFactory.SYSSTATEMENTS_VALID - 1] = new SQLBoolean(false);
replaceRow[SYSSTATEMENTSRowFactory.SYSSTATEMENTS_CONSTANTSTATE - 1] = new UserType((Object) null);
/* Scan the entire heap */
ScanController sc = tc.openScan(ti.getHeapConglomerate(), false, TransactionController.OPENMODE_FORUPDATE, TransactionController.MODE_TABLE, TransactionController.ISOLATION_REPEATABLE_READ, columnToReadSet, (DataValueDescriptor[]) null, ScanController.NA, (Qualifier[][]) null, (DataValueDescriptor[]) null, ScanController.NA);
while (sc.fetchNext((DataValueDescriptor[]) null)) {
/* Replace the column in the table */
sc.replace(replaceRow, columnToUpdateSet);
}
sc.close();
}
Aggregations