use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method getTriggerDescriptor.
/**
* Get the stored prepared statement descriptor given
* a sps name.
*
* @param name The sps name.
* @param sd The schema descriptor.
*
* @return The TriggerDescriptor for the constraint.
*
* @exception StandardException Thrown on failure
*/
public TriggerDescriptor getTriggerDescriptor(String name, SchemaDescriptor sd) throws StandardException {
DataValueDescriptor schemaIDOrderable;
DataValueDescriptor triggerNameOrderable;
TabInfoImpl ti = getNonCoreTI(SYSTRIGGERS_CATALOG_NUM);
/* Use triggerNameOrderable and schemaIdOrderable in both start
* and stop position for scan.
*/
triggerNameOrderable = new SQLVarchar(name);
schemaIDOrderable = getIDValueAsCHAR(sd.getUUID());
/* Set up the start/stop position for the scan */
ExecIndexRow keyRow = exFactory.getIndexableRow(2);
keyRow.setColumn(1, triggerNameOrderable);
keyRow.setColumn(2, schemaIDOrderable);
return getDescriptorViaIndex(SYSTRIGGERSRowFactory.SYSTRIGGERS_INDEX2_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, TriggerDescriptor.class, false);
}
use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method getColumnDescriptorsScan.
/**
* Populate the ColumnDescriptorList for the specified TableDescriptor.
*
* MT synchronization: it is assumed that the caller has synchronized
* on the CDL in the given TD.
*
* @param uuid The referencing UUID
* @param cdl The column descriptor list
* @param td The parent tuple descriptor
*
* @exception StandardException Thrown on failure
*/
private void getColumnDescriptorsScan(UUID uuid, ColumnDescriptorList cdl, TupleDescriptor td) throws StandardException {
ColumnDescriptor cd;
ColumnDescriptorList cdlCopy = new ColumnDescriptorList();
DataValueDescriptor refIDOrderable = null;
TabInfoImpl ti = coreInfo[SYSCOLUMNS_CORE_NUM];
/* Use refIDOrderable in both start and stop position for scan. */
refIDOrderable = getIDValueAsCHAR(uuid);
/* Set up the start/stop position for the scan */
ExecIndexRow keyRow = exFactory.getIndexableRow(1);
keyRow.setColumn(1, refIDOrderable);
getDescriptorViaIndex(SYSCOLUMNSRowFactory.SYSCOLUMNS_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, td, cdl, ColumnDescriptor.class, false);
/* The TableDescriptor's column descriptor list must be ordered by
* columnNumber. (It is probably not ordered correctly at this point due
* to the index on syscolumns being on (tableId, columnName).) The
* cheapest way to reorder the list appears to be to copy it (above), and then
* walk the copy and put the elements back into the original in the
* expected locations.
*/
int cdlSize = cdl.size();
for (int index = 0; index < cdlSize; index++) {
cdlCopy.add(cdl.get(index));
}
for (int index = 0; index < cdlSize; index++) {
cd = (ColumnDescriptor) cdlCopy.elementAt(index);
cdl.set(cd.getPosition() - 1, cd);
}
}
use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method getIndexRowFromHeapRow.
/**
* Get an index row based on a row from the heap.
*
* @param irg IndexRowGenerator to use
* @param rl RowLocation for heap
* @param heapRow Row from the heap
*
* @return ExecIndexRow Index row.
*
* @exception StandardException Thrown on error
*/
public static ExecIndexRow getIndexRowFromHeapRow(IndexRowGenerator irg, RowLocation rl, ExecRow heapRow) throws StandardException {
ExecIndexRow indexRow;
indexRow = irg.getIndexRowTemplate();
// Get an index row based on the base row
irg.getIndexRow(heapRow, rl, indexRow, (FormatableBitSet) null);
return indexRow;
}
use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method dropSPSDescriptor.
/**
* Drops the given SPSDescriptor.
*
* @param uuid the statement uuid
* @param tc The TransactionController.
*
* @exception StandardException Thrown on failure
*/
public void dropSPSDescriptor(UUID uuid, TransactionController tc) throws StandardException {
DataValueDescriptor stmtIdOrderable;
TabInfoImpl ti = getNonCoreTI(SYSSTATEMENTS_CATALOG_NUM);
stmtIdOrderable = getIDValueAsCHAR(uuid);
/* Set up the start/stop position for the scan */
ExecIndexRow keyRow = (ExecIndexRow) exFactory.getIndexableRow(1);
keyRow.setColumn(1, stmtIdOrderable);
ti.deleteRow(tc, keyRow, SYSSTATEMENTSRowFactory.SYSSTATEMENTS_INDEX1_ID);
/* drop all columns in SYSCOLUMNS */
dropAllColumnDescriptors(uuid, tc);
}
use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method dropStoredDependency.
/**
* Drop a single dependency from the data dictionary.
*
* @param dd The DependencyDescriptor.
* @param tc TransactionController for the transaction
*
* @exception StandardException Thrown on failure
*/
public void dropStoredDependency(DependencyDescriptor dd, TransactionController tc) throws StandardException {
ExecIndexRow keyRow1 = null;
UUID dependentID = dd.getUUID();
UUID providerID = dd.getProviderID();
DataValueDescriptor dependentIDOrderable = getIDValueAsCHAR(dependentID);
TabInfoImpl ti = getNonCoreTI(SYSDEPENDS_CATALOG_NUM);
/* Use dependentIDOrderable in both start
* and stop position for index 1 scan.
*/
keyRow1 = (ExecIndexRow) exFactory.getIndexableRow(1);
keyRow1.setColumn(1, dependentIDOrderable);
// only drop the rows which have this providerID
TupleFilter filter = new DropDependencyFilter(providerID);
ti.deleteRows(tc, // start row
keyRow1, ScanController.GE, // qualifier
null, // filter on base row
filter, // stop row
keyRow1, ScanController.GT, SYSDEPENDSRowFactory.SYSDEPENDS_INDEX1_ID);
}
Aggregations