
HELP!!!

I'm stuck for strange reason!
This is my first attempt to use pg_lo concept in my apps:

...
 Oid oid;
 PGconn* dbcon = PQconnectdb(conninfo.c_str());
 oid = lo_creat(dbcon, INV_WRITE | INV_READ);
 int pgfd = lo_open(dbcon, oid, INV_WRITE | INV_READ);
...


lo_open ALWAYS returns -1 while oid is positive (I can even see oid
in pg_largeobject system table)!!!!

postmaster reports the following:
ERROR:  lo_lseek: invalid large obj descriptor (0)

I realy NEED a prompt advice!

Please find a couple of minutes for reply!
TIA
Stanislav

ps> I run FreeBSD-4.4 + ported PostgreSQL-7.1.3
pps> my other pg-connected apps run OK


Mon, 9 Sep 2002 20:01:12 +0400 (MSD)
Stanislav Silnitski <stalker@minicorp.ru>
IN FIRE
Stanislav Silnitski <stalker@minicorp.ru> writes:

> HELP!!!
> 
> I'm stuck for strange reason!
> This is my first attempt to use pg_lo concept in my apps:
> 
> ...
>  Oid oid;
>  PGconn* dbcon = PQconnectdb(conninfo.c_str());
>  oid = lo_creat(dbcon, INV_WRITE | INV_READ);
>  int pgfd = lo_open(dbcon, oid, INV_WRITE | INV_READ);
> ...
> 
> 
> lo_open ALWAYS returns -1 while oid is positive (I can even see oid
> in pg_largeobject system table)!!!!
> 
> postmaster reports the following:
> ERROR:  lo_lseek: invalid large obj descriptor (0)

You need to do all your LO manipulation inside a transaction.  See the
docs.

-Doug

10 Sep 2002 08:56:24 -0400
Doug McNaught <doug@mcnaught.org>
Re: IN FIRE
> 
> I'm stuck for strange reason!
> This is my first attempt to use pg_lo concept in my apps:
> 
> ...
>  Oid oid;
>  PGconn* dbcon = PQconnectdb(conninfo.c_str());
>  oid = lo_creat(dbcon, INV_WRITE | INV_READ);
>  int pgfd = lo_open(dbcon, oid, INV_WRITE | INV_READ);
> ...
> 
> 
> lo_open ALWAYS returns -1 while oid is positive (I can even see oid
> in pg_largeobject system table)!!!!

Use transactions (BEGIN; END;). Large objects rely on this



Tue, 10 Sep 2002 16:25:12 +0200
"Mario Weilguni" <mweilguni@sime.com>
Re: IN FIRE