lo wrappers - still working on it
От | Scott Holmes |
---|---|
Тема | lo wrappers - still working on it |
Дата | |
Msg-id | 200107040356.UAA31502@scotts.mynetwork.net обсуждение исходный текст |
Ответы |
Re: lo wrappers - still working on it
|
Список | pgsql-general |
Perhaps someone can point me towards what I'm missing. I've included my make command, the command for creating a function and the actual code I wrote (derived from the sample code in the docs). Incidentally, this project is too far along to change to java or any other interface. I currently am handling the files to be lo's as system files but the request is in to save them as blobs. This is the result of my make: gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I../../src/interfaces/libpq -I../../src/include -c -o amslo.o amslo.c amslo.c:19: warning: no previous prototype for `ams_loexport' gcc -shared -o amslo.so amslo.o This is the result of my trying to create a function: wcgc_pg=# create function ams_loexport(Oid, char) wcgc_pg-# returns opaque wcgc_pg-# as '/usr/local/postgresql-7.1/contrib/WCGC_PG/amslo.so' wcgc_pg-# language 'C'; ERROR: Load of file /usr/local/postgresql-7.1/contrib/WCGC_PG/amslo.so failed: /usr/local/postgresql-7.1/contrib/WCGC_PG/amslo.so: undefined symbol: PQexec wcgc_pg=# And finally, this is my attempt at coding the function: /*--------------------------------------------------------- * * amslo.c-- * large object handling for wcgc_pg documents * * *--------------------------------------------------------- */ #include <stdio.h> #include "libpq-fe.h" #include "libpq/libpq-fs.h" #define BUFSIZE 1024 /* * ams_loexport * export large object to file */ void ams_loexport(Oid lobjId, char *filename) { PGconn *conn; PGresult *res; conn = PQsetdb(NULL, NULL, NULL, NULL, "wcgc_pg"); if (PQstatus(conn) == CONNECTION_BAD) { fprintf(stderr, "Connection to wcgc_pg failed.\n"); fprintf(stderr, "%s", PQerrorMessage(conn)); return; } res = PQexec(conn, "begin"); PQclear(res); lo_export(conn, lobjId, filename); res = PQexec(conn, "end"); PQclear(res); PQfinish(conn); return; }
В списке pgsql-general по дате отправления: