Search in sources :

Example 1 with ParameterRemote

use of org.h2.expression.ParameterRemote in project h2database by h2database.

the class CommandRemote method prepare.

private void prepare(SessionRemote s, boolean createParams) {
    id = s.getNextId();
    for (int i = 0, count = 0; i < transferList.size(); i++) {
        try {
            Transfer transfer = transferList.get(i);
            boolean v16 = s.getClientVersion() >= Constants.TCP_PROTOCOL_VERSION_16;
            if (createParams) {
                s.traceOperation(v16 ? "SESSION_PREPARE_READ_PARAMS2" : "SESSION_PREPARE_READ_PARAMS", id);
                transfer.writeInt(v16 ? SessionRemote.SESSION_PREPARE_READ_PARAMS2 : SessionRemote.SESSION_PREPARE_READ_PARAMS).writeInt(id).writeString(sql);
            } else {
                s.traceOperation("SESSION_PREPARE", id);
                transfer.writeInt(SessionRemote.SESSION_PREPARE).writeInt(id).writeString(sql);
            }
            s.done(transfer);
            isQuery = transfer.readBoolean();
            readonly = transfer.readBoolean();
            cmdType = v16 && createParams ? transfer.readInt() : UNKNOWN;
            int paramCount = transfer.readInt();
            if (createParams) {
                parameters.clear();
                for (int j = 0; j < paramCount; j++) {
                    ParameterRemote p = new ParameterRemote(j);
                    p.readMetaData(transfer);
                    parameters.add(p);
                }
            }
        } catch (IOException e) {
            s.removeServer(e, i--, ++count);
        }
    }
}
Also used : ParameterRemote(org.h2.expression.ParameterRemote) Transfer(org.h2.value.Transfer) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 ParameterRemote (org.h2.expression.ParameterRemote)1 Transfer (org.h2.value.Transfer)1