Search in sources :

Example 36 with SQLChar

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

the class SYSDEPENDSRowFactory method makeRow.

// ///////////////////////////////////////////////////////////////////////////
// 
// METHODS
// 
// ///////////////////////////////////////////////////////////////////////////
/**
 * Make a SYSDEPENDS row
 *
 * @param td DependencyDescriptor. If its null then we want to make an empty
 * row.
 *
 * @return	Row suitable for inserting into SYSDEPENDS.
 *
 * @exception   StandardException thrown on failure
 */
public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent) throws StandardException {
    DataValueDescriptor col;
    ExecRow row;
    String dependentID = null;
    DependableFinder dependentBloodhound = null;
    String providerID = null;
    DependableFinder providerBloodhound = null;
    if (td != null) {
        DependencyDescriptor dd = (DependencyDescriptor) td;
        dependentID = dd.getUUID().toString();
        dependentBloodhound = dd.getDependentFinder();
        if (dependentBloodhound == null) {
            throw StandardException.newException(SQLState.DEP_UNABLE_TO_STORE);
        }
        providerID = dd.getProviderID().toString();
        providerBloodhound = dd.getProviderFinder();
        if (providerBloodhound == null) {
            throw StandardException.newException(SQLState.DEP_UNABLE_TO_STORE);
        }
    }
    /* Insert info into sysdepends */
    /* RESOLVE - It would be nice to require less knowledge about sysdepends
		 * and have this be more table driven.
		 */
    /* Build the row to insert  */
    row = getExecutionFactory().getValueRow(SYSDEPENDS_COLUMN_COUNT);
    /* 1st column is DEPENDENTID (UUID - char(36)) */
    row.setColumn(SYSDEPENDS_DEPENDENTID, new SQLChar(dependentID));
    /* 2nd column is DEPENDENTFINDER */
    row.setColumn(SYSDEPENDS_DEPENDENTTYPE, new UserType(dependentBloodhound));
    /* 3rd column is PROVIDERID (UUID - char(36)) */
    row.setColumn(SYSDEPENDS_PROVIDERID, new SQLChar(providerID));
    /* 4th column is PROVIDERFINDER */
    row.setColumn(SYSDEPENDS_PROVIDERTYPE, new UserType(providerBloodhound));
    return row;
}
Also used : DependableFinder(org.apache.derby.catalog.DependableFinder) DependencyDescriptor(org.apache.derby.iapi.sql.dictionary.DependencyDescriptor) ExecRow(org.apache.derby.iapi.sql.execute.ExecRow) SQLChar(org.apache.derby.iapi.types.SQLChar) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) UserType(org.apache.derby.iapi.types.UserType)

Example 37 with SQLChar

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

the class SYSDUMMY1RowFactory method makeRow.

/**
 * Make a SYSDUMMY1 row
 *
 * @return	Row suitable for inserting into SYSSTATISTICS.
 *
 * @exception   StandardException thrown on failure
 */
public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent) throws StandardException {
    ExecRow row = getExecutionFactory().getValueRow(SYSDUMMY1_COLUMN_COUNT);
    row.setColumn(1, new SQLChar("Y"));
    return row;
}
Also used : ExecRow(org.apache.derby.iapi.sql.execute.ExecRow) SQLChar(org.apache.derby.iapi.types.SQLChar)

Example 38 with SQLChar

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

the class SYSFILESRowFactory method makeRow.

// ///////////////////////////////////////////////////////////////////////////
// 
// METHODS
// 
// ///////////////////////////////////////////////////////////////////////////
/**
 * Make a SYSFILES row
 *
 * @return	Row suitable for inserting into SYSFILES
 *
 * @exception   StandardException thrown on failure
 */
public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent) throws StandardException {
    String id_S = null;
    String schemaId_S = null;
    String SQLname = null;
    long generationId = 0;
    ExecRow row;
    if (td != null) {
        FileInfoDescriptor descriptor = (FileInfoDescriptor) td;
        id_S = descriptor.getUUID().toString();
        schemaId_S = descriptor.getSchemaDescriptor().getUUID().toString();
        SQLname = descriptor.getName();
        generationId = descriptor.getGenerationId();
    }
    /* Build the row to insert  */
    row = getExecutionFactory().getValueRow(SYSFILES_COLUMN_COUNT);
    /* 1st column is ID (UUID - char(36)) */
    row.setColumn(ID_COL_NUM, new SQLChar(id_S));
    /* 2nd column is SCHEMAID (UUID - char(36)) */
    row.setColumn(SCHEMA_ID_COL_NUM, new SQLChar(schemaId_S));
    /* 3rd column is NAME (varchar(30)) */
    row.setColumn(NAME_COL_NUM, new SQLVarchar(SQLname));
    /* 4th column is GENERATIONID (long) */
    row.setColumn(GENERATION_ID_COL_NUM, new SQLLongint(generationId));
    return row;
}
Also used : FileInfoDescriptor(org.apache.derby.iapi.sql.dictionary.FileInfoDescriptor) SQLLongint(org.apache.derby.iapi.types.SQLLongint) ExecRow(org.apache.derby.iapi.sql.execute.ExecRow) SQLChar(org.apache.derby.iapi.types.SQLChar) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar)

