use of org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator in project derby by apache.
the class SYSFOREIGNKEYSRowFactory method buildDescriptor.
// /////////////////////////////////////////////////////////////////////////
//
// ABSTRACT METHODS TO BE IMPLEMENTED BY CHILDREN OF CatalogRowFactory
//
// /////////////////////////////////////////////////////////////////////////
/**
* Make a ViewDescriptor out of a SYSFOREIGNKEYS row
*
* @param row a SYSFOREIGNKEYS row
* @param parentTupleDescriptor Null for this kind of descriptor.
* @param dd dataDictionary
*
* @exception StandardException thrown on failure
*/
public TupleDescriptor buildDescriptor(ExecRow row, TupleDescriptor parentTupleDescriptor, DataDictionary dd) throws StandardException {
if (SanityManager.DEBUG) {
SanityManager.ASSERT(row.nColumns() == SYSFOREIGNKEYS_COLUMN_COUNT, "Wrong number of columns for a SYSKEYS row");
}
DataValueDescriptor col;
DataDescriptorGenerator ddg;
UUID constraintUUID;
UUID conglomerateUUID;
UUID keyConstraintUUID;
String constraintUUIDString;
String conglomerateUUIDString;
String raRuleString;
int raDeleteRule;
int raUpdateRule;
ddg = dd.getDataDescriptorGenerator();
/* 1st column is CONSTRAINTID (UUID - char(36)) */
col = row.getColumn(SYSFOREIGNKEYS_CONSTRAINTID);
constraintUUIDString = col.getString();
constraintUUID = getUUIDFactory().recreateUUID(constraintUUIDString);
/* 2nd column is CONGLOMERATEID (UUID - char(36)) */
col = row.getColumn(SYSFOREIGNKEYS_CONGLOMERATEID);
conglomerateUUIDString = col.getString();
conglomerateUUID = getUUIDFactory().recreateUUID(conglomerateUUIDString);
/* 3rd column is KEYCONSTRAINTID (UUID - char(36)) */
col = row.getColumn(SYSFOREIGNKEYS_KEYCONSTRAINTID);
constraintUUIDString = col.getString();
keyConstraintUUID = getUUIDFactory().recreateUUID(constraintUUIDString);
/* 4th column is DELETERULE char(1) */
col = row.getColumn(SYSFOREIGNKEYS_DELETERULE);
raRuleString = col.getString();
raDeleteRule = getRefActionAsInt(raRuleString);
/* 5th column is UPDATERULE char(1) */
col = row.getColumn(SYSFOREIGNKEYS_UPDATERULE);
raRuleString = col.getString();
raUpdateRule = getRefActionAsInt(raRuleString);
/* now build and return the descriptor */
return new SubKeyConstraintDescriptor(constraintUUID, conglomerateUUID, keyConstraintUUID, raDeleteRule, raUpdateRule);
}
use of org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator in project derby by apache.
the class SYSKEYSRowFactory method buildDescriptor.
// /////////////////////////////////////////////////////////////////////////
//
// ABSTRACT METHODS TO BE IMPLEMENTED BY CHILDREN OF CatalogRowFactory
//
// /////////////////////////////////////////////////////////////////////////
/**
* Make a SubConstraintDescriptor out of a SYSKEYS row
*
* @param row a SYSKEYS row
* @param parentTupleDescriptor Null for this kind of descriptor.
* @param dd dataDictionary
*
* @exception StandardException thrown on failure
*/
public TupleDescriptor buildDescriptor(ExecRow row, TupleDescriptor parentTupleDescriptor, DataDictionary dd) throws StandardException {
SubKeyConstraintDescriptor keyDesc = null;
if (SanityManager.DEBUG) {
SanityManager.ASSERT(row.nColumns() == SYSKEYS_COLUMN_COUNT, "Wrong number of columns for a SYSKEYS row");
}
DataValueDescriptor col;
DataDescriptorGenerator ddg;
UUID constraintUUID;
UUID conglomerateUUID;
String constraintUUIDString;
String conglomerateUUIDString;
ddg = dd.getDataDescriptorGenerator();
/* 1st column is CONSTRAINTID (UUID - char(36)) */
col = row.getColumn(SYSKEYS_CONSTRAINTID);
constraintUUIDString = col.getString();
constraintUUID = getUUIDFactory().recreateUUID(constraintUUIDString);
/* 2nd column is CONGLOMERATEID (UUID - char(36)) */
col = row.getColumn(SYSKEYS_CONGLOMERATEID);
conglomerateUUIDString = col.getString();
conglomerateUUID = getUUIDFactory().recreateUUID(conglomerateUUIDString);
/* now build and return the descriptor */
keyDesc = new SubKeyConstraintDescriptor(constraintUUID, conglomerateUUID);
return keyDesc;
}
use of org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator in project derby by apache.
the class SYSPERMSRowFactory method buildDescriptor.
// /////////////////////////////////////////////////////////////////////////
//
// ABSTRACT METHODS TO BE IMPLEMENTED BY CHILDREN OF CatalogRowFactory
//
// /////////////////////////////////////////////////////////////////////////
/**
* Make an Tuple Descriptor out of a SYSPERMS row
*
* @param row a SYSPERMS row
* @param parentTupleDescriptor unused
* @param dd dataDictionary
* @return a descriptor equivalent to a SYSPERMS 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;
PermDescriptor descriptor;
String permIdString;
String objectType;
String objectIdString;
String permission;
String grantor;
String grantee;
String isGrantable;
DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
if (SanityManager.DEBUG) {
SanityManager.ASSERT(row.nColumns() == SYSPERMS_COLUMN_COUNT, "Wrong number of columns for a SYSPERMS row");
}
// first column is uuid of this permission descriptor (char(36))
col = row.getColumn(SYSPERMS_PERMISSIONID);
permIdString = col.getString();
// second column is objectType (varchar(36))
col = row.getColumn(SYSPERMS_OBJECTTYPE);
objectType = col.getString();
// third column is objectid (varchar(36))
col = row.getColumn(SYSPERMS_OBJECTID);
objectIdString = col.getString();
// fourth column is permission (varchar(128))
col = row.getColumn(SYSPERMS_PERMISSION);
permission = col.getString();
// fifth column is grantor auth Id (varchar(128))
col = row.getColumn(SYSPERMS_GRANTOR);
grantor = col.getString();
// sixth column is grantee auth Id (varchar(128))
col = row.getColumn(SYSPERMS_GRANTEE);
grantee = col.getString();
// seventh column is isGrantable (char(1))
col = row.getColumn(SYSPERMS_IS_GRANTABLE);
isGrantable = col.getString();
descriptor = ddg.newPermDescriptor(getUUIDFactory().recreateUUID(permIdString), objectType, getUUIDFactory().recreateUUID(objectIdString), permission, grantor, grantee, isGrantable.equals("Y") ? true : false);
return descriptor;
}
use of org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator 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;
}
use of org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator 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;
}
Aggregations