sql ifdefs

This commit is contained in:
psyc://loupsycedyglgamf.onion/~lynX 1984-04-04 00:44:08 +00:00
parent 18e72b74cc
commit d52b7ee982
2 changed files with 15 additions and 5 deletions

View File

@ -1,21 +1,26 @@
#include <net.h>
#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

View File

@ -1,5 +1,7 @@
#include <net.h>
#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