Search in sources :

Example 51 with DataValueDescriptor

use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.

the class DataDictionaryImpl method getSPSDescriptorIndex2Scan.

/**
 * Scan sysstatements_index2 (stmtid) for a match.
 * Note that we do not do a lookup of parameter info.
 *
 * @return SPSDescriptor	The matching descriptor, if any.
 *
 * @exception StandardException		Thrown on failure
 */
private SPSDescriptor getSPSDescriptorIndex2Scan(String stmtUUID) throws StandardException {
    DataValueDescriptor stmtIDOrderable;
    TabInfoImpl ti = getNonCoreTI(SYSSTATEMENTS_CATALOG_NUM);
    /* Use stmtIdOrderable in both start 
		 * and stop position for scan. 
		 */
    stmtIDOrderable = new SQLChar(stmtUUID);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(1);
    keyRow.setColumn(1, stmtIDOrderable);
    SPSDescriptor spsd = getDescriptorViaIndex(SYSSTATEMENTSRowFactory.SYSSTATEMENTS_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SPSDescriptor.class, false);
    return spsd;
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) SQLChar(org.apache.derby.iapi.types.SQLChar) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow) SPSDescriptor(org.apache.derby.iapi.sql.dictionary.SPSDescriptor)

Example 52 with DataValueDescriptor

use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.

the class SYSSTATISTICSRowFactory method buildDescriptor.

public TupleDescriptor buildDescriptor(ExecRow row, TupleDescriptor parentDesc, DataDictionary dd) throws StandardException {
    if (SanityManager.DEBUG) {
        SanityManager.ASSERT(row.nColumns() == SYSSTATISTICS_COLUMN_COUNT, "Wrong number of columns for a SYSSTATISTICS row");
    }
    DataValueDescriptor col;
    String scratch;
    UUIDFactory uuidFactory = getUUIDFactory();
    UUID statUUID, statReferenceUUID, statTableUUID;
    String statName;
    /* 1st column is UUID */
    col = row.getColumn(SYSSTATISTICS_ID);
    scratch = col.getString();
    statUUID = uuidFactory.recreateUUID(scratch);
    /* 2nd column is reference UUID */
    col = row.getColumn(SYSSTATISTICS_REFERENCEID);
    scratch = col.getString();
    statReferenceUUID = uuidFactory.recreateUUID(scratch);
    /* 3rd column is table UUID */
    col = row.getColumn(SYSSTATISTICS_TABLEID);
    scratch = col.getString();
    statTableUUID = uuidFactory.recreateUUID(scratch);
    /* 4th column is timestamp */
    col = row.getColumn(SYSSTATISTICS_TIMESTAMP);
    Timestamp updateTime = (Timestamp) col.getObject();
    /* 5th column is stat type -- string */
    col = row.getColumn(SYSSTATISTICS_TYPE);
    String statType = col.getString();
    /* 6th column is stat valid -- boolean */
    col = row.getColumn(SYSSTATISTICS_VALID);
    boolean valid = col.getBoolean();
    /* 7th column is column count */
    col = row.getColumn(SYSSTATISTICS_COLCOUNT);
    int columnCount = col.getInt();
    /* 8th column is statistics itself */
    col = row.getColumn(SYSSTATISTICS_STAT);
    Statistics stat = (Statistics) col.getObject();
    return new StatisticsDescriptor(dd, statUUID, statReferenceUUID, // statName, colMap,
    statTableUUID, statType, stat, columnCount);
}
Also used : StatisticsDescriptor(org.apache.derby.iapi.sql.dictionary.StatisticsDescriptor) UUIDFactory(org.apache.derby.iapi.services.uuid.UUIDFactory) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) UUID(org.apache.derby.catalog.UUID) Timestamp(java.sql.Timestamp) Statistics(org.apache.derby.catalog.Statistics)

Example 53 with DataValueDescriptor

use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.

the class SYSTABLEPERMSRowFactory method setUUIDOfThePassedDescriptor.

// end of removeOnePermission
/**
 * @see PermissionsCatalogRowFactory#setUUIDOfThePassedDescriptor
 */
public void setUUIDOfThePassedDescriptor(ExecRow row, PermissionsDescriptor perm) throws StandardException {
    DataValueDescriptor existingPermDVD = row.getColumn(TABLEPERMSID_COL_NUM);
    perm.setUUID(getUUIDFactory().recreateUUID(existingPermDVD.getString()));
}
Also used : DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor)

Example 54 with DataValueDescriptor

use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.

the class SYSTABLEPERMSRowFactory method removeOnePermission.

