use of org.hsqldb_voltpatches.navigator.RowSetNavigator in project voltdb by VoltDB.
the class SessionData method registerLobForResult.
public void registerLobForResult(Result result) {
RowSetNavigator navigator = result.getNavigator();
while (navigator.next()) {
Object[] data = navigator.getCurrent();
for (int i = 0; i < data.length; i++) {
if (data[i] instanceof BlobData) {
BlobData blob = (BlobData) data[i];
long id = resultLobs.get(blob.getId());
data[i] = database.lobManager.getBlob(session, id);
} else if (data[i] instanceof ClobData) {
ClobData clob = (ClobData) data[i];
long id = resultLobs.get(clob.getId());
data[i] = database.lobManager.getClob(session, id);
}
}
}
resultLobs.clear();
navigator.reset();
}
use of org.hsqldb_voltpatches.navigator.RowSetNavigator in project voltdb by VoltDB.
the class StatementInsert method getInsertSelectNavigator.
RowSetNavigator getInsertSelectNavigator(Session session) {
Type[] colTypes = baseTable.getColumnTypes();
int[] columnMap = insertColumnMap;
//
Result result = queryExpression.getResult(session, 0);
RowSetNavigator nav = result.initialiseNavigator();
Type[] sourceTypes = result.metaData.columnTypes;
RowSetNavigatorClient newData = new RowSetNavigatorClient(2);
while (nav.hasNext()) {
Object[] data = baseTable.getNewRowData(session);
Object[] sourceData = (Object[]) nav.getNext();
for (int i = 0; i < columnMap.length; i++) {
int j = columnMap[i];
Type sourceType = sourceTypes[i];
data[j] = colTypes[j].convertToType(session, sourceData[i], sourceType);
}
newData.add(data);
}
return newData;
}
use of org.hsqldb_voltpatches.navigator.RowSetNavigator in project voltdb by VoltDB.
the class ScriptReaderBinary method readDDL.
protected void readDDL(Session session) throws IOException {
Result r = Result.newResult(dataStreamIn, rowIn);
r.readAdditionalResults(session, dataStreamIn, rowIn);
RowSetNavigator nav = r.initialiseNavigator();
while (nav.hasNext()) {
Object[] data = (Object[]) nav.getNext();
String s = (String) data[0];
Result result = session.executeDirectStatement(s);
if (result.isError()) {
db.logger.appLog.logContext(SimpleLog.LOG_ERROR, result.getMainString());
throw Error.error(result);
}
}
}
use of org.hsqldb_voltpatches.navigator.RowSetNavigator in project voltdb by VoltDB.
the class Result method newResult.
public static Result newResult(int type) {
RowSetNavigator navigator = null;
Result result = null;
switch(type) {
case ResultConstants.CALL_RESPONSE:
case ResultConstants.EXECUTE:
navigator = new RowSetNavigatorClient(1);
break;
case ResultConstants.UPDATE_RESULT:
navigator = new RowSetNavigatorClient(1);
break;
case ResultConstants.BATCHEXECUTE:
case ResultConstants.BATCHEXECDIRECT:
navigator = new RowSetNavigatorClient(4);
break;
case ResultConstants.SETSESSIONATTR:
case ResultConstants.PARAM_METADATA:
navigator = new RowSetNavigatorClient(1);
break;
case ResultConstants.BATCHEXECRESPONSE:
navigator = new RowSetNavigatorClient(4);
break;
case ResultConstants.DATA:
case ResultConstants.DATAHEAD:
case ResultConstants.DATAROWS:
break;
case ResultConstants.LARGE_OBJECT_OP:
throw Error.runtimeError(ErrorCode.U_S0500, "Result");
default:
}
result = new Result();
result.mode = (byte) type;
result.navigator = navigator;
return result;
}
use of org.hsqldb_voltpatches.navigator.RowSetNavigator in project voltdb by VoltDB.
the class LobManager method getNewLobID.
//
private long getNewLobID(Session session) {
Result result = getNextLobId.execute(session);
if (result.isError()) {
return 0;
}
RowSetNavigator navigator = result.getNavigator();
boolean next = navigator.next();
if (!next) {
navigator.close();
return 0;
}
Object[] data = navigator.getCurrent();
return ((Long) data[0]).longValue();
}
Aggregations