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 E09C99DC896 for ; Wed, 1 Mar 2006 06:20:51 -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 48965-08 for ; Wed, 1 Mar 2006 06:20:52 -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 112B89DC88D for ; Wed, 1 Mar 2006 06:20:42 -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 k21AFOnM015738 for ; Wed, 1 Mar 2006 15:45:24 +0530 Received: from sandhyar (unknown [10.0.0.205])by venus.amiindia.co.in (Postfix) with ESMTP id 5DFF3332668for ; Wed, 1 Mar 2006 15:45:24 +0530 (IST) Message-ID: <00d801c63d1a$976d8920$cd00000a@sandhyar> From: "sandhya" To: "Postgres" Subject: pls help me Date: Wed, 1 Mar 2006 15:56:24 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00D5_01C63D48.B0EA1BB0" 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:26.71068 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.082 required=5 tests=[AWL=0.080, HTML_MESSAGE=0.001, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.082 X-Spam-Level: X-Archive-Number: 200603/4 X-Sequence-Number: 20761 This is a multi-part message in MIME format. ------=_NextPart_000_00D5_01C63D48.B0EA1BB0 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_00D5_01C63D48.B0EA1BB0 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_00D5_01C63D48.B0EA1BB0--