From d52b7ee982a2833064e12b126379dcb93c3e586e Mon Sep 17 00:00:00 2001 From: "psyc://loupsycedyglgamf.onion/~lynX" Date: Wed, 4 Apr 1984 00:44:08 +0000 Subject: [PATCH] sql ifdefs --- world/net/d/mysql.c | 14 +++++++++++--- world/net/d/pgsql.c | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/world/net/d/mysql.c b/world/net/d/mysql.c index e9ffed6..ae5aeaf 100644 --- a/world/net/d/mysql.c +++ b/world/net/d/mysql.c @@ -1,21 +1,26 @@ #include +#if defined(STORAGE_MYSQL) +# if __EFUN_DEFINED__(db_connect) + /* * from ldmud's concepts/mysql: + * * As mySQL "limits" the number of connections to 100 and as every * connection to the mySQL-server takes time, you should use * database serverobjects in your MUD which constantly keep the * connection to the mySQL-server. * - * hence we use this instead of letting each object have it's own connection + * hence we use this instead of letting each object have its own connection. + * + * Actually we aren't using this code at all, since psyced makes no + * operations by which it makes sense to use SQL rather than flat files. */ volatile int handle; create() { -#if defined(STORAGE_MYSQL) handle = db_connect(STORAGE_MYSQL_DATABASE, STORAGE_MYSQL_USER, STORAGE_MYSQL_PASSWORD); -#endif } mixed query(string q, varargs mixed args) { @@ -30,3 +35,6 @@ mixed query(string q, varargs mixed args) { data += ({ row }); return data; } + +# endif +#endif diff --git a/world/net/d/pgsql.c b/world/net/d/pgsql.c index a5a0969..1e370c6 100644 --- a/world/net/d/pgsql.c +++ b/world/net/d/pgsql.c @@ -1,5 +1,7 @@ #include +#if defined(STORAGE_PGSQL) + /* * using one database connection is sufficient * @@ -10,10 +12,8 @@ create() { int ret; -#if defined(STORAGE_PGSQL) ret = pg_connect_sync(STORAGE_PGSQL_CONNECT); PT(("ret %d\n", ret)) -#endif } mixed query(string q, varargs mixed args) { @@ -21,3 +21,5 @@ mixed query(string q, varargs mixed args) { // avoid sql injections return pg_query_sync(sprintf(q, args...)); } + +#endif