psyced/world/net/d/pgsql.c
psyc://loupsycedyglgamf.onion/~lynX d52b7ee982 sql ifdefs
1984-04-04 00:44:08 +00:00

26 lines
545 B
C

#include <net.h>
#if defined(STORAGE_PGSQL)
/*
* using one database connection is sufficient
*
* WARNING
* ONLY USE THIS IF YOUR DRIVER HAS THE SYNC PG PACKAGE
* (otherwise you dont have the pg_connect_sync and pg_query_sync efuns ;-)
*/
create() {
int ret;
ret = pg_connect_sync(STORAGE_PGSQL_CONNECT);
PT(("ret %d\n", ret))
}
mixed query(string q, varargs mixed args) {
// TODO: it might be wise to db_conv_string on each arg to
// avoid sql injections
return pg_query_sync(sprintf(q, args...));
}
#endif