use of org.apache.derby.iapi.types.SQLChar 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.types.SQLChar 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;
}
use of org.apache.derby.iapi.types.SQLChar in project derby by apache.
the class DataDictionaryImpl method computeSequenceRowLocation.
/**
* Computes the RowLocation in SYSSEQUENCES for a particular sequence. Also
* constructs the sequence descriptor.
*
* @param tc Transaction Controller to use.
* @param sequenceIDstring UUID of the sequence as a string
* @param rowLocation OUTPUT param for returing the row location
* @param sequenceDescriptor OUTPUT param for return the sequence descriptor
*
* @exception StandardException thrown on failure.
*/
public void computeSequenceRowLocation(TransactionController tc, String sequenceIDstring, RowLocation[] rowLocation, SequenceDescriptor[] sequenceDescriptor) throws StandardException {
TabInfoImpl ti = getNonCoreTI(SYSSEQUENCES_CATALOG_NUM);
ExecIndexRow keyRow = null;
keyRow = (ExecIndexRow) exFactory.getIndexableRow(1);
keyRow.setColumn(1, new SQLChar(sequenceIDstring));
rowLocation[0] = ti.getRowLocation(tc, keyRow, SYSSEQUENCESRowFactory.SYSSEQUENCES_INDEX1_ID);
sequenceDescriptor[0] = getDescriptorViaIndex(SYSSEQUENCESRowFactory.SYSSEQUENCES_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SequenceDescriptor.class, false, TransactionController.ISOLATION_REPEATABLE_READ, tc);
}
use of org.apache.derby.iapi.types.SQLChar in project derby by apache.
the class DataDictionaryImpl method dropAliasDescriptor.
/**
* Drop a AliasDescriptor from the DataDictionary
*
* @param ad The AliasDescriptor to drop
* @param tc The TransactionController
*
* @exception StandardException Thrown on failure
*/
public void dropAliasDescriptor(AliasDescriptor ad, TransactionController tc) throws StandardException {
TabInfoImpl ti = getNonCoreTI(SYSALIASES_CATALOG_NUM);
/* Use aliasNameOrderable and nameSpaceOrderable in both start
* and stop position for index 1 scan.
*/
char[] charArray = new char[1];
charArray[0] = ad.getNameSpace();
/* Set up the start/stop position for the scan */
ExecIndexRow keyRow1 = (ExecIndexRow) exFactory.getIndexableRow(3);
keyRow1.setColumn(1, getIDValueAsCHAR(ad.getSchemaUUID()));
keyRow1.setColumn(2, new SQLVarchar(ad.getDescriptorName()));
keyRow1.setColumn(3, new SQLChar(new String(charArray)));
ti.deleteRow(tc, keyRow1, SYSALIASESRowFactory.SYSALIASES_INDEX1_ID);
}
use of org.apache.derby.iapi.types.SQLChar in project derby by apache.
the class DataDictionaryImpl method getSPSDescriptorIndex1Scan.
/**
* Scan sysschemas_index1 (stmtname, schemaid) for a match.
*
* @return SPSDescriptor The matching descriptor, if any.
*
* @exception StandardException Thrown on failure
*/
private SPSDescriptor getSPSDescriptorIndex1Scan(String stmtName, String schemaUUID) throws StandardException {
DataValueDescriptor schemaIDOrderable;
DataValueDescriptor stmtNameOrderable;
TabInfoImpl ti = getNonCoreTI(SYSSTATEMENTS_CATALOG_NUM);
/* Use stmtNameOrderable and schemaIdOrderable in both start
* and stop position for scan.
*/
stmtNameOrderable = new SQLVarchar(stmtName);
schemaIDOrderable = new SQLChar(schemaUUID);
/* Set up the start/stop position for the scan */
ExecIndexRow keyRow = exFactory.getIndexableRow(2);
keyRow.setColumn(1, stmtNameOrderable);
keyRow.setColumn(2, schemaIDOrderable);
SPSDescriptor spsd = getDescriptorViaIndex(SYSSTATEMENTSRowFactory.SYSSTATEMENTS_INDEX2_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SPSDescriptor.class, false);
/*
** Set up the parameter defaults. We are only
** doing this when we look up by name because
** this is the only time we cache, and it can
** be foolish to look up the parameter defaults
** for someone that doesn't need them.
*/
if (spsd != null) {
List<DataValueDescriptor> tmpDefaults = new ArrayList<DataValueDescriptor>();
spsd.setParams(getSPSParams(spsd, tmpDefaults));
Object[] defaults = tmpDefaults.toArray();
spsd.setParameterDefaults(defaults);
}
return spsd;
}
Aggregations