I've tried to write something like this
Code:
#include <libpq-fe.h>
#include <libpq/libpq-fs.h>
#include <stdio.h>
int main (void)
{
Oid lobjId;
PGconn *conn = PQsetdb(NULL, NULL, NULL, NULL, "cpns");
if (conn != NULL) {
PGresult *result = PQexec(conn, "begin");
PQclear(result);
lobjId = lo_creat(conn, INV_WRITE | INV_READ);
if (lobjId == 0) {
printf("Unable to create large object\n");
} else {
printf("Large object successfully created\n");
}
PQexec(conn, "end");
PQfinish(conn);
}
return(0);
}
it compiles fine, but when I try to execute it, an error occurred.
what's wrong with it?