/** * Convenience method */ protected AbstractSession getExecutionSession() { return this.query.getExecutionSession(); }
/** * Convenience method */ protected AbstractSession getExecutionSession() { return this.query.getExecutionSession(); }
/** * INTERNAL: * This is different from 'prepareForExecution' in that this is called on the original query, * and the other is called on the copy of the query. * This query is copied for concurrency so this prepare can only setup things that * will apply to any future execution of this query. */ public void prepareCall() throws QueryException { DatabaseQuery query = getQuery(); AbstractSession executionSession = query.getExecutionSession(); if (hasMultipleCalls()) { for (Enumeration callsEnum = getCalls().elements(); callsEnum.hasMoreElements();) { DatasourceCall call = (DatasourceCall)callsEnum.nextElement(); call.prepare(executionSession); } } else if (getCall() != null) { getCall().prepare(executionSession); } }
@Override protected Object executeCall(DatasourceCall databaseCall) throws DatabaseException { AbstractSession sessionToUse = this.query.getExecutionSession(); boolean doNotUseCachedInserts = Boolean.valueOf(String.valueOf(sessionToUse.getProperty("cuba.doNotUseCachedInserts"))); String cachedQuery = databaseCall.getQueryString(); if (doNotUseCachedInserts && cachedQuery != null && cachedQuery.startsWith("INSERT")) { Matcher matcher = INSERT_PATTERN.matcher(cachedQuery); if (matcher.find()) { String tableName = matcher.group(1); DatabaseTable targetTable = getDescriptor().getTable(tableName); SQLInsertStatement sqlInsertStatement = this.buildInsertStatement(targetTable); DatasourceCall call = getDescriptor().buildCallFromStatement(sqlInsertStatement, getQuery(), getExecutionSession()); call.setQuery(this.query); call.prepare(sessionToUse); call.translate(this.query.getTranslationRow(), getModifyRow(), sessionToUse); return sessionToUse.executeCall(call, this.query.getTranslationRow(), this.query); } } return super.executeCall(databaseCall); } // cuba end
/** * Execute the call. It is assumed the call has been fully prepared. * @exception DatabaseException - an error has occurred on the database. */ protected Object executeCall(DatasourceCall databaseCall) throws DatabaseException { // For CR 2923 must move to session we will execute call on now // so correct DatasourcePlatform used by translate. AbstractSession sessionToUse = this.query.getExecutionSession(); DatasourceCall clonedCall = (DatasourceCall)databaseCall.clone(); clonedCall.setQuery(this.query); clonedCall.translate(this.query.getTranslationRow(), getModifyRow(), sessionToUse); return sessionToUse.executeCall(clonedCall, this.query.getTranslationRow(), this.query); }
/** * Execute the call. It is assumed the call has been fully prepared. * @exception DatabaseException - an error has occurred on the database. */ protected Object executeCall(DatasourceCall databaseCall) throws DatabaseException { // For CR 2923 must move to session we will execute call on now // so correct DatasourcePlatform used by translate. AbstractSession sessionToUse = this.query.getExecutionSession(); DatasourceCall clonedCall = (DatasourceCall)databaseCall.clone(); clonedCall.setQuery(this.query); clonedCall.translate(this.query.getTranslationRow(), getModifyRow(), sessionToUse); return sessionToUse.executeCall(clonedCall, this.query.getTranslationRow(), this.query); }
/** * Execute the call. It is assumed the call has been fully prepared. * @exception DatabaseException - an error has occurred on the database. */ protected Object executeCall(DatasourceCall databaseCall) throws DatabaseException { // For CR 2923 must move to session we will execute call on now // so correct DatasourcePlatform used by translate. AbstractSession sessionToUse = this.query.getExecutionSession(); DatasourceCall clonedCall = (DatasourceCall)databaseCall.clone(); clonedCall.setQuery(this.query); clonedCall.translate(this.query.getTranslationRow(), getModifyRow(), sessionToUse); return sessionToUse.executeCall(clonedCall, this.query.getTranslationRow(), this.query); }
AbstractSession executionSession = query.getExecutionSession(); if (hasMultipleCalls()) { if (query.shouldCloneCall()) {
/** * Update the foreign key fields when resolving a bi-directional reference in a UOW. * This is rare to occur for non-relational, however if it does each of the calls must be re-executed. */ protected void updateForeignKeyFieldAfterInsert(WriteObjectQuery writeQuery) { writeQuery.setModifyRow(this.getDescriptor().getObjectBuilder().buildRow(writeQuery.getObject(), this.getSession(), WriteType.INSERT)); // For CR 2923 must move to session we will execute call on now // so correct DatasourcePlatform used by translate. AbstractSession sessionToUse = this.query.getExecutionSession(); // yes - this is a bit ugly... Vector calls = ((DatasourceCallQueryMechanism)this.getDescriptor().getQueryManager().getUpdateQuery().getQueryMechanism()).getCalls(); for (Enumeration stream = calls.elements(); stream.hasMoreElements();) { DatasourceCall call = (DatasourceCall)((DatasourceCall)stream.nextElement()).clone(); call.setQuery(writeQuery); sessionToUse.executeCall(call, this.getTranslationRow(), writeQuery); } } }
/** * Update the foreign key fields when resolving a bi-directional reference in a UOW. * This is rare to occur for non-relational, however if it does each of the calls must be re-executed. */ protected void updateForeignKeyFieldAfterInsert(WriteObjectQuery writeQuery) { writeQuery.setModifyRow(this.getDescriptor().getObjectBuilder().buildRow(writeQuery.getObject(), this.getSession(), WriteType.INSERT)); // For CR 2923 must move to session we will execute call on now // so correct DatasourcePlatform used by translate. AbstractSession sessionToUse = this.query.getExecutionSession(); // yes - this is a bit ugly... Vector calls = ((DatasourceCallQueryMechanism)this.getDescriptor().getQueryManager().getUpdateQuery().getQueryMechanism()).getCalls(); for (Enumeration stream = calls.elements(); stream.hasMoreElements();) { DatasourceCall call = (DatasourceCall)((DatasourceCall)stream.nextElement()).clone(); call.setQuery(writeQuery); sessionToUse.executeCall(call, this.getTranslationRow(), writeQuery); } } }
/** * Update the foreign key fields when resolving a bi-directonal reference in a UOW. * This is rare to occur for non-relational, however if it does each of the calls must be re-executed. */ protected void updateForeignKeyFieldAfterInsert(WriteObjectQuery writeQuery) { writeQuery.setModifyRow(this.getDescriptor().getObjectBuilder().buildRow(writeQuery.getObject(), this.getSession())); // For CR 2923 must move to session we will execute call on now // so correct DatasourcePlatform used by translate. AbstractSession sessionToUse = this.query.getExecutionSession(); // yes - this is a bit ugly... Vector calls = ((DatasourceCallQueryMechanism)this.getDescriptor().getQueryManager().getUpdateQuery().getQueryMechanism()).getCalls(); for (Enumeration stream = calls.elements(); stream.hasMoreElements();) { DatasourceCall call = (DatasourceCall)((DatasourceCall)stream.nextElement()).clone(); call.setQuery(writeQuery); sessionToUse.executeCall(call, this.getTranslationRow(), writeQuery); } } }
AbstractSession executionSession = query.getExecutionSession(); if (hasMultipleCalls()) { if (query.shouldCloneCall()) {
/** * INTERNAL: * This is different from 'prepareForExecution' in that this is called on the original query, * and the other is called on the copy of the query. * This query is copied for concurrency so this prepare can only setup things that * will apply to any future execution of this query. */ public void prepareCall() throws QueryException { DatabaseQuery query = getQuery(); AbstractSession executionSession = query.getExecutionSession(); if (hasMultipleCalls()) { for (DatasourceCall call : (List<DatasourceCall>)getCalls()) { call.prepare(executionSession); } } else if (getCall() != null) { getCall().prepare(executionSession); } }
/** * INTERNAL: * This is different from 'prepareForExecution' in that this is called on the original query, * and the other is called on the copy of the query. * This query is copied for concurrency so this prepare can only setup things that * will apply to any future execution of this query. */ public void prepareCall() throws QueryException { DatabaseQuery query = getQuery(); AbstractSession executionSession = query.getExecutionSession(); if (hasMultipleCalls()) { for (DatasourceCall call : (List<DatasourceCall>)getCalls()) { call.prepare(executionSession); } } else if (getCall() != null) { getCall().prepare(executionSession); } }
AbstractSession executionSession = this.query.getExecutionSession(); executionSession.getAccessor().flushSelectCalls(executionSession); return returnedRowCount;
/** * 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); } }
AbstractSession executionSession = this.query.getExecutionSession(); for (Accessor accessor : executionSession.getAccessors()) { accessor.flushSelectCalls(executionSession);
AbstractSession executionSession = this.query.getExecutionSession(); executionSession.getAccessor().flushSelectCalls(executionSession);
AbstractSession executionSession = query.getExecutionSession(); if (hasMultipleCalls()) { if(getQuery().shouldCloneCall()){