Search in sources :

Example 71 with UUID

use of org.apache.derby.catalog.UUID 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)

Example 72 with UUID

use of org.apache.derby.catalog.UUID in project derby by apache.

the class SYSROUTINEPERMSRowFactory method makeRow.

public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent) throws StandardException {
    UUID oid;
    String routinePermID = null;
    DataValueDescriptor grantee = null;
    DataValueDescriptor grantor = null;
    String routineID = null;
    if (td == null) {
        grantee = getNullAuthorizationID();
        grantor = getNullAuthorizationID();
    } else {
        RoutinePermsDescriptor rpd = (RoutinePermsDescriptor) td;
        oid = rpd.getUUID();
        if (oid == null) {
            oid = getUUIDFactory().createUUID();
            rpd.setUUID(oid);
        }
        routinePermID = oid.toString();
        grantee = getAuthorizationID(rpd.getGrantee());
        grantor = getAuthorizationID(rpd.getGrantor());
        if (rpd.getRoutineUUID() != null)
            routineID = rpd.getRoutineUUID().toString();
    }
    ExecRow row = getExecutionFactory().getValueRow(COLUMN_COUNT);
    row.setColumn(ROUTINEPERMSID_COL_NUM, new SQLChar(routinePermID));
    row.setColumn(GRANTEE_COL_NUM, grantee);
    row.setColumn(GRANTOR_COL_NUM, grantor);
    row.setColumn(ALIASID_COL_NUM, new SQLChar(routineID));
    row.setColumn(GRANTOPTION_COL_NUM, new SQLChar("N"));
    return row;
}
Also used : ExecRow(org.apache.derby.iapi.sql.execute.ExecRow) SQLChar(org.apache.derby.iapi.types.SQLChar) RoutinePermsDescriptor(org.apache.derby.iapi.sql.dictionary.RoutinePermsDescriptor) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) UUID(org.apache.derby.catalog.UUID)

Example 73 with UUID

use of org.apache.derby.catalog.UUID in project derby by apache.

the class SYSROUTINEPERMSRowFactory method buildDescriptor.

// end of makeRow
/**
 * builds a tuple descriptor from a row
 */
public TupleDescriptor buildDescriptor(ExecRow row, TupleDescriptor parentTuple, DataDictionary dataDictionary) throws StandardException {
    if (SanityManager.DEBUG)
        SanityManager.ASSERT(row.nColumns() == COLUMN_COUNT, "Wrong size row passed to SYSROUTINEPERMSRowFactory.buildDescriptor");
    String routinePermsUUIDString = row.getColumn(ROUTINEPERMSID_COL_NUM).getString();
    UUID routinePermsUUID = getUUIDFactory().recreateUUID(routinePermsUUIDString);
    String aliasUUIDString = row.getColumn(ALIASID_COL_NUM).getString();
    UUID aliasUUID = getUUIDFactory().recreateUUID(aliasUUIDString);
    RoutinePermsDescriptor routinePermsDesc = new RoutinePermsDescriptor(dataDictionary, getAuthorizationID(row, GRANTEE_COL_NUM), getAuthorizationID(row, GRANTOR_COL_NUM), aliasUUID);
    routinePermsDesc.setUUID(routinePermsUUID);
    return routinePermsDesc;
}
Also used : RoutinePermsDescriptor(org.apache.derby.iapi.sql.dictionary.RoutinePermsDescriptor) UUID(org.apache.derby.catalog.UUID)

Example 74 with UUID

use of org.apache.derby.catalog.UUID in project derby by apache.

the class SYSSCHEMASRowFactory method buildDescriptor.

// /////////////////////////////////////////////////////////////////////////
// 
// ABSTRACT METHODS TO BE IMPLEMENTED BY CHILDREN OF CatalogRowFactory
// 
// /////////////////////////////////////////////////////////////////////////
/**
 * Make an  Tuple Descriptor out of a SYSSCHEMAS row
 *
 * @param row 					a SYSSCHEMAS row
 * @param parentTupleDescriptor	unused
 * @param dd 					dataDictionary
 *
 * @return	a  descriptor equivalent to a SYSSCHEMAS row
 *
 * @exception   StandardException thrown on failure
 */
public TupleDescriptor buildDescriptor(ExecRow row, TupleDescriptor parentTupleDescriptor, DataDictionary dd) throws StandardException {
    DataValueDescriptor col;
    SchemaDescriptor descriptor;
    String name;
    UUID id;
    String aid;
    String uuid;
    DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
    if (SanityManager.DEBUG) {
        SanityManager.ASSERT(row.nColumns() == SYSSCHEMAS_COLUMN_COUNT, "Wrong number of columns for a SYSSCHEMAS row");
    }
    // first column is schemaid (UUID - char(36))
    col = row.getColumn(1);
    uuid = col.getString();
    id = getUUIDFactory().recreateUUID(uuid);
    // second column is schemaname (varchar(128))
    col = row.getColumn(2);
    name = col.getString();
    // third column is auid (varchar(128))
    col = row.getColumn(3);
    aid = col.getString();
    descriptor = ddg.newSchemaDescriptor(name, aid, id);
    return descriptor;
}
Also used : DataDescriptorGenerator(org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator) SchemaDescriptor(org.apache.derby.iapi.sql.dictionary.SchemaDescriptor) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) UUID(org.apache.derby.catalog.UUID)

