You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Prachi Garg <pg...@gridgain.com> on 2017/12/28 00:06:30 UTC

Thin Client documentation: OP_QUERY_SQL_CURSOR_GET_PAGE

Pavel,

I have 2 records in my cache, and when I run an example for
OP_QUERY_SQL=2002 with cursor page size 1, I get the following result
(expected)

len: 83
resReqId: 1
status code: 0
cursorId: 1
rowCount: 1
moreResults: true

Then, I run the OP_QUERY_SQL_CURSOR_GET_PAGE = 2003, using the following
code:

DataOutputStream out = new DataOutputStream(socket.getOutputStream());

// Message length
writeIntLittleEndian(18, out);

// Op code = QUERY_SQL_CURSOR_GET_PAGE
writeShortLittleEndian(2003, out);

// Request id (can be anything)
long reqId = 1;
writeLongLittleEndian(reqId, out);

// Cursor Id
writeLongLittleEndian(1, out);

// Send request
out.flush();

// Read result
DataInputStream in = new DataInputStream(socket.getInputStream());

// Response length
final int len = readIntLittleEndian(in);
System.out.println("len: " + len);

// Request id
long resReqId = readLongLittleEndian(in);
System.out.println("resReqId: " + resReqId);

// Success
int statusCode = readIntLittleEndian(in);
System.out.println("status code: " + statusCode);

int rowCount = readIntLittleEndian(in);
System.out.println("rowCount: " + rowCount);

// Read entries (as user objects)
for (int i = 0; i < rowCount; i++){
    // ...
}

boolean moreResults = readBooleanLittleEndian(in);
System.out.println("moreResults: " + moreResults);

but the result is not what is expected:

len: 1
resReqId: 44096429228032
status code: 721512192
rowCount: 1672392448
moreResults: true

Also, there is no error on server side.

Anything wrong in the OP_QUERY_SQL_CURSOR_GET_PAGE request that I am
sending?

-Prachi

Re: Thin Client documentation: OP_QUERY_SQL_CURSOR_GET_PAGE

Posted by Pavel Tupitsyn <pt...@apache.org>.
Hi Prachi,

Code looks correct to me.
- Can you try on the latest master branch?
- Have you tried to debug the server side and see what's going on there?

Thanks,
Pavel

On Thu, Dec 28, 2017 at 3:06 AM, Prachi Garg <pg...@gridgain.com> wrote:

> Pavel,
>
> I have 2 records in my cache, and when I run an example for
> OP_QUERY_SQL=2002 with cursor page size 1, I get the following result
> (expected)
>
> len: 83
> resReqId: 1
> status code: 0
> cursorId: 1
> rowCount: 1
> moreResults: true
>
> Then, I run the OP_QUERY_SQL_CURSOR_GET_PAGE = 2003, using the following
> code:
>
> DataOutputStream out = new DataOutputStream(socket.getOutputStream());
>
> // Message length
> writeIntLittleEndian(18, out);
>
> // Op code = QUERY_SQL_CURSOR_GET_PAGE
> writeShortLittleEndian(2003, out);
>
> // Request id (can be anything)
> long reqId = 1;
> writeLongLittleEndian(reqId, out);
>
> // Cursor Id
> writeLongLittleEndian(1, out);
>
> // Send request
> out.flush();
>
> // Read result
> DataInputStream in = new DataInputStream(socket.getInputStream());
>
> // Response length
> final int len = readIntLittleEndian(in);
> System.out.println("len: " + len);
>
> // Request id
> long resReqId = readLongLittleEndian(in);
> System.out.println("resReqId: " + resReqId);
>
> // Success
> int statusCode = readIntLittleEndian(in);
> System.out.println("status code: " + statusCode);
>
> int rowCount = readIntLittleEndian(in);
> System.out.println("rowCount: " + rowCount);
>
> // Read entries (as user objects)
> for (int i = 0; i < rowCount; i++){
>     // ...
> }
>
> boolean moreResults = readBooleanLittleEndian(in);
> System.out.println("moreResults: " + moreResults);
>
> but the result is not what is expected:
>
> len: 1
> resReqId: 44096429228032
> status code: 721512192
> rowCount: 1672392448
> moreResults: true
>
> Also, there is no error on server side.
>
> Anything wrong in the OP_QUERY_SQL_CURSOR_GET_PAGE request that I am
> sending?
>
> -Prachi
>