aboutsummaryrefslogtreecommitdiff
path: root/src/database_postgres.cc
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-10-19 19:17:37 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-10-19 19:17:37 -0300
commit0ff6217227ce551d6c91524c8e7fd37352e20490 (patch)
treefee2e9da746115fda57ca6123952d614afd283dd /src/database_postgres.cc
parenteba55f8361fc36179e36bf8a3cea5067b5341e37 (diff)
downloadquerymanager-0ff6217227ce551d6c91524c8e7fd37352e20490.tar.gz
querymanager-0ff6217227ce551d6c91524c8e7fd37352e20490.zip
add include path for PostgreSQL + overall cleanup
Some distributions place libpq headers under /usr/include/postgresql which is why it's added to the include path. And even though we don't support it yet, the same happens with MariaDB, with headers being placed under /usr/include/mariadb.
Diffstat (limited to 'src/database_postgres.cc')
-rw-r--r--src/database_postgres.cc37
1 files changed, 1 insertions, 36 deletions
diff --git a/src/database_postgres.cc b/src/database_postgres.cc
index 3b19914..b53e780 100644
--- a/src/database_postgres.cc
+++ b/src/database_postgres.cc
@@ -476,7 +476,7 @@ static int GetResultByteA(PGresult *Result, int Row, int Col, uint8 *Buffer, int
return Size;
}
-#if 1
+#if 0
// NOTE(fusion): DO NOT REMOVE. It is currently not being used so it's switched
// off to avoid compiler warnings.
static int GetResultIPAddress(PGresult *Result, int Row, int Col){
@@ -1271,41 +1271,6 @@ TDatabase *DatabaseOpen(void){
return NULL;
}
-#if 0
- {
- // TODO(fusion): REMOVE. This is for testing query input/output, to make sure
- // they're consitent across different formats (text/binary).
- const char *Stmt = PrepareQuery(Database,
- "SELECT NULL::BOOLEAN, NULL::INTEGER, NULL::TEXT, NULL::BYTEA,"
- " NULL::INET, NULL::TIMESTAMP, NULL::INTERVAL");
- ASSERT(Stmt != NULL);
-
- for(int i = 0; i <= 1; i += 1)
- for(int j = 0; j <= 1; j += 1){
- LOG("TEST (%d, %d)", i, j);
- ParamBuffer Params;
- ParamBegin(&Params, 0, i);
- PGresult *Result = PQexecPrepared(Database->Handle, Stmt, Params.NumParams,
- Params.Values, Params.Lengths, Params.Formats, j);
- AutoResultClear ResultGuard(Result);
- if(PQresultStatus(Result) == PGRES_TUPLES_OK){
- LOG("0: %d", GetResultBool(Result, 0, 0));
- LOG("1: %d", GetResultInt(Result, 0, 1));
- LOG("2: %s", GetResultText(Result, 0, 2));
- LOG("3: %d", GetResultByteA(Result, 0, 3, NULL, 0));
- LOG("4: %d", GetResultIPAddress(Result, 0, 4));
- LOG("5: %d", GetResultTimestamp(Result, 0, 5));
- LOG("6: %d", GetResultInterval(Result, 0, 6));
- }else{
- LOG_ERR("Failed to execute query: %s", PQerrorMessage(Database->Handle));
- }
- }
-
- DatabaseClose(Database);
- return NULL;
- }
-#endif
-
return Database;
}