use of org.apache.derby.iapi.sql.Activation in project derby by apache.
the class GenericResultSetFactory method getDeleteCascadeResultSet.
/**
* @see ResultSetFactory#getDeleteCascadeResultSet
* @exception StandardException thrown on error
*/
public ResultSet getDeleteCascadeResultSet(NoPutResultSet source, int constantActionItem, ResultSet[] dependentResultSets, String resultSetId) throws StandardException {
Activation activation = source.getActivation();
getAuthorizer(activation).authorize(activation, Authorizer.SQL_WRITE_OP);
return new DeleteCascadeResultSet(source, activation, constantActionItem, dependentResultSets, resultSetId);
}
use of org.apache.derby.iapi.sql.Activation in project derby by apache.
the class GenericResultSetFactory method getDeleteResultSet.
/**
* @see ResultSetFactory#getDeleteResultSet
* @exception StandardException thrown on error
*/
public ResultSet getDeleteResultSet(NoPutResultSet source) throws StandardException {
Activation activation = source.getActivation();
getAuthorizer(activation).authorize(activation, Authorizer.SQL_WRITE_OP);
return new DeleteResultSet(source, activation);
}
use of org.apache.derby.iapi.sql.Activation in project derby by apache.
the class GenericLanguageConnectionContext method resetSchemaUsages.
/**
* @see LanguageConnectionContext#resetSchemaUsages(Activation activation,
* String schemaName)
*/
public void resetSchemaUsages(Activation activation, String schemaName) throws StandardException {
Activation parent = activation.getParentActivation();
SchemaDescriptor defaultSchema = getInitialDefaultSchemaDescriptor();
// walk SQL session context chain
while (parent != null) {
SQLSessionContext ssc = parent.getSQLSessionContextForChildren();
SchemaDescriptor s = ssc.getDefaultSchema();
if (SanityManager.DEBUG) {
SanityManager.ASSERT(s != null, "s should not be empty here");
}
if (schemaName.equals(s.getSchemaName())) {
ssc.setDefaultSchema(defaultSchema);
}
parent = parent.getParentActivation();
}
// finally top level
SQLSessionContext top = getTopLevelSQLSessionContext();
SchemaDescriptor sd = top.getDefaultSchema();
if (SanityManager.DEBUG) {
SanityManager.ASSERT(sd != null, "sd should not be empty here");
}
if (schemaName.equals(sd.getSchemaName())) {
top.setDefaultSchema(defaultSchema);
}
}
use of org.apache.derby.iapi.sql.Activation in project derby by apache.
the class GenericLanguageConnectionContext method verifyNoOpenResultSets.
/**
* Verify that there are no activations with open result sets
* on the specified prepared statement.
*
* @param pStmt The prepared Statement
* @param provider The object precipitating a possible invalidation
* @param action The action causing the possible invalidation
*
* @return Nothing.
*
* @exception StandardException thrown on failure
*/
public boolean verifyNoOpenResultSets(PreparedStatement pStmt, Provider provider, int action) throws StandardException {
/*
** It is not a problem to create an index when there is an open
** result set, since it doesn't invalidate the access path that was
** chosen for the result set.
*/
boolean seenOpenResultSets = false;
// in this list, thus invalidating the Enumeration
for (int i = acts.size() - 1; i >= 0; i--) {
Activation a = acts.get(i);
if (!a.isInUse()) {
continue;
}
/* for this prepared statement */
if (pStmt == a.getPreparedStatement()) {
ResultSet rs = a.getResultSet();
/* is there an open result set? */
if (rs != null && !rs.isClosed()) {
if (!rs.returnsRows())
continue;
seenOpenResultSets = true;
break;
}
}
}
if (!seenOpenResultSets)
return false;
// There may be open ResultSet's that are yet to be garbage collected
// let's try and force these out rather than throw an error
System.gc();
System.runFinalization();
// in this list, thus invalidating the Enumeration
for (int i = acts.size() - 1; i >= 0; i--) {
Activation a = acts.get(i);
if (!a.isInUse()) {
continue;
}
/* for this prepared statement */
if (pStmt == a.getPreparedStatement()) {
ResultSet rs = a.getResultSet();
/* is there an open result set? */
if (rs != null && !rs.isClosed()) {
if ((provider != null) && rs.returnsRows()) {
DependencyManager dmgr = getDataDictionary().getDependencyManager();
throw StandardException.newException(SQLState.LANG_CANT_INVALIDATE_OPEN_RESULT_SET, dmgr.getActionString(action), provider.getObjectName());
}
return true;
}
}
}
return false;
}
use of org.apache.derby.iapi.sql.Activation in project derby by apache.
the class GenericResultSetFactory method getDeleteCascadeUpdateResultSet.
/**
* @see ResultSetFactory#getDeleteCascadeUpdateResultSet
* @exception StandardException thrown on error
*/
public ResultSet getDeleteCascadeUpdateResultSet(NoPutResultSet source, GeneratedMethod generationClauses, GeneratedMethod checkGM, int constantActionItem, int rsdItem) throws StandardException {
Activation activation = source.getActivation();
getAuthorizer(activation).authorize(activation, Authorizer.SQL_WRITE_OP);
return new UpdateResultSet(source, generationClauses, checkGM, activation, constantActionItem, rsdItem);
}
Aggregations