From: Joel Fradkin <jfradkin@wazagua.com>
To: 'Dave Page' <dpage@vale-housing.co.uk>
Cc: pgsql-odbc@postgresql.org
Subject: Re: figuring out why I am having this issue
Date: Thu, 1 Sep 2005 10:42:51 -0400
Message-ID: <000401c5af03$6e850060$797ba8c0@jfradkin> (raw)
In-Reply-To: <E7F85A1B5FF8D44C8A1AF6885BC9A0E4AC9DF6@ratbert.vale-housing.co.uk>
I would like to look at this code, but searching the source I am not even
seeing it?
char szData[max_longvarchar_size];
char szChunk[1024];
// Get the data in chunks
do
{
retcode = SQLGetData(hStmt, 1, SQL_C_CHAR, szChunk,
sizeof(szChunk), &cbData);
strcat(szData, szChunk);
} while (retcode != SQL_SUCCESS && retcode != SQL_NO_DATA);
Maybe I am too out of touch with C to be any help, but I should at a minimum
be able to see the code you are referenceing?
Joel Fradkin
-----Original Message-----
From: Dave Page [mailto:dpage@vale-housing.co.uk]
Sent: Thursday, September 01, 2005 10:06 AM
To: Joel Fradkin
Cc: pgsql-odbc@postgresql.org
Subject: RE: [ODBC] figuring out why I am having this issue
> -----Original Message-----
> From: Joel Fradkin [mailto:jfradkin@wazagua.com]
> Sent: 01 September 2005 14:48
> To: Dave Page
> Subject: RE: [ODBC] figuring out why I am having this issue
>
> What if the
> size it thinks the field is is wrong?
It defaults the max_longvarchar_size if the DB doesn't return a value.
Note that this is for the column though, not the individual field.
I suppose what could be happening is this:
1) The app queries (using SQLDescribeCol) the results for the data type
etc.
2) The app allocates a buffer based on the size reported for the notes
column.
3) The app reads a notes field (using SQLGetData), which reports the
actual field size.
4) It keeps reading chunks of data until it gets to the end, and
somewhere along the line, overflows the buffer allocated, eg:
char szData[max_longvarchar_size];
char szChunk[1024];
// Get the data in chunks
do
{
retcode = SQLGetData(hStmt, 1, SQL_C_CHAR, szChunk,
sizeof(szChunk), &cbData);
strcat(szData, szChunk);
} while (retcode != SQL_SUCCESS && retcode != SQL_NO_DATA);
> This is not an issue for all data in my table (I have a huge amount of
> records it works fine for). I noticed this notes field is
> using some odd
> char like the 1/2 char you know where it makes it small etc.
> Maybe it is not
> calculating the size of this particular note field.
I doubt it - for strings that's handled here:
void
set_tuplefield_string(TupleField *tuple_field, const char *string)
{
tuple_field->len = strlen(string);
tuple_field->value = malloc(strlen(string) + 1);
strcpy(tuple_field->value, string);
}
Regards, Dave
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: jfradkin@wazagua.com, dpage@vale-housing.co.uk
Subject: Re: figuring out why I am having this issue
In-Reply-To: <000401c5af03$6e850060$797ba8c0@jfradkin>
References: <E7F85A1B5FF8D44C8A1AF6885BC9A0E4AC9DF6@ratbert.vale-housing.co.uk> <000401c5af03$6e850060$797ba8c0@jfradkin>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox