use of org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator in project derby by apache.
the class SystemProcedures method makeUserDescriptor.
private static UserDescriptor makeUserDescriptor(DataDictionary dd, TransactionController tc, String userName, String password) throws StandardException {
DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
PasswordHasher hasher = dd.makePasswordHasher(tc.getProperties());
if (hasher == null) {
throw StandardException.newException(SQLState.WEAK_AUTHENTICATION);
}
String hashingScheme = hasher.encodeHashingScheme();
String hashedPassword = hasher.hashPasswordIntoString(userName, password);
Timestamp currentTimestamp = new Timestamp((new java.util.Date()).getTime());
UserDescriptor userDescriptor = ddg.newUserDescriptor(userName, hashingScheme, hashedPassword.toCharArray(), currentTimestamp);
return userDescriptor;
}
use of org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator in project derby by apache.
the class DataDictionaryImpl method boot.
/**
* Start-up method for this instance of the data dictionary.
*
* @param startParams The start-up parameters
*
* @exception StandardException Thrown if the module fails to start
*/
public void boot(boolean create, Properties startParams) throws StandardException {
softwareVersion = new DD_Version(this, DataDictionary.DD_VERSION_DERBY_10_15);
startupParameters = startParams;
uuidFactory = getMonitor().getUUIDFactory();
engineType = Monitor.getEngineType(startParams);
// Set the collation type of system schemas before we start loading
// built-in schemas's SchemaDescriptor(s). This is because
// SchemaDescriptor will look to DataDictionary to get the correct
// collation type for themselves. We can't load SD for SESSION schema
// just yet because we do not know the collation type for user schemas
// yet. We will know the right collation for user schema little later
// in this boot method.
collationTypeOfSystemSchemas = StringDataValue.COLLATION_TYPE_UCS_BASIC;
getBuiltinSystemSchemas();
// REMIND: actually, we're supposed to get the DataValueFactory
// out of the connection context...this is a bit of a shortcut.
// We get the DataValueFactory early in order to help bootstrap the system catalogs.
LanguageConnectionFactory langConnFactory = (LanguageConnectionFactory) bootServiceModule(create, this, LanguageConnectionFactory.MODULE, startParams);
dvf = langConnFactory.getDataValueFactory();
exFactory = (ExecutionFactory) bootServiceModule(create, this, ExecutionFactory.MODULE, startParams);
// initailze the arrays of core and noncore tables
initializeCatalogInfo();
// indicate that we are in the process of booting
booting = true;
// set only if child class hasn't overriden this already
if (dataDescriptorGenerator == null) {
dataDescriptorGenerator = new DataDescriptorGenerator(this);
}
if (!create) {
// SYSTABLES
coreInfo[SYSTABLES_CORE_NUM].setHeapConglomerate(getBootParameter(startParams, CFG_SYSTABLES_ID, true));
coreInfo[SYSTABLES_CORE_NUM].setIndexConglomerate(SYSTABLESRowFactory.SYSTABLES_INDEX1_ID, getBootParameter(startParams, CFG_SYSTABLES_INDEX1_ID, true));
coreInfo[SYSTABLES_CORE_NUM].setIndexConglomerate(SYSTABLESRowFactory.SYSTABLES_INDEX2_ID, getBootParameter(startParams, CFG_SYSTABLES_INDEX2_ID, true));
// SYSCOLUMNS
coreInfo[SYSCOLUMNS_CORE_NUM].setHeapConglomerate(getBootParameter(startParams, CFG_SYSCOLUMNS_ID, true));
coreInfo[SYSCOLUMNS_CORE_NUM].setIndexConglomerate(SYSCOLUMNSRowFactory.SYSCOLUMNS_INDEX1_ID, getBootParameter(startParams, CFG_SYSCOLUMNS_INDEX1_ID, true));
// 2nd syscolumns index added in Xena, hence may not be there
coreInfo[SYSCOLUMNS_CORE_NUM].setIndexConglomerate(SYSCOLUMNSRowFactory.SYSCOLUMNS_INDEX2_ID, getBootParameter(startParams, CFG_SYSCOLUMNS_INDEX2_ID, false));
// SYSCONGLOMERATES
coreInfo[SYSCONGLOMERATES_CORE_NUM].setHeapConglomerate(getBootParameter(startParams, CFG_SYSCONGLOMERATES_ID, true));
coreInfo[SYSCONGLOMERATES_CORE_NUM].setIndexConglomerate(SYSCONGLOMERATESRowFactory.SYSCONGLOMERATES_INDEX1_ID, getBootParameter(startParams, CFG_SYSCONGLOMERATES_INDEX1_ID, true));
coreInfo[SYSCONGLOMERATES_CORE_NUM].setIndexConglomerate(SYSCONGLOMERATESRowFactory.SYSCONGLOMERATES_INDEX2_ID, getBootParameter(startParams, CFG_SYSCONGLOMERATES_INDEX2_ID, true));
coreInfo[SYSCONGLOMERATES_CORE_NUM].setIndexConglomerate(SYSCONGLOMERATESRowFactory.SYSCONGLOMERATES_INDEX3_ID, getBootParameter(startParams, CFG_SYSCONGLOMERATES_INDEX3_ID, true));
// SYSSCHEMAS
coreInfo[SYSSCHEMAS_CORE_NUM].setHeapConglomerate(getBootParameter(startParams, CFG_SYSSCHEMAS_ID, true));
coreInfo[SYSSCHEMAS_CORE_NUM].setIndexConglomerate(SYSSCHEMASRowFactory.SYSSCHEMAS_INDEX1_ID, getBootParameter(startParams, CFG_SYSSCHEMAS_INDEX1_ID, true));
coreInfo[SYSSCHEMAS_CORE_NUM].setIndexConglomerate(SYSSCHEMASRowFactory.SYSSCHEMAS_INDEX2_ID, getBootParameter(startParams, CFG_SYSSCHEMAS_INDEX2_ID, true));
}
String value = startParams.getProperty(Property.LANG_TD_CACHE_SIZE);
tdCacheSize = PropertyUtil.intPropertyValue(Property.LANG_TD_CACHE_SIZE, value, 0, Integer.MAX_VALUE, Property.LANG_TD_CACHE_SIZE_DEFAULT);
value = startParams.getProperty(Property.LANG_SPS_CACHE_SIZE);
stmtCacheSize = PropertyUtil.intPropertyValue(Property.LANG_SPS_CACHE_SIZE, value, 0, Integer.MAX_VALUE, Property.LANG_SPS_CACHE_SIZE_DEFAULT);
value = startParams.getProperty(Property.LANG_SEQGEN_CACHE_SIZE);
seqgenCacheSize = PropertyUtil.intPropertyValue(Property.LANG_SEQGEN_CACHE_SIZE, value, 0, Integer.MAX_VALUE, Property.LANG_SEQGEN_CACHE_SIZE_DEFAULT);
value = startParams.getProperty(Property.LANG_PERMISSIONS_CACHE_SIZE);
permissionsCacheSize = PropertyUtil.intPropertyValue(Property.LANG_PERMISSIONS_CACHE_SIZE, value, 0, Integer.MAX_VALUE, Property.LANG_PERMISSIONS_CACHE_SIZE_DEFAULT);
// See if automatic index statistics update is disabled through a
// system wide property. May be overridden by a database specific
// property later on.
// The default is that automatic index statistics update is enabled.
indexStatsUpdateDisabled = !PropertyUtil.getSystemBoolean(Property.STORAGE_AUTO_INDEX_STATS, true);
// See if we should enable logging of index stats activities.
indexStatsUpdateLogging = PropertyUtil.getSystemBoolean(Property.STORAGE_AUTO_INDEX_STATS_LOGGING);
// See if we should enable tracing of index stats activities.
indexStatsUpdateTracing = PropertyUtil.getSystemProperty(Property.STORAGE_AUTO_INDEX_STATS_TRACING, "off");
/*
* data dictionary contexts are only associated with connections.
* we have to look for the basic data dictionary, as there is
* no connection, and thus no context stack yet.
*/
/*
* Get the table descriptor cache.
*/
CacheFactory cf = (CacheFactory) startSystemModule(org.apache.derby.shared.common.reference.Module.CacheFactory);
OIDTdCache = cf.newCacheManager(this, "TableDescriptorOIDCache", tdCacheSize, tdCacheSize);
nameTdCache = cf.newCacheManager(this, "TableDescriptorNameCache", tdCacheSize, tdCacheSize);
if (stmtCacheSize > 0) {
spsNameCache = cf.newCacheManager(this, "SPSNameDescriptorCache", stmtCacheSize, stmtCacheSize);
spsIdHash = new Hashtable<UUID, SPSDescriptor>(stmtCacheSize);
// spsTextHash = new Hashtable(stmtCacheSize);
}
sequenceGeneratorCache = cf.newCacheManager(this, "SequenceGeneratorCache", seqgenCacheSize, seqgenCacheSize);
sequenceIDs = new HashMap<String, HashMap<String, String>>();
/* Get the object to coordinate cache transitions */
cacheCoordinator = new ShExLockable();
/* Get AccessFactory in order to transaction stuff */
af = (AccessFactory) findServiceModule(this, AccessFactory.MODULE);
/* Get the lock factory */
lockFactory = af.getLockFactory();
/*
* now we need to setup a context stack for the database creation work.
* We assume the System boot process has created a context
* manager already, but not that contexts we need are there.
*/
ContextService csf = getContextService();
ContextManager cm = csf.getCurrentContextManager();
if (SanityManager.DEBUG)
SanityManager.ASSERT((cm != null), "Failed to get current ContextManager");
// RESOLVE other non-StandardException errors.
bootingTC = null;
try {
// Get a transaction controller. This has the side effect of
// creating a transaction context if there isn't one already.
bootingTC = af.getTransaction(cm);
/*
We need an execution context so that we can generate rows
REMIND: maybe only for create case?
*/
exFactory.newExecutionContext(cm);
DataDescriptorGenerator ddg = getDataDescriptorGenerator();
// We should set the user schema collation type here now because
// later on, we are going to create user schema APP. By the time any
// user schema gets created, we should have the correct collation
// type set for such schemas to use. For this reason, don't remove
// the following if else statement and don't move it later in this
// method.
String userDefinedCollation;
if (create) {
// Get the collation attribute from the JDBC url. It can only
// have one of 2 possible values - UCS_BASIC or TERRITORY_BASED
// This attribute can only be specified at database create time.
// The attribute value has already been verified in DVF.boot and
// hence we can be assured that the attribute value if provided
// is either UCS_BASIC or TERRITORY_BASED. If none provided,
// then we will take it to be the default which is UCS_BASIC.
userDefinedCollation = startParams.getProperty(Attribute.COLLATION, Property.UCS_BASIC_COLLATION);
bootingTC.setProperty(Property.COLLATION, userDefinedCollation, true);
} else {
userDefinedCollation = startParams.getProperty(Property.COLLATION, Property.UCS_BASIC_COLLATION);
}
// Initialize the collation type of user schemas by looking at
// collation property/attribute.
collationTypeOfUserSchemas = DataTypeDescriptor.getCollationType(userDefinedCollation);
if (SanityManager.DEBUG)
SanityManager.ASSERT((collationTypeOfUserSchemas != -1), "Invalid collation type: " + userDefinedCollation);
// Now is also a good time to create schema descriptor for global
// temporary tables. Since this is a user schema, it should use the
// collation type associated with user schemas. Since we just
// finished setting up the collation type of user schema, it is
// safe to create user SchemaDescriptor(s) now.
declaredGlobalTemporaryTablesSchemaDesc = newDeclaredGlobalTemporaryTablesSchemaDesc(SchemaDescriptor.STD_DECLARED_GLOBAL_TEMPORARY_TABLES_SCHEMA_NAME);
boolean nativeAuthenticationEnabled = PropertyUtil.nativeAuthenticationEnabled(startParams);
if (create) {
String userName = IdUtil.getUserNameFromURLProps(startParams);
authorizationDatabaseOwner = IdUtil.getUserAuthorizationId(userName);
HashSet<String> newlyCreatedRoutines = new HashSet<String>();
// log the current dictionary version. Moving this statement to top as SYSCOLUMNSRowFactory
// queries the version info. SEE Derby-6904
dictionaryVersion = softwareVersion;
// create any required tables.
createDictionaryTables(startParams, bootingTC, ddg);
// create procedures for network server metadata
create_SYSIBM_procedures(bootingTC, newlyCreatedRoutines);
// create metadata sps statement required for network server
createSystemSps(bootingTC);
// create the SYSCS_UTIL system procedures)
create_SYSCS_procedures(bootingTC, newlyCreatedRoutines);
// now grant execute permission on some of these routines
grantPublicAccessToSystemRoutines(newlyCreatedRoutines, bootingTC, authorizationDatabaseOwner);
/* Set properties for current and create time
* DataDictionary versions.
*/
bootingTC.setProperty(DataDictionary.CORE_DATA_DICTIONARY_VERSION, dictionaryVersion, true);
bootingTC.setProperty(DataDictionary.CREATE_DATA_DICTIONARY_VERSION, dictionaryVersion, true);
//
if (PropertyUtil.getSystemBoolean(Property.SQL_AUTHORIZATION_PROPERTY)) {
bootingTC.setProperty(Property.SQL_AUTHORIZATION_PROPERTY, "true", true);
}
if (PropertyUtil.getSystemBoolean(Property.SQL_AUTHORIZATION_PROPERTY) || nativeAuthenticationEnabled) {
usesSqlAuthorization = true;
}
// Set default hash algorithm used to protect passwords stored
// in the database for BUILTIN and NATIVE authentication.
bootingTC.setProperty(Property.AUTHENTICATION_BUILTIN_ALGORITHM, findDefaultBuiltinAlgorithm(), false);
} else {
// Get the ids for non-core tables
loadDictionaryTables(bootingTC, startParams);
// See if index stats update is disabled by a database prop.
String dbIndexStatsUpdateAuto = PropertyUtil.getDatabaseProperty(bootingTC, Property.STORAGE_AUTO_INDEX_STATS);
if (dbIndexStatsUpdateAuto != null) {
indexStatsUpdateDisabled = !Boolean.valueOf(dbIndexStatsUpdateAuto).booleanValue();
}
String dbEnableIndexStatsLogging = PropertyUtil.getDatabaseProperty(bootingTC, Property.STORAGE_AUTO_INDEX_STATS_LOGGING);
if (dbEnableIndexStatsLogging != null) {
indexStatsUpdateLogging = Boolean.valueOf(dbEnableIndexStatsLogging).booleanValue();
}
String dbEnableIndexStatsTracing = PropertyUtil.getDatabaseProperty(bootingTC, Property.STORAGE_AUTO_INDEX_STATS_TRACING);
if (dbEnableIndexStatsTracing != null) {
if (!(dbEnableIndexStatsTracing.equalsIgnoreCase("off") || dbEnableIndexStatsTracing.equalsIgnoreCase("log") || dbEnableIndexStatsTracing.equalsIgnoreCase("stdout") || dbEnableIndexStatsTracing.equalsIgnoreCase("both"))) {
indexStatsUpdateTracing = "off";
} else {
indexStatsUpdateTracing = dbEnableIndexStatsTracing;
}
}
String sqlAuth = PropertyUtil.getDatabaseProperty(bootingTC, Property.SQL_AUTHORIZATION_PROPERTY);
// Feature compatibility check.
if (Boolean.valueOf(startParams.getProperty(Attribute.SOFT_UPGRADE_NO_FEATURE_CHECK)).booleanValue()) {
// database owner check at a hard upgrade.
if (dictionaryVersion.majorVersionNumber >= DataDictionary.DD_VERSION_DERBY_10_2) {
usesSqlAuthorization = Boolean.valueOf(sqlAuth).booleanValue() || nativeAuthenticationEnabled;
}
} else {
if (Boolean.valueOf(sqlAuth).booleanValue() || nativeAuthenticationEnabled) {
// SQL authorization requires 10.2 or higher database
checkVersion(DataDictionary.DD_VERSION_DERBY_10_2, "sqlAuthorization");
usesSqlAuthorization = true;
}
}
}
if (SanityManager.DEBUG)
SanityManager.ASSERT((authorizationDatabaseOwner != null), "Failed to get Database Owner authorization");
/* Commit & destroy the create database */
bootingTC.commit();
// done with ctx
cm.getContext(ExecutionContext.CONTEXT_ID).popMe();
} finally {
if (bootingTC != null) {
// gets rid of the transaction context
bootingTC.destroy();
bootingTC = null;
}
}
setDependencyManager();
booting = false;
}
use of org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator in project derby by apache.
the class SYSTABLESRowFactory method buildDescriptorBody.
public TupleDescriptor buildDescriptorBody(ExecRow row, TupleDescriptor parentTupleDescriptor, DataDictionary dd, int isolationLevel) throws StandardException {
if (SanityManager.DEBUG)
SanityManager.ASSERT(row.nColumns() == SYSTABLES_COLUMN_COUNT, "Wrong number of columns for a SYSTABLES row");
DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
String tableUUIDString;
String schemaUUIDString;
int tableTypeEnum;
String lockGranularity;
String tableName, tableType;
DataValueDescriptor col;
UUID tableUUID;
UUID schemaUUID;
SchemaDescriptor schema;
TableDescriptor tabDesc;
/* 1st column is TABLEID (UUID - char(36)) */
col = row.getColumn(SYSTABLES_TABLEID);
tableUUIDString = col.getString();
tableUUID = getUUIDFactory().recreateUUID(tableUUIDString);
/* 2nd column is TABLENAME (varchar(128)) */
col = row.getColumn(SYSTABLES_TABLENAME);
tableName = col.getString();
/* 3rd column is TABLETYPE (char(1)) */
col = row.getColumn(SYSTABLES_TABLETYPE);
tableType = col.getString();
if (SanityManager.DEBUG) {
SanityManager.ASSERT(tableType.length() == 1, "Fourth column type incorrect");
}
switch(tableType.charAt(0)) {
case 'T':
tableTypeEnum = TableDescriptor.BASE_TABLE_TYPE;
break;
case 'S':
tableTypeEnum = TableDescriptor.SYSTEM_TABLE_TYPE;
break;
case 'V':
tableTypeEnum = TableDescriptor.VIEW_TYPE;
break;
case 'A':
tableTypeEnum = TableDescriptor.SYNONYM_TYPE;
break;
default:
if (SanityManager.DEBUG)
SanityManager.THROWASSERT("Fourth column value invalid");
tableTypeEnum = -1;
}
/* 4th column is SCHEMAID (UUID - char(36)) */
col = row.getColumn(SYSTABLES_SCHEMAID);
schemaUUIDString = col.getString();
schemaUUID = getUUIDFactory().recreateUUID(schemaUUIDString);
schema = dd.getSchemaDescriptor(schemaUUID, isolationLevel, null);
/* 5th column is LOCKGRANULARITY (char(1)) */
col = row.getColumn(SYSTABLES_LOCKGRANULARITY);
lockGranularity = col.getString();
if (SanityManager.DEBUG) {
SanityManager.ASSERT(lockGranularity.length() == 1, "Fifth column type incorrect");
}
// RESOLVE - Deal with lock granularity
tabDesc = ddg.newTableDescriptor(tableName, schema, tableTypeEnum, lockGranularity.charAt(0));
tabDesc.setUUID(tableUUID);
return tabDesc;
}
use of org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator in project derby by apache.
the class SYSTRIGGERSRowFactory method buildDescriptor.
// /////////////////////////////////////////////////////////////////////////
//
// ABSTRACT METHODS TO BE IMPLEMENTED BY CHILDREN OF CatalogRowFactory
//
// /////////////////////////////////////////////////////////////////////////
/**
* Make an Tuple Descriptor out of a SYSTRIGGERS row
*
* @param row a SYSTRIGGERS row
* @param parentTupleDescriptor unused
* @param dd dataDictionary
*
* @return a descriptor equivalent to a SYSTRIGGERS row
*
* @exception StandardException thrown on failure
*/
public TupleDescriptor buildDescriptor(ExecRow row, TupleDescriptor parentTupleDescriptor, DataDictionary dd) throws StandardException {
DataValueDescriptor col;
String name;
char theChar;
String uuidStr;
String triggerDefinition;
String oldReferencingName;
String newReferencingName;
UUID uuid;
// schema
UUID suuid;
// referenced table
UUID tuuid;
// action sps uuid string
UUID actionSPSID = null;
// when clause sps uuid string
UUID whenSPSID = null;
Timestamp createTime;
int eventMask = 0;
boolean isBefore;
boolean isRow;
boolean isEnabled;
boolean referencingOld;
boolean referencingNew;
ReferencedColumns rcd;
TriggerDescriptor descriptor;
DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
if (SanityManager.DEBUG) {
// The expected number of columns depends on the version of the
// data dictionary. The WHENCLAUSETEXT column was added in version
// 10.11 (DERBY-534).
int expectedCols = dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_11, null) ? SYSTRIGGERS_COLUMN_COUNT : (SYSTRIGGERS_COLUMN_COUNT - 1);
SanityManager.ASSERT(row.nColumns() == expectedCols, "Wrong number of columns for a SYSTRIGGERS row");
}
// 1st column is TRIGGERID (UUID - char(36))
col = row.getColumn(1);
uuidStr = col.getString();
uuid = getUUIDFactory().recreateUUID(uuidStr);
// 2nd column is TRIGGERNAME (varchar(128))
col = row.getColumn(2);
name = col.getString();
// 3rd column is SCHEMAID (UUID - char(36))
col = row.getColumn(3);
uuidStr = col.getString();
suuid = getUUIDFactory().recreateUUID(uuidStr);
// 4th column is CREATIONTIMESTAMP (TIMESTAMP)
col = row.getColumn(4);
createTime = col.getTimestamp(getCalendarForCreationTimestamp());
// 5th column is EVENT (char(1))
col = row.getColumn(5);
theChar = col.getString().charAt(0);
switch(theChar) {
case 'U':
eventMask = TriggerDescriptor.TRIGGER_EVENT_UPDATE;
break;
case 'I':
eventMask = TriggerDescriptor.TRIGGER_EVENT_INSERT;
break;
case 'D':
eventMask = TriggerDescriptor.TRIGGER_EVENT_DELETE;
break;
default:
if (SanityManager.DEBUG) {
SanityManager.THROWASSERT("bad event mask: " + theChar);
}
}
// 6th column is FIRINGTIME (char(1))
isBefore = getCharBoolean(row.getColumn(6), 'B', 'A');
// 7th column is TYPE (char(1))
isRow = getCharBoolean(row.getColumn(7), 'R', 'S');
// 8th column is STATE (char(1))
isEnabled = getCharBoolean(row.getColumn(8), 'E', 'D');
// 9th column is TABLEID (UUID - char(36))
col = row.getColumn(9);
uuidStr = col.getString();
tuuid = getUUIDFactory().recreateUUID(uuidStr);
// 10th column is WHENSTMTID (UUID - char(36))
col = row.getColumn(10);
uuidStr = col.getString();
if (uuidStr != null)
whenSPSID = getUUIDFactory().recreateUUID(uuidStr);
// 11th column is ACTIONSTMTID (UUID - char(36))
col = row.getColumn(11);
uuidStr = col.getString();
if (uuidStr != null)
actionSPSID = getUUIDFactory().recreateUUID(uuidStr);
// 12th column is REFERENCEDCOLUMNS user type org.apache.derby.catalog.ReferencedColumns
col = row.getColumn(12);
rcd = (ReferencedColumns) col.getObject();
// 13th column is TRIGGERDEFINITION (longvarchar)
col = row.getColumn(13);
triggerDefinition = col.getString();
// 14th column is REFERENCINGOLD (boolean)
col = row.getColumn(14);
referencingOld = col.getBoolean();
// 15th column is REFERENCINGNEW (boolean)
col = row.getColumn(15);
referencingNew = col.getBoolean();
// 16th column is REFERENCINGNAME (varchar(128))
col = row.getColumn(16);
oldReferencingName = col.getString();
// 17th column is REFERENCINGNAME (varchar(128))
col = row.getColumn(17);
newReferencingName = col.getString();
// 18th column is WHENCLAUSETEXT (longvarchar)
String whenClauseText = null;
if (row.nColumns() >= 18) {
// This column is present only if the data dictionary version is
// 10.11 or higher.
col = row.getColumn(18);
whenClauseText = col.getString();
}
descriptor = ddg.newTriggerDescriptor(dd.getSchemaDescriptor(suuid, null), uuid, name, eventMask, isBefore, isRow, isEnabled, dd.getTableDescriptor(tuuid), whenSPSID, actionSPSID, createTime, (rcd == null) ? (int[]) null : rcd.getReferencedColumnPositions(), (rcd == null) ? (int[]) null : rcd.getTriggerActionReferencedColumnPositions(), triggerDefinition, referencingOld, referencingNew, oldReferencingName, newReferencingName, whenClauseText);
return descriptor;
}
use of org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator in project derby by apache.
the class SYSVIEWSRowFactory method buildDescriptor.
// /////////////////////////////////////////////////////////////////////////
//
// ABSTRACT METHODS TO BE IMPLEMENTED BY CHILDREN OF CatalogRowFactory
//
// /////////////////////////////////////////////////////////////////////////
/**
* Make a ViewDescriptor out of a SYSVIEWS row
*
* @param row a SYSVIEWS 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 {
ViewDescriptor vd = null;
if (SanityManager.DEBUG) {
SanityManager.ASSERT(row.nColumns() == SYSVIEWS_COLUMN_COUNT, "Wrong number of columns for a SYSVIEWS row");
}
DataValueDescriptor col;
DataDescriptorGenerator ddg;
int checkIType;
String checkSType;
String tableID;
String compSchemaId;
String viewDefinition;
UUID tableUUID;
UUID compSchemaUUID = null;
ddg = dd.getDataDescriptorGenerator();
/* 1st column is TABLEID (UUID - char(36)) */
col = row.getColumn(SYSVIEWS_TABLEID);
tableID = col.getString();
tableUUID = getUUIDFactory().recreateUUID(tableID);
/* 2nd column is VIEWDEFINITION */
col = row.getColumn(SYSVIEWS_VIEWDEFINITION);
viewDefinition = col.getString();
/* 3rd column is CHECKOPTION (char(1)) */
col = row.getColumn(SYSVIEWS_CHECKOPTION);
checkSType = col.getString();
if (SanityManager.DEBUG) {
if (!checkSType.equals("N")) {
SanityManager.THROWASSERT("checkSType expected to be 'N', not " + checkSType);
}
}
/* RESOLVE - no check options for now */
checkIType = ViewDescriptor.NO_CHECK_OPTION;
/* 4th column is COMPILATIONSCHEMAID (UUID - char(36)) */
col = row.getColumn(SYSVIEWS_COMPILATION_SCHEMAID);
compSchemaId = col.getString();
if (compSchemaId != null) {
compSchemaUUID = getUUIDFactory().recreateUUID(compSchemaId);
}
/* now build and return the descriptor */
vd = ddg.newViewDescriptor(tableUUID, null, viewDefinition, checkIType, compSchemaUUID);
return vd;
}
Aggregations