Exemple #1
0
void db_sql_unref(struct sql_connection **_conn)
{
        struct sql_connection *conn = *_conn;

	/* abort all pending auth requests before setting conn to NULL,
	   so that callbacks can still access it */
	sql_disconnect(conn->db);

	*_conn = NULL;
	if (--conn->refcount > 0)
		return;

	sql_deinit(&conn->db);
	pool_unref(&conn->pool);
}
Exemple #2
0
int sql_init()
{
	sql_account = sql_create(sql_addr, sql_user, sql_password, sql_db_name);

	if (!sql_account)
	{
		sys_err("cannot create sql_account");
		return 0;
	}


	if (!sql_async_start(sql_account))
	{
		sql_deinit();
		return 0;
	}

	return 1;
}