Search in sources :

Example 1 with ResultLob

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

the class LobManager method getChars.

public Result getChars(Session session, long lobID, long offset, int length) {
    Result result = getBytes(session, lobID, offset * 2, length * 2);
    if (result.isError()) {
        return result;
    }
    byte[] bytes = ((ResultLob) result).getByteArray();
    HsqlByteArrayInputStream be = new HsqlByteArrayInputStream(bytes);
    char[] chars = new char[bytes.length / 2];
    try {
        for (int i = 0; i < chars.length; i++) {
            chars[i] = be.readChar();
        }
    } catch (Exception e) {
        return Result.newErrorResult(e);
    }
    return ResultLob.newLobGetCharsResponse(lobID, offset, chars);
}
Also used : HsqlByteArrayInputStream(org.hsqldb_voltpatches.lib.HsqlByteArrayInputStream) IOException(java.io.IOException) EOFException(java.io.EOFException) HsqlException(org.hsqldb_voltpatches.HsqlException) Result(org.hsqldb_voltpatches.result.Result) ResultLob(org.hsqldb_voltpatches.result.ResultLob)

Example 2 with ResultLob

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

the class BlobDataID method length.

public long length(SessionInterface session) {
    ResultLob resultOut = ResultLob.newLobGetLengthRequest(id);
    Result resultIn = session.execute(resultOut);
    if (resultIn.isError()) {
        throw resultIn.getException();
    }
    return ((ResultLob) resultIn).getBlockLength();
}
Also used : ResultLob(org.hsqldb_voltpatches.result.ResultLob) Result(org.hsqldb_voltpatches.result.Result)

Example 3 with ResultLob

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

the class BlobDataID method getBlob.

public BlobData getBlob(SessionInterface session, long pos, long length) {
    ResultLob resultOut = ResultLob.newLobGetRequest(id, pos, length);
    Result resultIn = session.execute(resultOut);
    if (resultIn.isError()) {
        throw Error.error(resultIn);
    }
    long lobID = ((ResultLob) resultIn).getLobID();
    return new BlobDataID(lobID);
}
Also used : ResultLob(org.hsqldb_voltpatches.result.ResultLob) Result(org.hsqldb_voltpatches.result.Result)

Example 4 with ResultLob

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

the class BlobDataID method truncate.

public void truncate(SessionInterface session, long len) {
    ResultLob resultOut = ResultLob.newLobTruncateRequest(id, len);
    Result resultIn = session.execute(resultOut);
    if (resultIn.isError()) {
        throw resultIn.getException();
    }
}
Also used : ResultLob(org.hsqldb_voltpatches.result.ResultLob) Result(org.hsqldb_voltpatches.result.Result)

Example 5 with ResultLob

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

the class ClobDataID method length.

public long length(SessionInterface session) {
    ResultLob resultOut = ResultLob.newLobGetLengthRequest(id);
    Result resultIn = session.execute(resultOut);
    if (resultIn.isError()) {
        throw resultIn.getException();
    }
    return ((ResultLob) resultIn).getBlockLength();
}
Also used : ResultLob(org.hsqldb_voltpatches.result.ResultLob) Result(org.hsqldb_voltpatches.result.Result)

Aggregations

ResultLob (org.hsqldb_voltpatches.result.ResultLob)15 Result (org.hsqldb_voltpatches.result.Result)13 EOFException (java.io.EOFException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1 Blob (java.sql.Blob)1 Clob (java.sql.Clob)1 NClob (java.sql.NClob)1 HsqlException (org.hsqldb_voltpatches.HsqlException)1 SchemaObject (org.hsqldb_voltpatches.SchemaObject)1 CountdownInputStream (org.hsqldb_voltpatches.lib.CountdownInputStream)1 HsqlByteArrayInputStream (org.hsqldb_voltpatches.lib.HsqlByteArrayInputStream)1 BlobDataID (org.hsqldb_voltpatches.types.BlobDataID)1 ClobDataID (org.hsqldb_voltpatches.types.ClobDataID)1