Example 39 with SQLChar

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

the class SYSFOREIGNKEYSRowFactory method makeRow.

// ///////////////////////////////////////////////////////////////////////////
// 
// METHODS
// 
// ///////////////////////////////////////////////////////////////////////////
/**
 * Make a SYSFOREIGNKEYS row
 *
 * @return	Row suitable for inserting into SYSFOREIGNKEYS.
 *
 * @exception   StandardException thrown on failure
 */
public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent) throws StandardException {
    DataValueDescriptor col;
    ExecIndexRow row;
    String constraintId = null;
    String keyConstraintId = null;
    String conglomId = null;
    String raDeleteRule = "N";
    String raUpdateRule = "N";
    if (td != null) {
        ForeignKeyConstraintDescriptor cd = (ForeignKeyConstraintDescriptor) td;
        constraintId = cd.getUUID().toString();
        ReferencedKeyConstraintDescriptor refCd = cd.getReferencedConstraint();
        if (SanityManager.DEBUG) {
            SanityManager.ASSERT(refCd != null, "this fk returned a null referenced key");
        }
        keyConstraintId = refCd.getUUID().toString();
        conglomId = cd.getIndexUUIDString();
        raDeleteRule = getRefActionAsString(cd.getRaDeleteRule());
        raUpdateRule = getRefActionAsString(cd.getRaUpdateRule());
    }
    /* Build the row  */
    row = getExecutionFactory().getIndexableRow(SYSFOREIGNKEYS_COLUMN_COUNT);
    /* 1st column is CONSTRAINTID (UUID - char(36)) */
    row.setColumn(SYSFOREIGNKEYS_CONSTRAINTID, new SQLChar(constraintId));
    /* 2nd column is CONGLOMERATEID (UUID - char(36)) */
    row.setColumn(SYSFOREIGNKEYS_CONGLOMERATEID, new SQLChar(conglomId));
    /* 3rd column is KEYCONSTRAINTID (UUID - char(36)) */
    row.setColumn(SYSFOREIGNKEYS_KEYCONSTRAINTID, new SQLChar(keyConstraintId));
    // currently, DELETERULE and UPDATERULE are always "R" for restrict
    /* 4th column is DELETERULE char(1) */
    row.setColumn(SYSFOREIGNKEYS_DELETERULE, new SQLChar(raDeleteRule));
    /* 5th column is UPDATERULE char(1) */
    row.setColumn(SYSFOREIGNKEYS_UPDATERULE, new SQLChar(raUpdateRule));
    return row;
}
Also used : ReferencedKeyConstraintDescriptor(org.apache.derby.iapi.sql.dictionary.ReferencedKeyConstraintDescriptor) SQLChar(org.apache.derby.iapi.types.SQLChar) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow) ForeignKeyConstraintDescriptor(org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor)

Example 40 with SQLChar

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

the class SYSPERMSRowFactory method buildIndexKeyRow.

/**
 * builds an index key row given for a given index number.
 */
public ExecIndexRow buildIndexKeyRow(int indexNumber, PermissionsDescriptor perm) throws StandardException {
    ExecIndexRow row = null;
    switch(indexNumber) {
        case GRANTEE_OBJECTID_GRANTOR_INDEX_NUM:
            // RESOLVE We do not support the FOR GRANT OPTION, so generic permission rows are unique on the
            // grantee and object UUID columns. The grantor column will always have the name of the owner of the
            // object. So the index key, used for searching the index, only has grantee and object UUID columns.
            // It does not have a grantor column.
            row = getExecutionFactory().getIndexableRow(2);
            row.setColumn(1, getAuthorizationID(perm.getGrantee()));
            String protectedObjectsIDStr = ((PermDescriptor) perm).getPermObjectId().toString();
            row.setColumn(2, new SQLChar(protectedObjectsIDStr));
            break;
        case PERMS_UUID_IDX_NUM:
            row = getExecutionFactory().getIndexableRow(1);
            String permUUIDStr = ((PermDescriptor) perm).getUUID().toString();
            row.setColumn(1, new SQLChar(permUUIDStr));
            break;
    }
    return row;
}
Also used : SQLChar(org.apache.derby.iapi.types.SQLChar) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

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