X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DA1429DC951 for ; Wed, 1 Mar 2006 07:51:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63457-03 for ; Wed, 1 Mar 2006 07:51:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from venus.amiindia.co.in (unknown [203.199.198.234]) by postgresql.org (Postfix) with ESMTP id C900E9DC896 for ; Wed, 1 Mar 2006 07:51:15 -0400 (AST) Received: from venus.amiindia.co.in (localhost.localdomain [127.0.0.1]) by venus.amiindia.co.in (8.12.11/8.12.11) with ESMTP id k21BjfoD001713 for ; Wed, 1 Mar 2006 17:15:42 +0530 Received: from sandhyar (unknown [10.0.0.205])by venus.amiindia.co.in (Postfix) with ESMTP id EF285332665for ; Wed, 1 Mar 2006 17:15:38 +0530 (IST) Message-ID: <018201c63d27$34f26ec0$cd00000a@sandhyar> From: "sandhya" To: "Postgres" Subject: Fw: pls help me Date: Wed, 1 Mar 2006 17:26:38 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_017F_01C63D55.4BFC0580" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-imss-version: 2.5 X-imss-result: Passed X-imss-scores: Clean:27.06173 C:21 M:1 S:5 R:5 X-imss-settings: Baseline:5 C:3 M:3 S:4 R:3 (0.2500 0.7500) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.083 required=5 tests=[AWL=0.081, HTML_MESSAGE=0.001, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.083 X-Spam-Level: X-Archive-Number: 200603/5 X-Sequence-Number: 20762 This is a multi-part message in MIME format. ------=_NextPart_000_017F_01C63D55.4BFC0580 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, In my application i need to create a file dynamically and load it into = DB. So.....I have created one object at run time .....and trying to open it = inorder to write the content into it..... But lo_open is returning -1(-ve value). where i am doing mistake pls tell me. lobjId =3D lo_creat(conn, INV_READ | INV_WRITE); if (lobjId =3D=3D 0) fprintf(stderr, "can't create large object\n"); lobj_fd =3D lo_open(conn, lobjId, INV_WRITE); //My application failed at this point..what i am missing here ? if (lobj_fd < 0) { fprintf(stderr, "can't open large object %d\n",lobjId); } lo_lseek(conn, lobj_fd, 0, SEEK_SET); nwritten =3D 0; len =3D strlen(szContent); while (len - nwritten > 0) { nbytes =3D lo_write(conn, lobj_fd, szContent, len - nwritten); nwritten +=3D nbytes; } ------=_NextPart_000_017F_01C63D55.4BFC0580 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 

Hi,

In my application i need to create a file dynamically and load it = into=20 DB.

So.....I have created one object at run time .....and trying = to open=20 it inorder to write the content into it.....
But lo_open is returning -1(-ve=20 value).

where i am doing mistake pls tell me.

lobjId =3D lo_creat(conn, INV_READ | INV_WRITE);
if = (lobjId =3D=3D=20 0)
fprintf(stderr, "can't create large object\n");
 
lobj_fd =3D lo_open(conn, lobjId, INV_WRITE);
//My application failed at this point..what i = am=20 missing here ?
if = (lobj_fd <=20 0)
{
fprintf(stderr, "can't open large object %d\n",lobjId);
}
lo_lseek(conn, lobj_fd, 0, SEEK_SET);
nwritten =3D 0;
len =3D strlen(szContent);
while = (len - nwritten=20 > 0)
{
nbytes =3D lo_write(conn, lobj_fd, szContent, len - = nwritten);
nwritten +=3D nbytes;
}
------=_NextPart_000_017F_01C63D55.4BFC0580--