Does psqlodbc support declare/fetch in Unux?
am 19.07.2006 08:44:42 von wbbwisdom--Boundary-=_cQXKYALnQFLfHEGWRWEzItnljcfh
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 7bit
I am testing psqlodbc in our school.I wrote the following code:
....
rtcode=SQLExecDirect(hstmt,"select * from pg_largeobject",SQL_NTS);
if((rtcode!=SQL_SUCCESS) && (rtcode!=SQL_SUCCESS_WITH_INFO)){
printf("SQLExecDirect Failed!\n");
SQLFreeHandle(SQL_HANDLE_STMT,hstmt);
SQLFreeHandle(SQL_HANDLE_DBC,hdbc);
SQLFreeHandle(SQL_HANDLE_ENV,env);
exit(1);
}
printf("|loid\t|pageno\t|data\t|\n");
for(i=0;i<100;i++){
SQLFetch(hstmt);
printf("|%d\t|%d\t|%s\t|\n",loid,pageno,buffer);
}
....
There are 1532240 tuples in pg_largeobject, and their size is about 3GB. But where I run this code, the client's main memory is exhausted. It seems that the client try to get all the tuples before it fetches the first 100.
I think the client should get a small part first. If it need more tuples, it get anothor part and discard the first part. When I test psqlodbc in Windows, it seems to work well.
What's wrong? How can I fixed it?
Any reply will be appreciated!
Looking forward to your help!
--Boundary-=_cQXKYALnQFLfHEGWRWEzItnljcfh
Content-Type: text/html; charset="gb2312"
Content-Transfer-Encoding: quoted-printable
L_NTS);
if((rtcode!=3DSQL_SUCCESS) && (rtcode!=3DSQL_SUC=
CESS_WITH_INFO)){
printf("SQLExecDirect Failed!\n");
&n=
bsp; SQLFreeHandle(SQL_HANDLE_STMT,hstmt);
SQLFreeHan=
dle(SQL_HANDLE_DBC,hdbc);
SQLFreeHandle(SQL_HANDLE_ENV,env=
);
exit(1);
}
printf("|loid\t|pageno\t|d=
ata\t|\n");
for(i=3D0;i<100;i++){
SQLFetch(hst=
mt);
printf("|%d\t|%d\t|%s\t|\n",loid,pageno,buffer);
&=
nbsp;}
bout 3GB. But where I run this code, the client's main memory is exhauste=
d. It seems that the client try to get all the tuples before it fetches t=
he first 100.
ples, it get anothor part and discard the first part. When I test psqlodb=
c in Windows, it seems to work well.
=09Ïë Òª Ìå =
Ñé Ò» Ï ³¬ ´ó ³¬ ¿ì µÄ Ãâ ·Ñ =D3=
=CA Ïä Â𠣿
=09
=09 13px;line-height:160%;color:blue">Íø Ò× 3G Ãâ ·Ñ ÓÊ =A3=
¬Ç=C0 ×¢ ÔÙ µÃ 280 Õ× ´ó ÈÝ Á¿ Íø =C5=
=CC £¬¿ì À´ Ìå Ñé ÓÊ Ïä ¼« ËÙ Ö® =
ÂÃ
--Boundary-=_cQXKYALnQFLfHEGWRWEzItnljcfh--