// end of removePermissions
private boolean removeOnePermission(ExecRow row, boolean[] colsChanged, int column, String permission) throws StandardException {
    DataValueDescriptor existingPermDVD = row.getColumn(column);
    char existingPerm = existingPermDVD.getString().charAt(0);
    if (// Don't remove this one
    permission.charAt(0) == 'N')
        // The grantee still has some permissions on this table
        return existingPerm != 'N';
    if (SanityManager.DEBUG)
        SanityManager.ASSERT(permission.charAt(0) == 'Y' || permission.charAt(0) == 'y', "Invalid permission passed to SYSTABLEPERMSRowFactory.removeOnePermission");
    if (existingPerm != 'N') {
        existingPermDVD.setValue("N");
        colsChanged[column - 1] = true;
    }
    return false;
}
Also used : DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor)

Example 55 with DataValueDescriptor

use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.

the class SYSTABLEPERMSRowFactory method makeRow.

public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent) throws StandardException {
    UUID oid;
    DataValueDescriptor grantee = null;
    DataValueDescriptor grantor = null;
    String tablePermID = null;
    String tableID = null;
    String selectPriv = null;
    String deletePriv = null;
    String insertPriv = null;
    String updatePriv = null;
    String referencesPriv = null;
    String triggerPriv = null;
    if (td == null) {
        grantee = getNullAuthorizationID();
        grantor = getNullAuthorizationID();
    } else {
        TablePermsDescriptor tpd = (TablePermsDescriptor) td;
        oid = tpd.getUUID();
        if (oid == null) {
            oid = getUUIDFactory().createUUID();
            tpd.setUUID(oid);
        }
        tablePermID = oid.toString();
        grantee = getAuthorizationID(tpd.getGrantee());
        grantor = getAuthorizationID(tpd.getGrantor());
        tableID = tpd.getTableUUID().toString();
        selectPriv = tpd.getSelectPriv();
        deletePriv = tpd.getDeletePriv();
        insertPriv = tpd.getInsertPriv();
        updatePriv = tpd.getUpdatePriv();
        referencesPriv = tpd.getReferencesPriv();
        triggerPriv = tpd.getTriggerPriv();
    }
    ExecRow row = getExecutionFactory().getValueRow(COLUMN_COUNT);
    row.setColumn(TABLEPERMSID_COL_NUM, new SQLChar(tablePermID));
    row.setColumn(GRANTEE_COL_NUM, grantee);
    row.setColumn(GRANTOR_COL_NUM, grantor);
    row.setColumn(TABLEID_COL_NUM, new SQLChar(tableID));
    row.setColumn(SELECTPRIV_COL_NUM, new SQLChar(selectPriv));
    row.setColumn(DELETEPRIV_COL_NUM, new SQLChar(deletePriv));
    row.setColumn(INSERTPRIV_COL_NUM, new SQLChar(insertPriv));
    row.setColumn(UPDATEPRIV_COL_NUM, new SQLChar(updatePriv));
    row.setColumn(REFERENCESPRIV_COL_NUM, new SQLChar(referencesPriv));
    row.setColumn(TRIGGERPRIV_COL_NUM, new SQLChar(triggerPriv));
    return row;
}
Also used : ExecRow(org.apache.derby.iapi.sql.execute.ExecRow) SQLChar(org.apache.derby.iapi.types.SQLChar) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) UUID(org.apache.derby.catalog.UUID) TablePermsDescriptor(org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor)

Aggregations

DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)328 ExecIndexRow (org.apache.derby.iapi.sql.execute.ExecIndexRow)72 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)62 RowLocation (org.apache.derby.iapi.types.RowLocation)54 SQLLongint (org.apache.derby.iapi.types.SQLLongint)51 StandardException (org.apache.derby.shared.common.error.StandardException)43 SQLChar (org.apache.derby.iapi.types.SQLChar)42 FormatableBitSet (org.apache.derby.iapi.services.io.FormatableBitSet)36 SQLVarchar (org.apache.derby.iapi.types.SQLVarchar)36 ScanController (org.apache.derby.iapi.store.access.ScanController)35 ConglomerateController (org.apache.derby.iapi.store.access.ConglomerateController)32 UUID (org.apache.derby.catalog.UUID)31 TupleDescriptor (org.apache.derby.iapi.sql.dictionary.TupleDescriptor)24 RawTransaction (org.apache.derby.iapi.store.raw.xact.RawTransaction)16 DataDescriptorGenerator (org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator)15 RawContainerHandle (org.apache.derby.iapi.store.raw.data.RawContainerHandle)15 DataTypeDescriptor (org.apache.derby.iapi.types.DataTypeDescriptor)15 Properties (java.util.Properties)14 UserType (org.apache.derby.iapi.types.UserType)13 Page (org.apache.derby.iapi.store.raw.Page)11