Does psqlodbc support declare/fetch in Unux?

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

I am testing psqlodbc in our school.I wrote the following code: >
 

...

 rtcode=3DSQLExecDirect(hstmt,"select * from pg_largeobject",SQ=
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;}

...

 

There are 1532240 tuples in pg_largeobject, and their size is a=
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.

 

I think the client should get a small part first. If it need more tu=
ples, it get anothor part and discard the first part. When I test psqlodb=
c 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!

 

 






v style=3D"border-bottom:1px solid #999">



=09Ïë Òª Ìå =
Ñé Ò» Ï ³¬ ´ó ³¬ ¿ì µÄ Ãâ ·Ñ =D3=
=CA Ïä Â𠣿

=09

=09 13px;line-height:160%;color:blue">Íø Ò× 3G Ãâ ·Ñ ÓÊ =A3=
¬Ç=C0 ×¢ ÔÙ µÃ 280 Õ× ´ó ÈÝ Á¿ Íø =C5=
=CC £¬¿ì À´ Ìå Ñé ÓÊ Ïä ¼« ËÙ Ö® =
ÂÃ



--Boundary-=_cQXKYALnQFLfHEGWRWEzItnljcfh--

Re: Does psqlodbc support declare/fetch in Un ux?

am 20.07.2006 09:09:53 von Ludek Finstrle

> 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.
>
> What's wrong? How can I fixed it?

What connection string? What's the settings in odbc.ini?
The first question is if you are using declare/fetch.

Could you send us the mylog output?

Regards,

Luf

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster