db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: (DERBY-822 followup) Server prefetch when QRYROWSET is 0 (zero)?
Date Fri, 30 Jun 2006 12:20:20 GMT
Bryan Pendleton <bpendleton@amberpoint.com> writes:

>> Long story short someone who works with the client pointed out that
>> the client is sending a QRYROWSET of size "0" when it sends the
>> OPNQRY 
>
> Hi Army,
>
> Page 698 of V.3 says:
>
>   A QRYROWSET value of zero on the OPNQRY and EXCSQLSTT commands instructs
>   the server to return no rows with the OPNQRYRM for the cursor or result
>   set. A QRYROWSET value of zero on the CNTQRY command is invalid for
>   non-rowset cursors and results in the application server generating a
>   SYNTAXRM with a SYNERRCD value of '15'x (reserved value not allowed).
>
> I'd say that our current behavior, as you describe it, seems wrong; we should
> not be returning any rows when the client has set QRYROWSET to 0 on OPNQRY.
>
> I think that we should modify the server code for 10.2 so that:
>
>  - on OPNQRY and EXCSQLSTT, we only return rows if QRYROWSET is > 0.

... or if (QRYPRCTYP == LMTBLKPRC && QRYROWSET is not set).

>  - on CNTQRY, we throw a syntax exception if QRYROWSET is 0
>
> I'm quite interested to hear what others think about this.

I agree that the current behaviour is wrong and that it should be
changed as you describe. I don't have the DB2 ODBC driver, but I ran a
couple of tests with the client driver, and this is what it does on
OPNQRY:

Forward-only/read-only:
  - no QRYROWSET is sent
  - QRYPRCTYP = LMTBLKPRC
  - up to 32 KB of data is pre-fetched

Forward-only/updatable:
  - no QRYROWSET is sent
  - QRYPRCTYP = FIXROWPRC
  - doesn't pre-fetch data

Scrollable/read-only:
  - QRYROWSET = 64
  - QRYPRCTYP = LMTBLKPRC
  - min(32 KB, 64 rows) is pre-fetched

Scrollable/updatable:
  - QRYROWSET = 64
  - QRYPRCTYP = FIXROWPRC
  - no pre-fetching

Since the client never sends QRYROWSET=0 on OPNQRY, I don't think the
client will have this problem.

When I look at writeQRYDTA and writeFDODTA in DRDAConnThread, it seems
to me that we actually break the DRDA spec in two ways:

  1) QRYROWSET=0 has the same effect as QRYROWSET=1
  2) For forward-only/read-only result sets, QRYROWSET will be ignored
     (both on OPNQRY and CNTQRY) - haven't verified this since the
     client doesn't send QRYROWSET in this case.

1 is causing the reported problem with the ODBC driver. I don't know
if 2 is a problem. The client driver never sends an explicit QRYROWSET
when the result set is forward-only, but maybe the ODBC driver does.

-- 
Knut Anders

Mime
View raw message