aboutsummaryrefslogtreecommitdiff
path: root/src/database/database-postgresql.h
diff options
context:
space:
mode:
authorJude Melton-Houghton <jwmhjwmh@gmail.com>2022-10-20 16:14:33 -0400
committerLoïc Blot <nerzhul@users.noreply.github.com>2022-11-10 18:56:48 +0100
commit00eb65915fb31539d747b57282f7383e8996af6a (patch)
treef108dd8ace09add4df82ada5061932d2ec5aedbe /src/database/database-postgresql.h
parentf8c781b46c693d8b1109d28f1105db18110d6e77 (diff)
downloadminetest-00eb65915fb31539d747b57282f7383e8996af6a.tar.xz
Add PostgreSQL helper pg_to_string
Diffstat (limited to 'src/database/database-postgresql.h')
-rw-r--r--src/database/database-postgresql.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/database/database-postgresql.h b/src/database/database-postgresql.h
index 22269d362..278379f5d 100644
--- a/src/database/database-postgresql.h
+++ b/src/database/database-postgresql.h
@@ -65,6 +65,11 @@ protected:
);
}
+ inline std::string pg_to_string(PGresult *res, int row, int col)
+ {
+ return std::string(PQgetvalue(res, row, col), PQgetlength(res, row, col));
+ }
+
inline PGresult *execPrepared(const char *stmtName, const int paramsNumber,
const void **params,
const int *paramsLengths = NULL, const int *paramsFormats = NULL,