Search in sources :

Example 26 with ExecIndexRow

use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.

the class DataDictionaryImpl method dropSubCheckConstraint.

/**
 * Drop the matching row from syschecks when dropping a check constraint.
 *
 * @param constraintId	The constraint id.
 * @param tc			The TransactionController
 *
 * @exception StandardException		Thrown on failure
 */
private void dropSubCheckConstraint(UUID constraintId, TransactionController tc) throws StandardException {
    ExecIndexRow checkRow1 = null;
    DataValueDescriptor constraintIdOrderable;
    TabInfoImpl ti = getNonCoreTI(SYSCHECKS_CATALOG_NUM);
    /* Use constraintIdOrderable in both start 
		 * and stop position for index 1 scan. 
		 */
    constraintIdOrderable = getIDValueAsCHAR(constraintId);
    /* Set up the start/stop position for the scan */
    checkRow1 = (ExecIndexRow) exFactory.getIndexableRow(1);
    checkRow1.setColumn(1, constraintIdOrderable);
    ti.deleteRow(tc, checkRow1, SYSCHECKSRowFactory.SYSCHECKS_INDEX1_ID);
}
Also used : DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 27 with ExecIndexRow

use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.

the class DataDictionaryImpl method getConglomerateDescriptor.

/**
 * Gets a conglomerate descriptor for the named index in the given schema,
 * getting an exclusive row lock on the matching row in
 * sys.sysconglomerates (for DDL concurrency) if requested.
 *
 * @param indexName	The name of the index we're looking for
 * @param sd		The schema descriptor
 * @param forUpdate	Whether or not to get an exclusive row
 *					lock on the row in sys.sysconglomerates.
 *
 * @return	A ConglomerateDescriptor describing the requested
 *		conglomerate. Returns NULL if no such conglomerate.
 *
 * @exception StandardException		Thrown on failure
 */
