Search in sources :

Example 51 with SQLChar

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);
}
Also used : SQLChar(org.apache.derby.iapi.types.SQLChar) UUID(org.apache.derby.catalog.UUID) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 52 with SQLChar

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;
}
Also used : DependencyDescriptor(org.apache.derby.iapi.sql.dictionary.DependencyDescriptor) SQLChar(org.apache.derby.iapi.types.SQLChar) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 53 with SQLChar

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);
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) SQLChar(org.apache.derby.iapi.types.SQLChar) ScanQualifier(org.apache.derby.iapi.sql.execute.ScanQualifier) ColumnDescriptorList(org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList) ConglomerateDescriptorList(org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptorList) ArrayList(java.util.ArrayList) TriggerDescriptorList(org.apache.derby.iapi.sql.dictionary.TriggerDescriptorList) List(java.util.List) ConstraintDescriptorList(org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList) LinkedList(java.util.LinkedList) SequenceDescriptor(org.apache.derby.iapi.sql.dictionary.SequenceDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 54 with SQLChar

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);
}
Also used : SQLChar(org.apache.derby.iapi.types.SQLChar) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 55 with SQLChar

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;
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) SQLChar(org.apache.derby.iapi.types.SQLChar) ArrayList(java.util.ArrayList) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow) SPSDescriptor(org.apache.derby.iapi.sql.dictionary.SPSDescriptor)

Aggregations

SQLChar (org.apache.derby.iapi.types.SQLChar)60 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)42 ExecIndexRow (org.apache.derby.iapi.sql.execute.ExecIndexRow)22 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)21 SQLVarchar (org.apache.derby.iapi.types.SQLVarchar)18 UUID (org.apache.derby.catalog.UUID)15 SQLLongint (org.apache.derby.iapi.types.SQLLongint)13 RawContainerHandle (org.apache.derby.iapi.store.raw.data.RawContainerHandle)12 RawTransaction (org.apache.derby.iapi.store.raw.xact.RawTransaction)12 RowLocation (org.apache.derby.iapi.types.RowLocation)10 ConglomerateController (org.apache.derby.iapi.store.access.ConglomerateController)9 TupleDescriptor (org.apache.derby.iapi.sql.dictionary.TupleDescriptor)8 StandardException (org.apache.derby.shared.common.error.StandardException)8 FormatableBitSet (org.apache.derby.iapi.services.io.FormatableBitSet)7 UserType (org.apache.derby.iapi.types.UserType)7 ScanController (org.apache.derby.iapi.store.access.ScanController)6 ArrayList (java.util.ArrayList)5 Properties (java.util.Properties)5 TableDescriptor (org.apache.derby.iapi.sql.dictionary.TableDescriptor)4 LinkedList (java.util.LinkedList)3