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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations