use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method getFileInfoDescriptorIndex2Scan.
/**
* Scan sysfiles_index2 (id) for a match.
* @return TableDescriptor The matching descriptor, or null.
* @exception StandardException Thrown on failure
*/
private FileInfoDescriptor getFileInfoDescriptorIndex2Scan(UUID id) throws StandardException {
DataValueDescriptor idOrderable;
TabInfoImpl ti = getNonCoreTI(SYSFILES_CATALOG_NUM);
idOrderable = getIDValueAsCHAR(id);
/* Set up the start/stop position for the scan */
ExecIndexRow keyRow = exFactory.getIndexableRow(1);
keyRow.setColumn(1, idOrderable);
return getDescriptorViaIndex(SYSFILESRowFactory.SYSFILES_INDEX2_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, FileInfoDescriptor.class, false);
}
use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method getTriggerDescriptor.
/**
* Get a TriggerDescriptor given its UUID.
*
* @param uuid The UUID
*
* @return The TriggerDescriptor for the constraint.
*
* @exception StandardException Thrown on failure
*/
public TriggerDescriptor getTriggerDescriptor(UUID uuid) throws StandardException {
TabInfoImpl ti = getNonCoreTI(SYSTRIGGERS_CATALOG_NUM);
DataValueDescriptor triggerIdOrderable = getIDValueAsCHAR(uuid);
/* Set up the start/stop position for the scan */
ExecIndexRow keyRow = exFactory.getIndexableRow(1);
keyRow.setColumn(1, triggerIdOrderable);
return getDescriptorViaIndex(SYSTRIGGERSRowFactory.SYSTRIGGERS_INDEX1_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 getRoleGrantDescriptor.
/**
* @see DataDictionary#getRoleGrantDescriptor(UUID)
*/
public RoleGrantDescriptor getRoleGrantDescriptor(UUID uuid) throws StandardException {
DataValueDescriptor UUIDStringOrderable;
TabInfoImpl ti = getNonCoreTI(SYSROLES_CATALOG_NUM);
/* Use UUIDStringOrderable in both start and stop position 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(SYSROLESRowFactory.SYSROLES_INDEX_UUID_IDX, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, RoleGrantDescriptor.class, false);
}
use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method dropAllPermDescriptors.
/**
* Drops all permission descriptors for the object whose Id is given.
*
* @param objectID The UUID of the object from which to drop
* all the permission descriptors
* @param tc TransactionController for the transaction
* @throws StandardException Thrown on error
*/
public void dropAllPermDescriptors(UUID objectID, TransactionController tc) throws StandardException {
TabInfoImpl ti = getNonCoreTI(SYSPERMS_CATALOG_NUM);
SYSPERMSRowFactory rf = (SYSPERMSRowFactory) ti.getCatalogRowFactory();
DataValueDescriptor objIdOrderable;
ExecRow curRow;
PermissionsDescriptor perm;
// In Derby authorization mode, permission catalogs may not be present
if (!usesSqlAuthorization)
return;
/* Use objIDOrderable in both start and stop position for scan. */
objIdOrderable = getIDValueAsCHAR(objectID);
/* Set up the start/stop position for the scan */
ExecIndexRow keyRow = exFactory.getIndexableRow(1);
keyRow.setColumn(1, objIdOrderable);
while ((curRow = ti.getRow(tc, keyRow, rf.PERMS_OBJECTID_IDX_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.PERMS_UUID_IDX_NUM, perm);
ti.deleteRow(tc, uuidKey, rf.PERMS_UUID_IDX_NUM);
}
}
use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method upgradeCLOBGETSUBSTRING_10_6.
/**
* 10.6 upgrade logic to update the return type of SYSIBM.CLOBGETSUBSTRING. The length of the
* return type was changed in 10.5 but old versions of the metadata were not
* upgraded at that time. See DERBY-4214.
*/
void upgradeCLOBGETSUBSTRING_10_6(TransactionController tc) throws StandardException {
TabInfoImpl ti = getNonCoreTI(SYSALIASES_CATALOG_NUM);
ExecIndexRow keyRow = exFactory.getIndexableRow(3);
DataValueDescriptor aliasNameOrderable = new SQLVarchar("CLOBGETSUBSTRING");
DataValueDescriptor nameSpaceOrderable = new SQLChar(new String(new char[] { AliasInfo.ALIAS_TYPE_FUNCTION_AS_CHAR }));
keyRow.setColumn(1, new SQLChar(SchemaDescriptor.SYSIBM_SCHEMA_UUID));
keyRow.setColumn(2, aliasNameOrderable);
keyRow.setColumn(3, nameSpaceOrderable);
AliasDescriptor oldAD = getDescriptorViaIndex(SYSALIASESRowFactory.SYSALIASES_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, AliasDescriptor.class, true, TransactionController.ISOLATION_REPEATABLE_READ, tc);
RoutineAliasInfo oldRai = (RoutineAliasInfo) oldAD.getAliasInfo();
TypeDescriptor newReturnType = DataTypeDescriptor.getCatalogType(Types.VARCHAR, Limits.MAX_CLOB_RETURN_LEN);
RoutineAliasInfo newRai = new RoutineAliasInfo(oldRai.getMethodName(), oldRai.getParameterCount(), oldRai.getParameterNames(), oldRai.getParameterTypes(), oldRai.getParameterModes(), oldRai.getMaxDynamicResultSets(), oldRai.getParameterStyle(), oldRai.getSQLAllowed(), oldRai.isDeterministic(), oldRai.hasVarargs(), oldRai.hasDefinersRights(), oldRai.calledOnNullInput(), newReturnType);
AliasDescriptor newAD = new AliasDescriptor(this, oldAD.getUUID(), oldAD.getObjectName(), oldAD.getSchemaUUID(), oldAD.getJavaClassName(), oldAD.getAliasType(), oldAD.getNameSpace(), oldAD.getSystemAlias(), newRai, oldAD.getSpecificName());
ExecRow newRow = ti.getCatalogRowFactory().makeRow(newAD, null);
ti.updateRow(keyRow, newRow, SYSALIASESRowFactory.SYSALIASES_INDEX1_ID, new boolean[] { false, false, false }, (int[]) null, tc);
}
Aggregations