use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method getUser.
public UserDescriptor getUser(String userName) throws StandardException {
//
// No sense looking for the SYSUSERS congomerate until the database
// is hard-upgraded to 10.9 or later.
//
dictionaryVersion.checkVersion(DD_VERSION_DERBY_10_9, "NATIVE AUTHENTICATION");
ExecIndexRow keyRow;
TabInfoImpl ti = getNonCoreTI(SYSUSERS_CATALOG_NUM);
/* Set up the start/stop position for the scan */
keyRow = (ExecIndexRow) exFactory.getIndexableRow(1);
keyRow.setColumn(1, new SQLVarchar(userName));
return getDescriptorViaIndex(SYSUSERSRowFactory.SYSUSERS_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, UserDescriptor.class, false);
}
use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method upgradeSYSROUTINEPERMS_10_6.
/**
* 10.6 upgrade logic to update the permissions granted to SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE.
* If a 10.0 database was upgraded to 10.2, 10.3, or 10.4, then there will
* be an extra permissions tuple in SYSROUTINEPERMS--that tuple will have a
* null grantor field. We must delete this tuple. See DERBY-4215.
*/
void upgradeSYSROUTINEPERMS_10_6(TransactionController tc) throws StandardException {
//
// Get the aliasID of SYSCS_INPLACE_COMPRESS_TABLE
//
TabInfoImpl aliasTI = getNonCoreTI(SYSALIASES_CATALOG_NUM);
ExecIndexRow aliasKeyRow = exFactory.getIndexableRow(3);
DataValueDescriptor aliasNameOrderable = new SQLVarchar("SYSCS_INPLACE_COMPRESS_TABLE");
;
DataValueDescriptor nameSpaceOrderable = new SQLChar(new String(new char[] { AliasInfo.ALIAS_TYPE_PROCEDURE_AS_CHAR }));
aliasKeyRow.setColumn(1, new SQLChar(SchemaDescriptor.SYSCS_UTIL_SCHEMA_UUID));
aliasKeyRow.setColumn(2, aliasNameOrderable);
aliasKeyRow.setColumn(3, nameSpaceOrderable);
AliasDescriptor oldAD = getDescriptorViaIndex(SYSALIASESRowFactory.SYSALIASES_INDEX1_ID, aliasKeyRow, (ScanQualifier[][]) null, aliasTI, (TupleDescriptor) null, (List<TupleDescriptor>) null, AliasDescriptor.class, true, TransactionController.ISOLATION_REPEATABLE_READ, tc);
UUID aliasID = oldAD.getUUID();
//
// Now delete the permissions tuple which has a null grantor
//
TabInfoImpl rpTI = getNonCoreTI(SYSROUTINEPERMS_CATALOG_NUM);
ExecIndexRow rpKeyRow = exFactory.getIndexableRow(3);
rpKeyRow.setColumn(1, new SQLVarchar("PUBLIC"));
rpKeyRow.setColumn(2, new SQLChar(aliasID.toString()));
rpKeyRow.setColumn(3, new SQLVarchar((String) null));
int deleteCount = rpTI.deleteRow(tc, rpKeyRow, SYSROUTINEPERMSRowFactory.GRANTEE_ALIAS_GRANTOR_INDEX_NUM);
}
use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method computeRowLocation.
/**
* Computes the RowLocation in SYSCOLUMNS for a particular
* autoincrement column.
*
* @param tc Transaction Controller to use.
* @param td Table Descriptor.
* @param columnName Name of column which has autoincrement column.
*
* @exception StandardException thrown on failure.
*/
private RowLocation computeRowLocation(TransactionController tc, TableDescriptor td, String columnName) throws StandardException {
TabInfoImpl ti = coreInfo[SYSCOLUMNS_CORE_NUM];
ExecIndexRow keyRow = null;
UUID tableUUID = td.getUUID();
keyRow = (ExecIndexRow) exFactory.getIndexableRow(2);
keyRow.setColumn(1, getIDValueAsCHAR(tableUUID));
keyRow.setColumn(2, new SQLChar(columnName));
return ti.getRowLocation(tc, keyRow, SYSCOLUMNSRowFactory.SYSCOLUMNS_INDEX1_ID);
}
use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method getConstraintDescriptor.
/**
* Get a ConstraintDescriptor given its UUID. Please
* use getConstraintDescriptorById() is you have the
* constraints table descriptor, it is much faster.
*
* @param uuid The UUID
*
* @return The ConstraintDescriptor for the constraint.
*
* @exception StandardException Thrown on failure
*/
public ConstraintDescriptor getConstraintDescriptor(UUID uuid) throws StandardException {
DataValueDescriptor UUIDStringOrderable;
TabInfoImpl ti = getNonCoreTI(SYSCONSTRAINTS_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 getConstraintDescriptorViaIndex(SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_INDEX1_ID, keyRow, ti, (TableDescriptor) null, (ConstraintDescriptorList) null, false);
}
use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.
the class DataDictionaryImpl method getDependentsDescriptorList.
/**
* Gets a list of the dependency descriptors for the given dependent's id.
*
* @param dependentID The ID of the dependent we're interested in
*
* @return List Returns a list of DependencyDescriptors.
* Returns an empty List if no stored dependencies for the
* dependent's ID.
*
* @exception StandardException Thrown on failure
*/
public List<DependencyDescriptor> getDependentsDescriptorList(String dependentID) throws StandardException {
List<DependencyDescriptor> ddlList = newSList();
DataValueDescriptor dependentIDOrderable;
TabInfoImpl ti = getNonCoreTI(SYSDEPENDS_CATALOG_NUM);
/* Use dependentIDOrderable in both start and stop positions for scan */
dependentIDOrderable = new SQLChar(dependentID);
/* Set up the start/stop position for the scan */
ExecIndexRow keyRow = exFactory.getIndexableRow(1);
keyRow.setColumn(1, dependentIDOrderable);
getDescriptorViaIndex(SYSDEPENDSRowFactory.SYSDEPENDS_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, ddlList, DependencyDescriptor.class, false);
return ddlList;
}
Aggregations