use of org.hsqldb_voltpatches.result.Result in project voltdb by VoltDB.
the class StatementProcedure method getExpressionResult.
Result getExpressionResult(Session session) {
// representing CALL
Expression e = expression;
// expression return value
Object o = e.getValue(session);
Result r;
if (o instanceof Result) {
return (Result) o;
}
if (resultMetaData == null) {
getResultMetaData();
}
/**
* @todo 1.9.0 For table functions implment handling of Result objects
* returned from Java functions. Review and document instantiation and usage
* of relevant implementation of Result and JDBCResultSet for returning
* from Java functions?
* else if (o instanceof JDBCResultSet) {
* return ((JDBCResultSet) o).getResult();
* }
*/
r = Result.newSingleColumnResult(resultMetaData);
Object[] row = new Object[1];
row[0] = o;
r.getNavigator().add(row);
return r;
}
use of org.hsqldb_voltpatches.result.Result in project voltdb by VoltDB.
the class StatementProcedure method getProcedureResult.
Result getProcedureResult(Session session) {
Object[] data = ValuePool.emptyObjectArray;
if (arguments.length > 0) {
data = new Object[arguments.length];
}
for (int i = 0; i < arguments.length; i++) {
Expression e = arguments[i];
if (e != null) {
data[i] = e.getValue(session, e.dataType);
}
}
int variableCount = procedure.getVariableCount();
session.sessionContext.push();
session.sessionContext.routineArguments = data;
session.sessionContext.routineVariables = ValuePool.emptyObjectArray;
if (variableCount > 0) {
session.sessionContext.routineVariables = new Object[variableCount];
}
// fixed? temp until assignment of dynamicArguments in materialiseSubqueries is fixed
// Object[] args = session.sessionContext.dynamicArguments;
Result result = procedure.statement.execute(session);
// session.sessionContext.dynamicArguments = args;
if (!result.isError()) {
result = Result.updateZeroResult;
}
Object[] callArguments = session.sessionContext.routineArguments;
session.sessionContext.pop();
if (result.isError()) {
return result;
}
boolean returnParams = false;
for (int i = 0; i < procedure.getParameterCount(); i++) {
ColumnSchema param = procedure.getParameter(i);
int mode = param.getParameterMode();
if (mode != SchemaObject.ParameterModes.PARAM_IN) {
if (this.arguments[i].isParam) {
int paramIndex = arguments[i].parameterIndex;
session.sessionContext.dynamicArguments[paramIndex] = callArguments[i];
returnParams = true;
} else {
int varIndex = arguments[i].getColumnIndex();
session.sessionContext.routineVariables[varIndex] = callArguments[i];
}
}
}
if (returnParams) {
result = Result.newCallResponse(this.getParametersMetaData().getParameterTypes(), this.id, session.sessionContext.dynamicArguments);
}
return result;
}
use of org.hsqldb_voltpatches.result.Result in project voltdb by VoltDB.
the class JDBCStatementBase method performPostExecute.
/**
* processes chained warnings and any generated columns result set
*/
void performPostExecute() throws SQLException {
resultOut.clearLobResults();
generatedResult = null;
if (resultIn == null) {
return;
}
Result current = resultIn;
while (current.getChainedResult() != null) {
current = current.getUnlinkChainedResult();
if (current.getType() == ResultConstants.WARNING) {
SQLWarning w = Util.sqlWarning(current);
if (rootWarning == null) {
rootWarning = w;
} else {
rootWarning.setNextWarning(w);
}
} else if (current.getType() == ResultConstants.ERROR) {
errorResult = current;
} else if (current.getType() == ResultConstants.DATA) {
generatedResult = current;
}
}
if (resultIn.isData()) {
currentResultSet = new JDBCResultSet(connection.sessionProxy, this, resultIn, resultIn.metaData, connection.connProperties);
}
}
Aggregations