/** * Unprepare the call if required. * Clone and unprepare stored procedure calls, so they can be reprepared with possible different optional arguments. */ public void unprepare() { DatabaseQuery query = this.query; if (hasMultipleCalls()) { this.calls = ((Vector)this.calls.clone()); int size = this.calls.size(); for (int index = 0; index < size; index++) { DatabaseCall call = (DatabaseCall)this.calls.get(index); if (call.isPrepared() && call.isStoredProcedureCall() && ((StoredProcedureCall)call).hasOptionalArguments()) { call = (DatabaseCall)call.clone(); call.setIsPrepared(false); call.setQuery(query); this.calls.set(index, call); } } } else if (this.call != null) { if (this.call.isPrepared() && this.call.isStoredProcedureCall() && ((StoredProcedureCall)this.call).hasOptionalArguments()) { this.call = (DatabaseCall)this.call.clone(); this.call.setIsPrepared(false); this.call.setQuery(query); } } }
/** * Unprepare the call if required. * Clone and unprepare stored procedure calls, so they can be reprepared with possible different optional arguments. */ public void unprepare() { DatabaseQuery query = this.query; if (hasMultipleCalls()) { this.calls = ((Vector)this.calls.clone()); int size = this.calls.size(); for (int index = 0; index < size; index++) { DatabaseCall call = (DatabaseCall)this.calls.get(index); if (call.isPrepared() && call.isStoredProcedureCall() && ((StoredProcedureCall)call).hasOptionalArguments()) { call = (DatabaseCall)call.clone(); call.setIsPrepared(false); call.setQuery(query); this.calls.set(index, call); } } } else if (this.call != null) { if (this.call.isPrepared() && this.call.isStoredProcedureCall() && ((StoredProcedureCall)this.call).hasOptionalArguments()) { this.call = (DatabaseCall)this.call.clone(); this.call.setIsPrepared(false); this.call.setQuery(query); } } }
DatabasePlatform platform = accessor.getPlatform(); DatabaseCall call = (DatabaseCall)getCall().clone(); call.setQuery(this); call.translate(this.translationRow, null, unitOfWork); Statement statement = null;
/** * Build the sql call from the select statement for selecting the locator */ private DatabaseCall buildCallFromSelectStatementForLocator(SQLSelectStatement selectStatement, WriteObjectQuery writeQuery, DatabaseCall dbCall, AbstractSession session) { DatabaseCall call = selectStatement.buildCall(session); // Locator LOB must not be wrapped (WLS wraps LOBs). call.setIsNativeConnectionRequired(this.isNativeConnectionRequired); //the LOB context must be passed into the new call object call.setContexts(dbCall.getContexts()); //need to explicitly define one row return, otherwise, EL assumes multiple rows return and confuses the accessor call.returnOneRow(); //the query object has to be set in order to access to the platform and login objects call.setQuery(writeQuery); // prepare it call.prepare(session); //finally do the translation call.translate(writeQuery.getTranslationRow(), writeQuery.getModifyRow(), session); return call; }
/** * Build the sql call from the select statement for selecting the locator */ private DatabaseCall buildCallFromSelectStatementForLocator(SQLSelectStatement selectStatement, WriteObjectQuery writeQuery, DatabaseCall dbCall, AbstractSession session) { DatabaseCall call = selectStatement.buildCall(session); // Locator LOB must not be wrapped (WLS wraps LOBs). call.setIsNativeConnectionRequired(this.isNativeConnectionRequired); //the LOB context must be passed into the new call object call.setContexts(dbCall.getContexts()); //need to explicitly define one row return, otherwise, EL assumes multiple rows return and confuses the accessor call.returnOneRow(); //the query object has to be set in order to access to the platform and login objects call.setQuery(writeQuery); // prepare it call.prepare(session); //finally do the translation call.translate(writeQuery.getTranslationRow(), writeQuery.getModifyRow(), session); return call; }
/** * Read all rows from the database, return ResultSet * @exception DatabaseException - an error has occurred on the database */ public DatabaseCall selectResultSet() throws DatabaseException { try { // For CR 2923 must move to session we will execute call on now // so correct DatasourcePlatform used by translate. AbstractSession sessionToUse = this.query.getExecutionSession(); DatabaseCall clonedCall = (DatabaseCall)this.call.clone(); clonedCall.setQuery(this.query); clonedCall.translate(this.query.getTranslationRow(), getModifyRow(), sessionToUse); clonedCall.returnCursor(); return (DatabaseCall)sessionToUse.executeCall(clonedCall, this.query.getTranslationRow(), this.query); } catch (java.lang.ClassCastException e) { throw QueryException.invalidDatabaseCall(this.call); } }
/** * Read all rows from the database, return ResultSet * @exception DatabaseException - an error has occurred on the database */ public DatabaseCall selectResultSet() throws DatabaseException { try { // For CR 2923 must move to session we will execute call on now // so correct DatasourcePlatform used by translate. AbstractSession sessionToUse = this.query.getExecutionSession(); DatabaseCall clonedCall = (DatabaseCall)this.call.clone(); clonedCall.setQuery(this.query); clonedCall.translate(this.query.getTranslationRow(), getModifyRow(), sessionToUse); clonedCall.returnCursor(); return (DatabaseCall)sessionToUse.executeCall(clonedCall, this.query.getTranslationRow(), this.query); } catch (java.lang.ClassCastException e) { throw QueryException.invalidDatabaseCall(this.call); } }
/** * Build the sql call from the select statement for selecting the locator */ private DatabaseCall buildCallFromSelectStatementForLocator(SQLSelectStatement selectStatement, WriteObjectQuery writeQuery, DatabaseCall dbCall, AbstractSession session) { DatabaseCall call = selectStatement.buildCall(session); // Locator LOB must not be wrapped (WLS wraps LOBs). call.setIsNativeConnectionRequired(this.isNativeConnectionRequired); //the LOB context must be passed into the new call object call.setContexts(dbCall.getContexts()); //need to explicitly define one row return, otherwise, EL assumes multiple rows return and confuses the accessor call.returnOneRow(); //the query object has to be set in order to access to the platform and login objects call.setQuery(writeQuery); // prepare it call.prepare(session); //finally do the translation call.translate(writeQuery.getTranslationRow(), writeQuery.getModifyRow(), session); return call; }
DatabasePlatform platform = accessor.getPlatform(); DatabaseCall call = (DatabaseCall)getCall().clone(); call.setQuery(this); AbstractRecord translationRow = getTranslationRow(); call.translate(getTranslationRow(), null, unitOfWork);