public ConglomerateDescriptor getConglomerateDescriptor(String indexName, SchemaDescriptor sd, boolean forUpdate) throws StandardException {
    ExecIndexRow keyRow2 = null;
    DataValueDescriptor nameOrderable;
    DataValueDescriptor schemaIDOrderable = null;
    TabInfoImpl ti = coreInfo[SYSCONGLOMERATES_CORE_NUM];
    nameOrderable = new SQLVarchar(indexName);
    schemaIDOrderable = getIDValueAsCHAR(sd.getUUID());
    /* Set up the start/stop position for the scan */
    keyRow2 = exFactory.getIndexableRow(2);
    keyRow2.setColumn(1, nameOrderable);
    keyRow2.setColumn(2, schemaIDOrderable);
    return getDescriptorViaIndex(SYSCONGLOMERATESRowFactory.SYSCONGLOMERATES_INDEX2_ID, keyRow2, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, ConglomerateDescriptor.class, forUpdate);
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 28 with ExecIndexRow

use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.

the class DataDictionaryImpl method dropAllRoutinePermDescriptors.

/**
 * Drops all routine permission descriptors for the given routine.
 *
 * @param routineID	The UUID of the routine from which to drop
 *			all the permission descriptors
 * @param tc		TransactionController for the transaction
 *
 * @exception StandardException		Thrown on error
 */
public void dropAllRoutinePermDescriptors(UUID routineID, TransactionController tc) throws StandardException {
    TabInfoImpl ti = getNonCoreTI(SYSROUTINEPERMS_CATALOG_NUM);
    SYSROUTINEPERMSRowFactory rf = (SYSROUTINEPERMSRowFactory) ti.getCatalogRowFactory();
    DataValueDescriptor routineIdOrderable;
    ExecRow curRow;
    PermissionsDescriptor perm;
    // In Derby authorization mode, permission catalogs may not be present
    if (!usesSqlAuthorization)
        return;
    /* Use tableIDOrderable in both start and stop position for scan. */
    routineIdOrderable = getIDValueAsCHAR(routineID);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(1);
    keyRow.setColumn(1, routineIdOrderable);
    while ((curRow = ti.getRow(tc, keyRow, rf.ALIASID_INDEX_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.ROUTINEPERMSID_INDEX_NUM, perm);
        ti.deleteRow(tc, uuidKey, rf.ROUTINEPERMSID_INDEX_NUM);
    }
}
Also used : PermissionsDescriptor(org.apache.derby.iapi.sql.dictionary.PermissionsDescriptor) ExecRow(org.apache.derby.iapi.sql.execute.ExecRow) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 29 with ExecIndexRow

use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.

the class DataDictionaryImpl method getColumnDescriptorByDefaultId.

/**
 * Drop all table descriptors for a schema.
 *
 * @param schema	A descriptor for the schema to drop the tables
 *			from.
 *
 * @return  Nothing.
 *
 * @exception StandardException		Thrown on failure
 */
/*
	public void dropAllTableDescriptors(SchemaDescriptor schema)
						throws StandardException
	{
		if (SanityManager.DEBUG) SanityManager.NOTREACHED();
	}
	*/
/**
 * Get a ColumnDescriptor given its Default ID.
 *
 * @param uuid	The UUID of the default
 *
 * @return The ColumnDescriptor for the column.
 *
 * @exception StandardException		Thrown on failure
 */
public ColumnDescriptor getColumnDescriptorByDefaultId(UUID uuid) throws StandardException {
    DataValueDescriptor UUIDStringOrderable;
    TabInfoImpl ti = coreInfo[SYSCOLUMNS_CORE_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 getDescriptorViaIndex(SYSCOLUMNSRowFactory.SYSCOLUMNS_INDEX2_ID, keyRow, (ScanQualifier[][]) null, ti, (DefaultDescriptor) null, (List<TupleDescriptor>) null, ColumnDescriptor.class, false);
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 30 with ExecIndexRow

use of org.apache.derby.iapi.sql.execute.ExecIndexRow in project derby by apache.

the class DataDictionaryImpl method dropDependentsStoredDependencies.

/**
 * @inheritDoc
 */
public void dropDependentsStoredDependencies(UUID dependentsUUID, TransactionController tc, boolean wait) throws StandardException {
    ExecIndexRow keyRow1 = null;
    DataValueDescriptor dependentIDOrderable;
    TabInfoImpl ti = getNonCoreTI(SYSDEPENDS_CATALOG_NUM);
    /* Use dependentIDOrderable in both start 
		 * and stop position for index 1 scan. 
		 */
    dependentIDOrderable = getIDValueAsCHAR(dependentsUUID);
    /* Set up the start/stop position for the scan */
    keyRow1 = (ExecIndexRow) exFactory.getIndexableRow(1);
    keyRow1.setColumn(1, dependentIDOrderable);
    ti.deleteRow(tc, keyRow1, SYSDEPENDSRowFactory.SYSDEPENDS_INDEX1_ID, wait);
}
Also used : DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Aggregations

ExecIndexRow (org.apache.derby.iapi.sql.execute.ExecIndexRow)110 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)72 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)34 SQLVarchar (org.apache.derby.iapi.types.SQLVarchar)30 TupleDescriptor (org.apache.derby.iapi.sql.dictionary.TupleDescriptor)27 SQLChar (org.apache.derby.iapi.types.SQLChar)22 ConglomerateController (org.apache.derby.iapi.store.access.ConglomerateController)14 SQLLongint (org.apache.derby.iapi.types.SQLLongint)13 RowLocation (org.apache.derby.iapi.types.RowLocation)12 FormatableBitSet (org.apache.derby.iapi.services.io.FormatableBitSet)10 ScanController (org.apache.derby.iapi.store.access.ScanController)9 UUID (org.apache.derby.catalog.UUID)8 ArrayList (java.util.ArrayList)7 ColumnDescriptorList (org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList)6 ConglomerateDescriptorList (org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptorList)6 ConstraintDescriptorList (org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList)6 TransactionController (org.apache.derby.iapi.store.access.TransactionController)6 Properties (java.util.Properties)5 PermissionsDescriptor (org.apache.derby.iapi.sql.dictionary.PermissionsDescriptor)5 TableDescriptor (org.apache.derby.iapi.sql.dictionary.TableDescriptor)5