aboutsummaryrefslogtreecommitdiff
path: root/src/database/database-postgresql.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/database-postgresql.h')
-rw-r--r--src/database/database-postgresql.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/database/database-postgresql.h b/src/database/database-postgresql.h
index 36940b112..f47deda33 100644
--- a/src/database/database-postgresql.h
+++ b/src/database/database-postgresql.h
@@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class Settings;
-class Database_PostgreSQL : public Database
+class Database_PostgreSQL: public Database
{
public:
Database_PostgreSQL(const std::string &connect_string);
@@ -38,6 +38,7 @@ public:
bool initialized() const;
+
protected:
// Conversion helpers
inline int pg_to_int(PGresult *res, int row, int col)
@@ -47,41 +48,41 @@ protected:
inline u32 pg_to_uint(PGresult *res, int row, int col)
{
- return (u32)atoi(PQgetvalue(res, row, col));
+ return (u32) atoi(PQgetvalue(res, row, col));
}
inline float pg_to_float(PGresult *res, int row, int col)
{
- return (float)atof(PQgetvalue(res, row, col));
+ return (float) atof(PQgetvalue(res, row, col));
}
inline v3s16 pg_to_v3s16(PGresult *res, int row, int col)
{
- return v3s16(pg_to_int(res, row, col), pg_to_int(res, row, col + 1),
- pg_to_int(res, row, col + 2));
+ return v3s16(
+ pg_to_int(res, row, col),
+ pg_to_int(res, row, col + 1),
+ pg_to_int(res, row, col + 2)
+ );
}
inline PGresult *execPrepared(const char *stmtName, const int paramsNumber,
- const void **params, const int *paramsLengths = NULL,
- const int *paramsFormats = NULL, bool clear = true,
- bool nobinary = true)
+ const void **params,
+ const int *paramsLengths = NULL, const int *paramsFormats = NULL,
+ bool clear = true, bool nobinary = true)
{
return checkResults(PQexecPrepared(m_conn, stmtName, paramsNumber,
- (const char *const *)params,
- paramsLengths, paramsFormats,
- nobinary ? 1 : 0),
- clear);
+ (const char* const*) params, paramsLengths, paramsFormats,
+ nobinary ? 1 : 0), clear);
}
inline PGresult *execPrepared(const char *stmtName, const int paramsNumber,
- const char **params, bool clear = true, bool nobinary = true)
+ const char **params, bool clear = true, bool nobinary = true)
{
- return execPrepared(stmtName, paramsNumber, (const void **)params, NULL,
- NULL, clear, nobinary);
+ return execPrepared(stmtName, paramsNumber,
+ (const void **)params, NULL, NULL, clear, nobinary);
}
- void createTableIfNotExists(
- const std::string &table_name, const std::string &definition);
+ void createTableIfNotExists(const std::string &table_name, const std::string &definition);
void verifyDatabase();
// Database initialization
@@ -94,7 +95,6 @@ protected:
}
const int getPGVersion() const { return m_pgversion; }
-
private:
// Database connectivity checks
void ping();