--0-956788077-1242308680=:19241
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Hi All,
I am facing a issue in psqlodbc driver, that when i try to get the value of=
same colum twice throug ADO,odbc driver sends the empty value on second it=
eration.e.g if we get 'value1' of=0Acolum 'a' and we try to fetch the same =
value through ADO in loop then=0Awe will get a empty string.
=0AAfter investigation ,I found that odbc driver is explicit returning=0ANO=
_DATA_FOUND on the column if that is already fetched .following is the code=
snippt in convert.c.
if (pgdc->data_left =3D=3D 0)
=A0=A0=A0 =A0=A0=A0 {
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 if (pgdc->ttlbuf !=3D NULL)
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 {
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 free(pgdc->ttlbuf);
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 pgdc->ttlbuf =3D NULL;
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 pgdc->ttlbuflen =3D 0;
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 }
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 pgdc->data_left =3D -2;=A0=A0=A0 =A0=A0=A0 /*=
needed by ADO ? */
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 return COPY_NO_DATA_FOUND;
=A0=A0=A0 =A0=A0=A0 }
=A0We can fix this=0Aby not returning NO_DATA_FOUND on the column value whi=
ch is already=0Afetched .We can allow the driver to copy same value in clie=
nt buffer=0Aeven that was fetched already.I have written C code to test thi=
s=0Ascenario.Following is the code snippet which will help in more=0Aunders=
tanding.
=0A
=0A=A0=A0=A0 =A0=A0=A0 rc=3DSQLFetch(*(*hStmt));
=0A=A0=A0=A0 =A0=A0=A0 if(SQL_NO_DATA =3D=3D rc)
=0A=A0=A0=A0 =A0=A0=A0 {
=0A=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 printf("No Data...\r\n");
=0A=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 return 0;
=0A=A0=A0=A0 =A0=A0=A0 }=A0=A0=A0
=0A
=0ATill here lets say we have fetched the data on driver.
=0A
=0ANow following call of=A0 SQLGetData() will copy the value of colum '1' =
(second param) into the client buffer.which is good.
=0A=A0=A0=A0 =A0=A0=A0 SQLGetData( *(*hStmt),1,SQL_C_CHAR,szData,sizeof(szD=
ata),&cbData);
=0A=A0=A0=A0 =A0=A0=A0 printf("Date one call =3D [%s]\n",szData);
=0A=A0=A0=A0
=0A
=0ANow we have same following call of SQLGetData() and trying to get same=
=0Acolum('1') second time.But the driver is returing NO_DATA_FOUND in code=
=0Aand no string copied in buffer.
=0A
=0A=A0=A0=A0 =A0=A0=A0 SQLGetData( *(*hStmt),1,SQL_C_CHAR,szData,sizeof(szD=
ata),&cbData);
=0A=A0=A0=A0 =A0=A0=A0 printf("Data 2 call =3D [%s]\n",szData);
=0A=A0=A0=A0 =A0=A0=A0
=0AI hope I am able to describe the whole scenario.We can fix this by not=
=0Areturning NO_DATA_FOUND. But I wanted to confirm that if NO_DATA_FOUND i=
s explicitly returned.
Thanks,
Zahid K.
=0A=0A=0A
--0-956788077-1242308680=:19241
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
<table cellspacing=3D"0" cellpadding=3D"0" border=3D"0" ><tr><td valign=3D"=
top" style=3D"font: inherit;"><br>Hi All,<br><br><br>I am facing a issue in=
psqlodbc driver, that when i try to get the value of same colum twice thro=
ug ADO,odbc driver sends the empty value on second iteration.e.g if we get =
'value1' of=0Acolum 'a' and we try to fetch the same value through ADO in l=
oop then=0Awe will get a empty string.<br><br>=0AAfter investigation ,I fou=
nd that odbc driver is explicit returning=0ANO_DATA_FOUND on the column if =
that is already fetched .following is the code snippt in convert.c.<br><br>=
if (pgdc->data_left =3D=3D 0)<br> {=
<br> if (pgdc->t=
tlbuf !=3D NULL)<br>  =
; {<br>  =
; free(pgdc->ttlbuf);<br> &nb=
sp; pgdc->ttlbuf =3D NULL;<br>  =
; pgdc->t=
tlbuflen =3D 0;<br> =
}<br> pgdc->dat=
a_left =3D -2; /* needed by ADO ? */<b=
r> return COPY_NO_D=
ATA_FOUND;<br>
}<br><br> We can fix this=0Aby not returning NO_DA=
TA_FOUND on the column value which is already=0Afetched .We can allow the d=
river to copy same value in client buffer=0Aeven that was fetched already.I=
have written C code to test this=0Ascenario.Following is the code snippet =
which will help in more=0Aunderstanding.<br>=0A<br>=0A &n=
bsp; rc=3DSQLFetch(*(*hStmt)); <br>=0A =
if(SQL_NO_DATA =3D=3D rc)<br>=0A  =
; {<br>=0A pr=
intf("No Data...\r\n");<br>=0A &=
nbsp; return 0;<br>=0A } &n=
bsp; <br>=0A<br>=0ATill here lets say we have fetched the data on dri=
ver.<br>=0A<br>=0ANow following call of SQLGetData() will copy the v=
alue of colum '1' (second param) into the client buffer.which is good.<br><=
br>=0A SQLGetData( *(*hStmt),1,SQL_C_C=
HAR,szData,sizeof(szData),&cbData);<br>=0A &nbs=
p; printf("Date one call =3D [%s]\n",szData);<br>=0A  =
; <br>=0A<br>=0ANow we have same following call of SQLGetData() and trying =
to get same=0Acolum('1') second time.But the driver is returing NO_DATA_FOU=
ND in code=0Aand no string copied in buffer.<br>=0A<br>=0A  =
; SQLGetData( *(*hStmt),1,SQL_C_CHAR,szData,sizeof(szDat=
a),&cbData);<br>=0A printf("Data 2=
call =3D [%s]\n",szData);<br>=0A <br>=
=0AI hope I am able to describe the whole scenario.We can fix this by not=
=0Areturning NO_DATA_FOUND. But I wanted to confirm that if NO_DATA_FOUND i=
s explicitly returned.<br><br>Thanks,<br>Zahid K.<br></td></tr></table><br>=
=0A=0A
--0-956788077-1242308680=:19241--
