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

Add connection pool for db.

This commit is contained in:
Jiaqiang Xu
2016-08-20 15:12:17 +08:00
parent 9e422626fd
commit 48c3f5edef
11 changed files with 146 additions and 30 deletions

View File

@@ -91,15 +91,13 @@ sqlite3_blocking_exec(sqlite3 *db, const char *sql, int (*callback)(void *, int,
typedef struct SQLiteDBConnPool {
DBConnPool parent;
char *db_path;
int max_connections;
} SQLiteDBConnPool;
DBConnPool *
sqlite_db_conn_pool_new (const char *db_path, int max_connections)
sqlite_db_conn_pool_new (const char *db_path)
{
SQLiteDBConnPool *pool = g_new0 (SQLiteDBConnPool, 1);
pool->db_path = g_strdup(db_path);
pool->max_connections = max_connections;
return (DBConnPool *)pool;
}
@@ -158,6 +156,12 @@ sqlite_db_connection_close (DBConnection *vconn)
g_free (conn);
}
gboolean
sqlite_db_connection_ping (DBConnection *vconn)
{
return TRUE;
}
gboolean
sqlite_db_connection_execute (DBConnection *vconn, const char *sql, GError **error)
{