X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B1C8BD84AA for ; Thu, 1 Sep 2005 11:40:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26720-08 for ; Thu, 1 Sep 2005 14:40:20 +0000 (GMT) Received: from svctag-ckgvz71.mailserver.wazagua.com (unknown [209.34.245.244]) by svr1.postgresql.org (Postfix) with ESMTP id A2ADBD8462 for ; Thu, 1 Sep 2005 11:40:18 -0300 (ADT) Received: from jfradkin ([66.15.127.235]) by svctag-ckgvz71.mailserver.wazagua.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 1 Sep 2005 10:40:30 -0400 From: "Joel Fradkin" To: "'Dave Page'" Cc: 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> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable In-Reply-To: X-OriginalArrivalTime: 01 Sep 2005 14:40:30.0125 (UTC) FILETIME=[19B915D0:01C5AF03] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.902 required=5 tests=[AWL=-0.174, MSGID_DOLLARS=3.076] X-Spam-Level: ** X-Archive-Number: 200509/8 X-Sequence-Number: 5906 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]; =20 // Get the data in chunks do=20 { retcode =3D SQLGetData(hStmt, 1, SQL_C_CHAR, szChunk, sizeof(szChunk), &cbData); strcat(szData, szChunk); } while (retcode !=3D SQL_SUCCESS && retcode !=3D 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 =20 -----Original Message----- From: Dave Page [mailto:dpage@vale-housing.co.uk]=20 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 =20 > -----Original Message----- > From: Joel Fradkin [mailto:jfradkin@wazagua.com]=20 > Sent: 01 September 2005 14:48 > To: Dave Page > Subject: RE: [ODBC] figuring out why I am having this issue >=20 > 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]; =20 // Get the data in chunks do=20 { retcode =3D SQLGetData(hStmt, 1, SQL_C_CHAR, szChunk, sizeof(szChunk), &cbData); strcat(szData, szChunk); } while (retcode !=3D SQL_SUCCESS && retcode !=3D 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=20 > using some odd > char like the 1/2 char you know where it makes it small etc.=20 > 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 =3D strlen(string); tuple_field->value =3D malloc(strlen(string) + 1); strcpy(tuple_field->value, string); } Regards, Dave