/** * 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); } }
/** * 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); } }
@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
/** * Set the default record name from the descriptor. */ public void prepare(AbstractSession session) { if (getInputRecordName().length() == 0) { if ((getQuery() != null) && (getQuery().getDescriptor() instanceof EISDescriptor)) { EISDescriptor descriptor = (EISDescriptor)getQuery().getDescriptor(); setInputRecordName(descriptor.getDataTypeName()); } else { setInputRecordName("input"); } } super.prepare(session); }
/** * Set the default record name from the descriptor. */ public void prepare(AbstractSession session) { if (getInputRecordName().length() == 0) { if ((getQuery() != null) && (getQuery().getDescriptor() instanceof EISDescriptor)) { EISDescriptor descriptor = (EISDescriptor)getQuery().getDescriptor(); setInputRecordName(descriptor.getDataTypeName()); } else { setInputRecordName("input"); } } super.prepare(session); }
/** * Set the default record name from the descriptor. */ public void prepare(AbstractSession session) { if (getInputRecordName().length() == 0) { if ((getQuery() != null) && (getQuery().getDescriptor() instanceof EISDescriptor)) { EISDescriptor descriptor = (EISDescriptor)getQuery().getDescriptor(); setInputRecordName(descriptor.getDataTypeName()); } else { setInputRecordName("input"); } } super.prepare(session); }