Search in sources :

Example 16 with SQLVarchar

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

the class SYSPERMSRowFactory method makeRow.

/**
 * Make a SYSPERMS row
 *
 * @param td     a permission descriptor
 * @param parent unused
 * @return Row suitable for inserting into SYSPERMS.
 * @throws org.apache.derby.shared.common.error.StandardException
 *          thrown on failure
 */
public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent) throws StandardException {
    ExecRow row;
    String permIdString = null;
    String objectType = "SEQUENCE";
    String objectIdString = null;
    String permission = "USAGE";
    String grantor = null;
    String grantee = null;
    boolean grantable = false;
    if (td != null) {
        PermDescriptor sd = (PermDescriptor) td;
        UUID pid = sd.getUUID();
        if (pid == null) {
            pid = getUUIDFactory().createUUID();
            sd.setUUID(pid);
        }
        permIdString = pid.toString();
        objectType = sd.getObjectType();
        UUID oid = sd.getPermObjectId();
        objectIdString = oid.toString();
        permission = sd.getPermission();
        grantor = sd.getGrantor();
        grantee = sd.getGrantee();
        grantable = sd.isGrantable();
    }
    /* Build the row to insert */
    row = getExecutionFactory().getValueRow(SYSPERMS_COLUMN_COUNT);
    /* 1st column is UUID */
    row.setColumn(1, new SQLChar(permIdString));
    /* 2nd column is OBJECTTYPE */
    row.setColumn(2, new SQLVarchar(objectType));
    /* 3rd column is OBJECTID */
    row.setColumn(3, new SQLChar(objectIdString));
    /* 4nd column is OBJECTTYPE */
    row.setColumn(4, new SQLChar(permission));
    /* 5nd column is GRANTOR */
    row.setColumn(5, new SQLVarchar(grantor));
    /* 6nd column is GRANTEE */
    row.setColumn(6, new SQLVarchar(grantee));
    /* 7nd column is IS_GRANTABLE */
    row.setColumn(7, new SQLChar(grantable ? "Y" : "N"));
    return row;
}
Also used : ExecRow(org.apache.derby.iapi.sql.execute.ExecRow) SQLChar(org.apache.derby.iapi.types.SQLChar) PermDescriptor(org.apache.derby.iapi.sql.dictionary.PermDescriptor) UUID(org.apache.derby.catalog.UUID) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar)

Example 17 with SQLVarchar

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

the class SYSSCHEMASRowFactory method makeRow.

// ///////////////////////////////////////////////////////////////////////////
// 
// METHODS
// 
// ///////////////////////////////////////////////////////////////////////////
/**
 * Make a SYSSCHEMAS row
 *
 * @return	Row suitable for inserting into SYSSCHEMAS.
 *
 * @exception   StandardException thrown on failure
 */
public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent) throws StandardException {
    DataTypeDescriptor dtd;
    ExecRow row;
    DataValueDescriptor col;
    String name = null;
    UUID oid = null;
    String uuid = null;
    String aid = null;
    if (td != null) {
        SchemaDescriptor schemaDescriptor = (SchemaDescriptor) td;
        name = schemaDescriptor.getSchemaName();
        oid = schemaDescriptor.getUUID();
        if (oid == null) {
            oid = getUUIDFactory().createUUID();
            schemaDescriptor.setUUID(oid);
        }
        uuid = oid.toString();
        aid = schemaDescriptor.getAuthorizationId();
    }
    /* Build the row to insert */
    row = getExecutionFactory().getValueRow(SYSSCHEMAS_COLUMN_COUNT);
    /* 1st column is SCHEMAID */
    row.setColumn(1, new SQLChar(uuid));
    /* 2nd column is SCHEMANAME */
    row.setColumn(2, new SQLVarchar(name));
    /* 3rd column is SCHEMAAID */
    row.setColumn(3, new SQLVarchar(aid));
    return row;
}
Also used : SchemaDescriptor(org.apache.derby.iapi.sql.dictionary.SchemaDescriptor) DataTypeDescriptor(org.apache.derby.iapi.types.DataTypeDescriptor) 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) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar)

Example 18 with SQLVarchar

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

the class SYSSEQUENCESRowFactory method makeRow.

/**
 * Make a SYSSEQUENCES row
 *
 * @param td     a sequence descriptor
 * @param parent unused
 * @return Row suitable for inserting into SYSSEQUENCES.
 * @throws org.apache.derby.shared.common.error.StandardException
 *          thrown on failure
 */
