Search in sources :

Example 66 with Result

use of org.hsqldb_voltpatches.result.Result 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;
}
Also used : Type(org.hsqldb_voltpatches.types.Type) RowSetNavigator(org.hsqldb_voltpatches.navigator.RowSetNavigator) RowSetNavigatorClient(org.hsqldb_voltpatches.navigator.RowSetNavigatorClient) Result(org.hsqldb_voltpatches.result.Result)

Example 67 with Result

use of org.hsqldb_voltpatches.result.Result in project voltdb by VoltDB.

the class Session method getAttributesResult.

private Result getAttributesResult(int id) {
    Result r = Result.newSessionAttributesResult();
    Object[] data = r.getSingleRowData();
    data[SessionInterface.INFO_ID] = ValuePool.getInt(id);
    switch(id) {
        case SessionInterface.INFO_ISOLATION:
            data[SessionInterface.INFO_INTEGER] = ValuePool.getInt(isolationMode);
            break;
        case SessionInterface.INFO_AUTOCOMMIT:
            data[SessionInterface.INFO_BOOLEAN] = ValuePool.getBoolean(isAutoCommit);
            break;
        case SessionInterface.INFO_CONNECTION_READONLY:
            data[SessionInterface.INFO_BOOLEAN] = ValuePool.getBoolean(isReadOnly);
            break;
        case SessionInterface.INFO_CATALOG:
            data[SessionInterface.INFO_VARCHAR] = database.getCatalogName().name;
            break;
    }
    return r;
}
Also used : Result(org.hsqldb_voltpatches.result.Result)

Example 68 with Result

use of org.hsqldb_voltpatches.result.Result in project voltdb by VoltDB.

the class SessionData method closeNavigator.

public void closeNavigator(long id) {
    Result result = (Result) resultMap.remove(id);
    result.getNavigator().close();
}
Also used : Result(org.hsqldb_voltpatches.result.Result)

Example 69 with Result

use of org.hsqldb_voltpatches.result.Result in project voltdb by VoltDB.

the class LobManager method createClob.

public long createClob(long length) {
    long lobID = getNewLobID(sysLobSession);
    ResultMetaData meta = createLob.getParametersMetaData();
    Object[] params = new Object[meta.getColumnCount()];
    params[0] = Long.valueOf(lobID);
    params[1] = Long.valueOf(length);
    params[2] = Long.valueOf(1);
    params[3] = Integer.valueOf(Types.SQL_CLOB);
    Result result = sysLobSession.executeCompiledStatement(createLob, params);
    return lobID;
}
Also used : ResultMetaData(org.hsqldb_voltpatches.result.ResultMetaData) Result(org.hsqldb_voltpatches.result.Result)

Example 70 with Result

use of org.hsqldb_voltpatches.result.Result in project voltdb by VoltDB.

the class LobManager method setBytes.

public Result setBytes(Session session, long lobID, byte[] dataBytes, long offset) {
    if (dataBytes.length == 0) {
        return ResultLob.newLobSetResponse(lobID, 0);
    }
    Object[] data = getLobHeader(session, lobID);
    if (data == null) {
        return Result.newErrorResult(Error.error(ErrorCode.X_0F502));
    }
    long length = ((Long) data[1]).longValue();
    Result result = setBytesBA(session, lobID, dataBytes, offset, dataBytes.length);
    if (offset + dataBytes.length > length) {
        setLength(session, lobID, offset + dataBytes.length);
    }
    return result;
}
Also used : Result(org.hsqldb_voltpatches.result.Result)

Aggregations

Result (org.hsqldb_voltpatches.result.Result)83 Session (org.hsqldb_voltpatches.Session)18 PersistentStore (org.hsqldb_voltpatches.persist.PersistentStore)16 HsqlName (org.hsqldb_voltpatches.HsqlNameManager.HsqlName)15 Table (org.hsqldb_voltpatches.Table)14 ResultLob (org.hsqldb_voltpatches.result.ResultLob)13 TextTable (org.hsqldb_voltpatches.TextTable)12 ResultMetaData (org.hsqldb_voltpatches.result.ResultMetaData)11 RowSetNavigator (org.hsqldb_voltpatches.navigator.RowSetNavigator)10 HsqlException (org.hsqldb_voltpatches.HsqlException)5 RowSetNavigatorData (org.hsqldb_voltpatches.navigator.RowSetNavigatorData)4 EOFException (java.io.EOFException)3 RowSetNavigatorClient (org.hsqldb_voltpatches.navigator.RowSetNavigatorClient)3 IOException (java.io.IOException)2 RangeIteratorBase (org.hsqldb_voltpatches.RangeVariable.RangeIteratorBase)2 Statement (org.hsqldb_voltpatches.Statement)2 HashMappedList (org.hsqldb_voltpatches.lib.HashMappedList)2 HsqlArrayList (org.hsqldb_voltpatches.lib.HsqlArrayList)2 HsqlByteArrayInputStream (org.hsqldb_voltpatches.lib.HsqlByteArrayInputStream)2 Iterator (org.hsqldb_voltpatches.lib.Iterator)2