Re: Fix for Declare/Fetch issue

From: Marko Ristola <Marko(dot)Ristola(at)kolumbus(dot)fi>
To: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
Cc: Anoop Kumar <anoopk(at)pervasive-postgres(dot)com>, pgsql-odbc(at)postgresql(dot)org, Victor Rivero <vrivero(at)cantv(dot)net>
Subject: Re: Fix for Declare/Fetch issue
Date: 2005-10-30 14:07:14
Message-ID: 4364D392.8040503@kolumbus.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc


My test case failed.

I tested only column wise query.
It returned the correct number of rows, but only the first cursor fetch got
correct data.

The self contained test case is attached:
it creates a test table, inserts there six rows and fetches
those rows as column wise. Please use Fetch=2 with it.
Finally it drops the test table.
You need to change DATABASE, USERID and PASSWORD.

It worked without Declare/fetch as it should:

OK(UseDeclareFetch=0):

After colwise query: data[1] = { 4, 0001 }, data[2] = { 4, 1001 }
After colwise query: data[1] = { 4, 2001 }, data[2] = { 4, 3001 }
After colwise query: data[1] = { 4, 4001 }, data[2] = { 4, 5001 }
ok.
(4= number of characters. "0001" is a character string value.)

FAILED (UseDeclareFetch=1,Fetch=2):

After colwise query: data[1] = { 4, 0001 }, data[2] = { 4, 1001 }
After colwise query: data[1] = { -1, UNSET }, data[2] = { -1, UNSET }
After colwise query: data[1] = { -1, UNSET }, data[2] = { -1, UNSET }
ok.

-1 means possibly a NULL value(?).
UNSET means that the string buffer is uninitialized after SQLFetchScroll.

Unfreed memory was a problem with this failed test case.
You can confirm that by setting the number of rows into 600 000 and
using Fetch=2 with Declare/Fetch.

The program prints
"INITIALIZATION OF 600000 ROWS DONE". Then the process's used memory
grows very fast.

Regards,
Marko Ristola.

Dave Page wrote:

>Great, thanks Anoop.
>
>Can anyone test this fairly quickly? I don't have the appropriate hardware
>to hand for the next few days, and it would be helpful for a number of
>reasons if we could get this committed before November.
>
>Thanks, Dave.
>
>
>

Attachment Content-Type Size
TestColwiseQuery.c text/x-csrc 6.5 KB

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message lothar.behrens 2005-10-30 18:28:38 Buffer overrun in copy_statement_with_parameters ?
Previous Message Alex Jiang 2005-10-29 14:01:50 TQuery not showing new columns