public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent) throws StandardException {
    ExecRow row;
    String oidString = null;
    String sequenceName = null;
    String schemaIdString = null;
    TypeDescriptor typeDesc = null;
    Long currentValue = null;
    long startValue = 0;
    long minimumValue = 0;
    long maximumValue = 0;
    long increment = 0;
    boolean canCycle = false;
    if (td != null) {
        SequenceDescriptor sd = (SequenceDescriptor) td;
        UUID oid = sd.getUUID();
        oidString = oid.toString();
        sequenceName = sd.getSequenceName();
        UUID schemaId = sd.getSchemaId();
        schemaIdString = schemaId.toString();
        typeDesc = sd.getDataType().getCatalogType();
        currentValue = sd.getCurrentValue();
        startValue = sd.getStartValue();
        minimumValue = sd.getMinimumValue();
        maximumValue = sd.getMaximumValue();
        increment = sd.getIncrement();
        canCycle = sd.canCycle();
    }
    /* Build the row to insert */
    row = getExecutionFactory().getValueRow(SYSSEQUENCES_COLUMN_COUNT);
    /* 1st column is UUID */
    row.setColumn(SYSSEQUENCES_SEQUENCEID, new SQLChar(oidString));
    /* 2nd column is SEQUENCENAME */
    row.setColumn(SYSSEQUENCES_SEQUENCENAME, new SQLVarchar(sequenceName));
    /* 3nd column is SCHEMAID */
    row.setColumn(SYSSEQUENCES_SCHEMAID, new SQLChar(schemaIdString));
    /* 4th column is SEQUENCEDATATYPE */
    row.setColumn(SYSSEQUENCES_SEQUENCEDATATYPE, new UserType(typeDesc));
    /* 5th column is CURRENTVALUE */
    SQLLongint curVal;
    if (currentValue == null) {
        curVal = new SQLLongint();
    } else {
        curVal = new SQLLongint(currentValue.longValue());
    }
    row.setColumn(SYSSEQUENCES_CURRENT_VALUE, curVal);
    /* 6th column is STARTVALUE */
    row.setColumn(SYSSEQUENCES_START_VALUE, new SQLLongint(startValue));
    /* 7th column is MINIMUMVALUE */
    row.setColumn(SYSSEQUENCES_MINIMUM_VALUE, new SQLLongint(minimumValue));
    /* 8th column is MAXIMUMVALUE */
    row.setColumn(SYSSEQUENCES_MAXIMUM_VALUE, new SQLLongint(maximumValue));
    /* 9th column is INCREMENT */
    row.setColumn(SYSSEQUENCES_INCREMENT, new SQLLongint(increment));
    /* 10th column is CYCLEOPTION */
    row.setColumn(SYSSEQUENCES_CYCLE_OPTION, new SQLChar(canCycle ? "Y" : "N"));
    return row;
}
Also used : TypeDescriptor(org.apache.derby.catalog.TypeDescriptor) DataTypeDescriptor(org.apache.derby.iapi.types.DataTypeDescriptor) SQLLongint(org.apache.derby.iapi.types.SQLLongint) ExecRow(org.apache.derby.iapi.sql.execute.ExecRow) SQLChar(org.apache.derby.iapi.types.SQLChar) SequenceDescriptor(org.apache.derby.iapi.sql.dictionary.SequenceDescriptor) UUID(org.apache.derby.catalog.UUID) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar) UserType(org.apache.derby.iapi.types.UserType)

Example 19 with SQLVarchar

use of org.apache.derby.iapi.types.SQLVarchar 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 20 with SQLVarchar

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

the class SYSROLESRowFactory method makeRow.

/**
 * Make a SYSROLES row
 *
 * @param td a role grant descriptor
 * @param parent unused
 *
 * @return  Row suitable for inserting into SYSROLES.
 *
 * @exception   StandardException thrown on failure
 */
public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent) throws StandardException {
    ExecRow row;
    String oid_string = null;
    String roleid = null;
    String grantee = null;
    String grantor = null;
    boolean wao = false;
    boolean isdef = false;
    if (td != null) {
        RoleGrantDescriptor rgd = (RoleGrantDescriptor) td;
        roleid = rgd.getRoleName();
        grantee = rgd.getGrantee();
        grantor = rgd.getGrantor();
        wao = rgd.isWithAdminOption();
        isdef = rgd.isDef();
        UUID oid = rgd.getUUID();
        oid_string = oid.toString();
    }
    /* Build the row to insert */
    row = getExecutionFactory().getValueRow(SYSROLES_COLUMN_COUNT);
    /* 1st column is UUID */
    row.setColumn(1, new SQLChar(oid_string));
    /* 2nd column is ROLEID */
    row.setColumn(2, new SQLVarchar(roleid));
    /* 3rd column is GRANTEE */
    row.setColumn(3, new SQLVarchar(grantee));
    /* 4th column is GRANTOR */
    row.setColumn(4, new SQLVarchar(grantor));
    /* 5th column is WITHADMINOPTION */
    row.setColumn(5, new SQLChar(wao ? "Y" : "N"));
    /* 6th column is ISDEF */
    row.setColumn(6, new SQLChar(isdef ? "Y" : "N"));
    return row;
}
Also used : ExecRow(org.apache.derby.iapi.sql.execute.ExecRow) SQLChar(org.apache.derby.iapi.types.SQLChar) UUID(org.apache.derby.catalog.UUID) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar) RoleGrantDescriptor(org.apache.derby.iapi.sql.dictionary.RoleGrantDescriptor)

Aggregations

SQLVarchar (org.apache.derby.iapi.types.SQLVarchar)45 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)33 ExecIndexRow (org.apache.derby.iapi.sql.execute.ExecIndexRow)30 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)22 SQLChar (org.apache.derby.iapi.types.SQLChar)18 TupleDescriptor (org.apache.derby.iapi.sql.dictionary.TupleDescriptor)13 UUID (org.apache.derby.catalog.UUID)9 SQLLongint (org.apache.derby.iapi.types.SQLLongint)6 ScanController (org.apache.derby.iapi.store.access.ScanController)5 UserType (org.apache.derby.iapi.types.UserType)5 Timestamp (java.sql.Timestamp)4 SchemaDescriptor (org.apache.derby.iapi.sql.dictionary.SchemaDescriptor)4 ConglomerateController (org.apache.derby.iapi.store.access.ConglomerateController)4 DataTypeDescriptor (org.apache.derby.iapi.types.DataTypeDescriptor)4 SQLBoolean (org.apache.derby.iapi.types.SQLBoolean)4 ArrayList (java.util.ArrayList)3 AliasDescriptor (org.apache.derby.iapi.sql.dictionary.AliasDescriptor)3 SQLTimestamp (org.apache.derby.iapi.types.SQLTimestamp)3 LinkedList (java.util.LinkedList)2 List (java.util.List)2