Example 75 with UUID

use of org.apache.derby.catalog.UUID in project derby by apache.

the class SYSSEQUENCESRowFactory method buildDescriptor.

/**
 * Make an  Tuple Descriptor out of a SYSSEQUENCES row
 *
 * @param row                   a SYSSEQUENCES row
 * @param parentTupleDescriptor unused
 * @param dd                    dataDictionary
 * @return a  descriptor equivalent to a SYSSEQUENCES row
 * @throws org.apache.derby.shared.common.error.StandardException
 *          thrown on failure
 */
public TupleDescriptor buildDescriptor(ExecRow row, TupleDescriptor parentTupleDescriptor, DataDictionary dd) throws StandardException {
    DataValueDescriptor col;
    SequenceDescriptor descriptor;
    UUID ouuid;
    String sequenceName;
    UUID suuid;
    Long currentValue;
    long startValue;
    long minimumValue;
    long maximumValue;
    long increment;
    String cycleOption;
    DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
    if (SanityManager.DEBUG) {
        SanityManager.ASSERT(row.nColumns() == SYSSEQUENCES_COLUMN_COUNT, "Wrong number of columns for a SYSSEQUENCES row");
    }
    // first column is uuid of this sequence descriptor (char(36))
    col = row.getColumn(SYSSEQUENCES_SEQUENCEID);
    String oidString = col.getString();
    ouuid = getUUIDFactory().recreateUUID(oidString);
    // second column is sequenceName (varchar(128))
    col = row.getColumn(SYSSEQUENCES_SEQUENCENAME);
    sequenceName = col.getString();
    // third column is uuid of this sequence descriptors schema (char(36))
    col = row.getColumn(SYSSEQUENCES_SCHEMAID);
    String schemaIdString = col.getString();
    suuid = getUUIDFactory().recreateUUID(schemaIdString);
    // fourth column is the data type of this sequene generator
    /*
          ** What is stored in the column is a TypeDescriptorImpl, which
          ** points to a BaseTypeIdImpl.  These are simple types that are
          ** intended to be movable to the client, so they don't have
          ** the entire implementation.  We need to wrap them in DataTypeServices
          ** and TypeId objects that contain the full implementations for
          ** language processing.
          */
    TypeDescriptor catalogType = (TypeDescriptor) row.getColumn(SYSSEQUENCES_SEQUENCEDATATYPE).getObject();
    DataTypeDescriptor dataTypeServices = DataTypeDescriptor.getType(catalogType);
    col = row.getColumn(SYSSEQUENCES_CURRENT_VALUE);
    if (col.isNull()) {
        currentValue = null;
    } else {
        currentValue = col.getLong();
    }
    col = row.getColumn(SYSSEQUENCES_START_VALUE);
    startValue = col.getLong();
    col = row.getColumn(SYSSEQUENCES_MINIMUM_VALUE);
    minimumValue = col.getLong();
    col = row.getColumn(SYSSEQUENCES_MAXIMUM_VALUE);
    maximumValue = col.getLong();
    col = row.getColumn(SYSSEQUENCES_INCREMENT);
    increment = col.getLong();
    col = row.getColumn(SYSSEQUENCES_CYCLE_OPTION);
    cycleOption = col.getString();
    descriptor = ddg.newSequenceDescriptor(dd.getSchemaDescriptor(suuid, null), ouuid, sequenceName, dataTypeServices, currentValue, startValue, minimumValue, maximumValue, increment, cycleOption.equals("Y") ? true : false);
    return descriptor;
}
Also used : DataDescriptorGenerator(org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator) TypeDescriptor(org.apache.derby.catalog.TypeDescriptor) DataTypeDescriptor(org.apache.derby.iapi.types.DataTypeDescriptor) DataTypeDescriptor(org.apache.derby.iapi.types.DataTypeDescriptor) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) SequenceDescriptor(org.apache.derby.iapi.sql.dictionary.SequenceDescriptor) UUID(org.apache.derby.catalog.UUID)

Aggregations

UUID (org.apache.derby.catalog.UUID)101 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)31 DataDescriptorGenerator (org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator)23 TableDescriptor (org.apache.derby.iapi.sql.dictionary.TableDescriptor)22 SchemaDescriptor (org.apache.derby.iapi.sql.dictionary.SchemaDescriptor)21 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)19 ColumnDescriptor (org.apache.derby.iapi.sql.dictionary.ColumnDescriptor)15 DataDictionary (org.apache.derby.iapi.sql.dictionary.DataDictionary)15 SQLChar (org.apache.derby.iapi.types.SQLChar)15 LanguageConnectionContext (org.apache.derby.iapi.sql.conn.LanguageConnectionContext)14 TransactionController (org.apache.derby.iapi.store.access.TransactionController)14 ConglomerateDescriptor (org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor)12 SQLVarchar (org.apache.derby.iapi.types.SQLVarchar)12 DependencyManager (org.apache.derby.iapi.sql.depend.DependencyManager)11 FormatableBitSet (org.apache.derby.iapi.services.io.FormatableBitSet)10 ColumnDescriptorList (org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList)10 ConstraintDescriptor (org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor)10 ArrayList (java.util.ArrayList)9 DataTypeDescriptor (org.apache.derby.iapi.types.DataTypeDescriptor)9 ExecIndexRow (org.apache.derby.iapi.sql.execute.ExecIndexRow)8