1
0
mirror of https://github.com/haiwen/ccnet-server.git synced 2025-09-07 15:50:22 +00:00

Conditional compile MySQL and PostgreSQL support.

This commit is contained in:
Jiaqiang Xu
2016-08-20 17:50:06 +08:00
parent 48c3f5edef
commit 51bde41209
5 changed files with 59 additions and 6 deletions

View File

@@ -1,9 +1,15 @@
#include "common.h"
#include "db-wrapper.h"
#include "mysql-db-ops.h"
#include "sqlite-db-ops.h"
#ifdef HAVE_MYSQL
#include "mysql-db-ops.h"
#endif
#ifdef HAVE_POSTGRESQL
#include "pgsql-db-ops.h"
#endif
typedef struct DBOperations {
void (*db_conn_pool_free) (DBConnPool *);
@@ -40,6 +46,8 @@ init_conn_pool_common (DBConnPool *pool, int max_connections)
pool->max_connections = max_connections;
}
#ifdef HAVE_MYSQL
DBConnPool *
db_conn_pool_new_mysql (const char *host,
const char *user,
@@ -81,6 +89,10 @@ db_conn_pool_new_mysql (const char *host,
return pool;
}
#endif
#ifdef HAVE_POSTGRESQL
DBConnPool *
db_conn_pool_new_pgsql (const char *host,
const char *user,
@@ -118,6 +130,8 @@ db_conn_pool_new_pgsql (const char *host,
return pool;
}
#endif
DBConnPool *
db_conn_pool_new_sqlite (const char *db_path, int max_connections)
{