/** * INTERNAL: * Closes a PreparedStatement (which is supposed to close it's current resultSet). * Factored out to simplify coding and handle exceptions. */ public void closeStatement(Statement statement, AbstractSession session, DatabaseCall call) throws SQLException { if (statement == null) { decrementCallCount(); return; } DatabaseQuery query = ((call == null)? null : call.getQuery()); try { session.startOperationProfile(SessionProfiler.STATEMENT_EXECUTE, query, SessionProfiler.ALL); statement.close(); } finally { session.endOperationProfile(SessionProfiler.STATEMENT_EXECUTE, query, SessionProfiler.ALL); decrementCallCount(); // If this is the cached dynamic statement, release it. if (statement == this.dynamicStatement) { this.dynamicStatement = null; // The dynamic statement is cached and only closed on disconnect. setIsDynamicStatementInUse(false); } } }
/** * INTERNAL: * Closes a PreparedStatement (which is supposed to close it's current resultSet). * Factored out to simplify coding and handle exceptions. */ public void closeStatement(Statement statement, AbstractSession session, DatabaseCall call) throws SQLException { if (statement == null) { decrementCallCount(); return; } DatabaseQuery query = ((call == null)? null : call.getQuery()); try { session.startOperationProfile(SessionProfiler.StatementExecute, query, SessionProfiler.ALL); statement.close(); } finally { session.endOperationProfile(SessionProfiler.StatementExecute, query, SessionProfiler.ALL); decrementCallCount(); // If this is the cached dynamic statement, release it. if (statement == this.dynamicStatement) { this.dynamicStatement = null; // The dynamic statement is cached and only closed on disconnect. setIsDynamicStatementInUse(false); } } }
/** * INTERNAL: * Closes a PreparedStatement (which is supposed to close it's current resultSet). * Factored out to simplify coding and handle exceptions. */ public void closeStatement(Statement statement, AbstractSession session, DatabaseCall call) throws SQLException { if (statement == null) { decrementCallCount(); return; } DatabaseQuery query = ((call == null)? null : call.getQuery()); try { session.startOperationProfile(SessionProfiler.StatementExecute, query, SessionProfiler.ALL); statement.close(); } finally { session.endOperationProfile(SessionProfiler.StatementExecute, query, SessionProfiler.ALL); decrementCallCount(); // If this is the cached dynamic statement, release it. if (statement == this.dynamicStatement) { this.dynamicStatement = null; // The dynamic statement is cached and only closed on disconnect. setIsDynamicStatementInUse(false); } } }
closeStatement(removedStatement, session, call); } else { decrementCallCount(); decrementCallCount(); } else { closeStatement(statement, session, call);
closeStatement(removedStatement, session, call); } else { decrementCallCount(); decrementCallCount(); } else { closeStatement(statement, session, call);
} finally { if (reconnected) { ((DatabaseAccessor)session.getAccessor()).decrementCallCount();
} finally { if (reconnected) { ((DatabaseAccessor)session.getAccessor()).decrementCallCount();
} finally { if (reconnected) { ((DatabaseAccessor)session.getAccessor()).decrementCallCount();
} finally { if (reconnected) { ((DatabaseAccessor)session.getAccessor()).decrementCallCount();
/** * INTERNAL: * Build a ADT structure from the row data. */ public Struct buildStructureFromRow(AbstractRecord row, AbstractSession session, java.sql.Connection connection) throws DatabaseException { Struct structure; boolean reconnected = false; try { if (connection == null) { ((DatabaseAccessor)session.getAccessor()).incrementCallCount(session); reconnected = true; connection = ((DatabaseAccessor)session.getAccessor()).getConnection(); } Object[] fields = new Object[getOrderedFields().size()]; for (int index = 0; index < getOrderedFields().size(); index++) { DatabaseField field = (DatabaseField)getOrderedFields().elementAt(index); fields[index] = row.get(field); } structure = session.getPlatform().createStruct(getStructureName(), fields, session, connection); } catch (java.sql.SQLException exception) { throw DatabaseException.sqlException(exception, session, false); } finally { if (reconnected) { ((DatabaseAccessor)session.getAccessor()).decrementCallCount(); } } return structure; }
} finally { if (reconnected) { ((DatabaseAccessor)session.getAccessor()).decrementCallCount();
/** * INTERNAL: * Build the appropriate field value for the specified * set of direct values. * The database better be expecting an ARRAY. */ public Object buildFieldValueFromDirectValues(Vector directValues, String elementDataTypeName, AbstractSession session) throws DatabaseException { Object[] fields = Helper.arrayFromVector(directValues); try { ((DatabaseAccessor)session.getAccessor()).incrementCallCount(session); java.sql.Connection connection = ((DatabaseAccessor)session.getAccessor()).getConnection(); return session.getPlatform().createArray(elementDataTypeName, fields, session,connection); } catch (java.sql.SQLException ex) { throw DatabaseException.sqlException(ex, session, false); } finally { ((DatabaseAccessor)session.getAccessor()).decrementCallCount(); } }
/** * INTERNAL: * Build the appropriate field value for the specified * set of direct values. * The database better be expecting an ARRAY. */ @Override public Object buildFieldValueFromDirectValues(Vector directValues, String elementDataTypeName, AbstractSession session) throws DatabaseException { Object[] fields = Helper.arrayFromVector(directValues); try { ((DatabaseAccessor)session.getAccessor()).incrementCallCount(session); java.sql.Connection connection = ((DatabaseAccessor)session.getAccessor()).getConnection(); return session.getPlatform().createArray(elementDataTypeName, fields, session,connection); } catch (java.sql.SQLException ex) { throw DatabaseException.sqlException(ex, session, false); } finally { ((DatabaseAccessor)session.getAccessor()).decrementCallCount(); } }
/** * INTERNAL: * Build the appropriate field value for the specified * set of direct values. * The database better be expecting an ARRAY. */ @Override public Object buildFieldValueFromDirectValues(Vector directValues, String elementDataTypeName, AbstractSession session) throws DatabaseException { Object[] fields = Helper.arrayFromVector(directValues); try { ((DatabaseAccessor)session.getAccessor()).incrementCallCount(session); java.sql.Connection connection = ((DatabaseAccessor)session.getAccessor()).getConnection(); return session.getPlatform().createArray(elementDataTypeName, fields, session,connection); } catch (java.sql.SQLException ex) { throw DatabaseException.sqlException(ex, session, false); } finally { ((DatabaseAccessor)session.getAccessor()).decrementCallCount(); } }
/** * INTERNAL: * Return the value of the field from the row or a value holder on the query to obtain the object. * Check for batch + aggregation reading. */ public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, AbstractSession executionSession) throws DatabaseException { Ref ref = (Ref)row.get(getField()); if (ref == null) { return null; } Struct struct; try { ((DatabaseAccessor)executionSession.getAccessor()).incrementCallCount(executionSession); java.sql.Connection connection = ((DatabaseAccessor)executionSession.getAccessor()).getConnection(); struct = (Struct)executionSession.getPlatform().getRefValue(ref,executionSession,connection); } catch (java.sql.SQLException exception) { throw DatabaseException.sqlException(exception, executionSession, false); } AbstractRecord targetRow = ((ObjectRelationalDataTypeDescriptor)getReferenceDescriptor()).buildRowFromStructure(struct); ((DatabaseAccessor)executionSession.getAccessor()).decrementCallCount(); return getReferenceDescriptor().getObjectBuilder().buildObject(query, targetRow, joinManager); }
/** * INTERNAL: * Get a value from the object and set that in the respective field of the row. */ @Override public void writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session, WriteType writeType) { if (isReadOnly()) { return; } Object values = getRealCollectionAttributeValueFromObject(object, session); ContainerPolicy cp = getContainerPolicy(); Object[] fields = new Object[cp.sizeFor(values)]; Object valuesIterator = cp.iteratorFor(values); for (int index = 0; index < cp.sizeFor(values); index++) { Object value = cp.next(valuesIterator, session); fields[index] = ((ObjectRelationalDataTypeDescriptor)getReferenceDescriptor()).getRef(value, session); } java.sql.Array array; try { ((DatabaseAccessor)session.getAccessor()).incrementCallCount(session); java.sql.Connection connection = ((DatabaseAccessor)session.getAccessor()).getConnection(); array = session.getPlatform().createArray(getStructureName(), fields, session,connection); } catch (java.sql.SQLException exception) { throw DatabaseException.sqlException(exception, session.getAccessor(), session, false); } finally { ((DatabaseAccessor)session.getAccessor()).decrementCallCount(); } record.put(getField(), array); }
/** * INTERNAL: * Get a value from the object and set that in the respective field of the row. */ @Override public void writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session, WriteType writeType) { if (isReadOnly()) { return; } Object values = getRealCollectionAttributeValueFromObject(object, session); ContainerPolicy cp = getContainerPolicy(); Object[] fields = new Object[cp.sizeFor(values)]; Object valuesIterator = cp.iteratorFor(values); for (int index = 0; index < cp.sizeFor(values); index++) { Object value = cp.next(valuesIterator, session); fields[index] = ((ObjectRelationalDataTypeDescriptor)getReferenceDescriptor()).getRef(value, session); } java.sql.Array array; try { ((DatabaseAccessor)session.getAccessor()).incrementCallCount(session); java.sql.Connection connection = ((DatabaseAccessor)session.getAccessor()).getConnection(); array = session.getPlatform().createArray(getStructureName(), fields, session,connection); } catch (java.sql.SQLException exception) { throw DatabaseException.sqlException(exception, session.getAccessor(), session, false); } finally { ((DatabaseAccessor)session.getAccessor()).decrementCallCount(); } record.put(getField(), array); }
/** * INTERNAL: * Get a value from the object and set that in the respective field of the row. */ public void writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session) { if (isReadOnly()) { return; } Object values = getRealCollectionAttributeValueFromObject(object, session); ContainerPolicy cp = getContainerPolicy(); Object[] fields = new Object[cp.sizeFor(values)]; Object valuesIterator = cp.iteratorFor(values); for (int index = 0; index < cp.sizeFor(values); index++) { Object value = cp.next(valuesIterator, session); fields[index] = ((ObjectRelationalDataTypeDescriptor)getReferenceDescriptor()).getRef(value, session); } java.sql.Array array; try { ((DatabaseAccessor)session.getAccessor()).incrementCallCount(session); java.sql.Connection connection = ((DatabaseAccessor)session.getAccessor()).getConnection(); array = session.getPlatform().createArray(getStructureName(), fields, session,connection); } catch (java.sql.SQLException exception) { throw DatabaseException.sqlException(exception, session.getAccessor(), session, false); } finally { ((DatabaseAccessor)session.getAccessor()).decrementCallCount(); } record.put(getField(), array); }
throw DatabaseException.sqlException(exception, session.getAccessor(), session, false); } finally { ((DatabaseAccessor)session.getAccessor()).decrementCallCount();
throw DatabaseException.sqlException(exception, session.getAccessor(), session, false); } finally { ((DatabaseAccessor)session.getAccessor()).decrementCallCount();