libpg: large object problems

Поиск
Список
Период
Сортировка
От Seth Nickell
Тема libpg: large object problems
Дата
Msg-id 1051933842.10718.14.camel@beauty.stanford.edu
обсуждение исходный текст
Ответы Re: libpg: large object problems  (greg@turnstep.com)
Список pgsql-novice
Hi,

I'm trying to figure out how to get large objects working using libpg.
The problem is that whenever I do an lo_open on an object, I get back
"-1" as the file descriptor (and of course, an lo_read on that fails).

  Oid id = lo_creat (dbConn, INV_READ | INV_WRITE);
  fd = lo_open (dbConn, id, INV_WRITE);

That's what I'm basically doing. "id" ends up being a somewhat sensible
looking large-ish number.

I've also tried doing lo_open's of files that I lo_import'ed (and can
successfully lo_export using the console, so I know they're "in there").
Same problem.

Any ideas what I'm doing wrong? I've included the full text of my simple
test case below. I've also tried this with a remote PostgreSQL server,
both times verifying that I could run queries and such (so the
connection to the server is working on at least that level :-)

thanks!

-Seth


---------Full Text of Test Program--------

static PGconn *dbConn = NULL;

int main(int argc, char **argv) {
  char * error;
  Oid id;
  int fd;

  dbConn = PQconnectdb("");
  error = PQerrorMessage(dbConn);

  if(strlen(error) > 0){
    fprintf(stderr, "DB connection error to gargamel: %s\n", error);
    return -1;
  }

  Oid id = lo_creat (dbConn, INV_READ | INV_WRITE);

  fd = lo_open (dbConn, id, INV_WRITE);

  printf ("fd is: %d, id is: %d\n", fd, id);

  return 0;
}


В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Search speed issues
Следующее
От: greg@turnstep.com
Дата:
Сообщение: Re: libpg: large object problems