void SQLI_DB_Connect(struct DBdesc *db, char *host) { if (!db->fail) { if (sqlite3_open(db->filename, (sqlite3 **)&db->desc)) { sql_db_fail(db); SQLI_get_errmsg(db); sql_db_errmsg(db); } else sql_db_ok(db); } }
void MY_DB_Connect(struct DBdesc *db, char *host) { MYSQL *dbptr = db->desc; if (!db->fail) { mysql_init(db->desc); dbptr->reconnect = TRUE; if (!mysql_real_connect(db->desc, host, config.sql_user, config.sql_passwd, config.sql_db, 0, NULL, 0)) { sql_db_fail(db); MY_get_errmsg(db); sql_db_errmsg(db); } else sql_db_ok(db); } }
void PG_DB_Connect(struct DBdesc *db, char *host) { if (!db->fail) { db->desc = PQconnectdb(db->conn_string); if (PQstatus(db->desc) == CONNECTION_BAD) { char errmsg[64+SRVBUFLEN]; sql_db_fail(db); strcpy(errmsg, "Failed connecting to "); strcat(errmsg, db->conn_string); db->errmsg = errmsg; sql_db_errmsg(db); } else sql_db_ok(db); } }