aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_postgres_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_postgres_lib.h')
-rw-r--r--src/include/gnunet_postgres_lib.h40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/include/gnunet_postgres_lib.h b/src/include/gnunet_postgres_lib.h
index 79fb66f67..0307df50d 100644
--- a/src/include/gnunet_postgres_lib.h
+++ b/src/include/gnunet_postgres_lib.h
@@ -45,7 +45,7 @@ extern "C"
45/** 45/**
46 * Check if the result obtained from Postgres has 46 * Check if the result obtained from Postgres has
47 * the desired status code. If not, log an error, clear the 47 * the desired status code. If not, log an error, clear the
48 * result and return GNUNET_SYSERR. 48 * result and return #GNUNET_SYSERR.
49 * 49 *
50 * @param dbh database handle 50 * @param dbh database handle
51 * @param ret return value from database operation to check 51 * @param ret return value from database operation to check
@@ -54,25 +54,29 @@ extern "C"
54 * @param args arguments given to the command 54 * @param args arguments given to the command
55 * @param filename name of the source file where the command was run 55 * @param filename name of the source file where the command was run
56 * @param line line number in the source file 56 * @param line line number in the source file
57 * @return GNUNET_OK if the result is acceptable 57 * @return #GNUNET_OK if the result is acceptable
58 */ 58 */
59int 59int
60GNUNET_POSTGRES_check_result_ (PGconn *dbh, PGresult * ret, int expected_status, 60GNUNET_POSTGRES_check_result_ (PGconn *dbh,
61 const char *command, const char *args, 61 PGresult *ret,
62 const char *filename, int line); 62 int expected_status,
63 const char *command,
64 const char *args,
65 const char *filename,
66 int line);
63 67
64 68
65/** 69/**
66 * Check if the result obtained from Postgres has 70 * Check if the result obtained from Postgres has
67 * the desired status code. If not, log an error, clear the 71 * the desired status code. If not, log an error, clear the
68 * result and return GNUNET_SYSERR. 72 * result and return #GNUNET_SYSERR.
69 * 73 *
70 * @param dbh database handle 74 * @param dbh database handle
71 * @param ret return value from database operation to check 75 * @param ret return value from database operation to check
72 * @param expected_status desired status 76 * @param expected_status desired status
73 * @param command description of the command that was run 77 * @param command description of the command that was run
74 * @param args arguments given to the command 78 * @param args arguments given to the command
75 * @return GNUNET_OK if the result is acceptable 79 * @return #GNUNET_OK if the result is acceptable
76 */ 80 */
77#define GNUNET_POSTGRES_check_result(dbh,ret,expected_status,command,args) GNUNET_POSTGRES_check_result_(dbh,ret,expected_status,command,args,__FILE__,__LINE__) 81#define GNUNET_POSTGRES_check_result(dbh,ret,expected_status,command,args) GNUNET_POSTGRES_check_result_(dbh,ret,expected_status,command,args,__FILE__,__LINE__)
78 82
@@ -84,10 +88,13 @@ GNUNET_POSTGRES_check_result_ (PGconn *dbh, PGresult * ret, int expected_status,
84 * @param sql statement to run 88 * @param sql statement to run
85 * @param filename filename for error reporting 89 * @param filename filename for error reporting
86 * @param line code line for error reporting 90 * @param line code line for error reporting
87 * @return GNUNET_OK on success 91 * @return #GNUNET_OK on success
88 */ 92 */
89int 93int
90GNUNET_POSTGRES_exec_ (PGconn *dbh, const char *sql, const char *filename, int line); 94GNUNET_POSTGRES_exec_ (PGconn *dbh,
95 const char *sql,
96 const char *filename,
97 int line);
91 98
92 99
93/** 100/**
@@ -95,7 +102,7 @@ GNUNET_POSTGRES_exec_ (PGconn *dbh, const char *sql, const char *filename, int l
95 * 102 *
96 * @param dbh database handle 103 * @param dbh database handle
97 * @param sql statement to run 104 * @param sql statement to run
98 * @return GNUNET_OK on success 105 * @return #GNUNET_OK on success
99 */ 106 */
100#define GNUNET_POSTGRES_exec(dbh,sql) GNUNET_POSTGRES_exec_(dbh,sql,__FILE__,__LINE__) 107#define GNUNET_POSTGRES_exec(dbh,sql) GNUNET_POSTGRES_exec_(dbh,sql,__FILE__,__LINE__)
101 108
@@ -109,12 +116,15 @@ GNUNET_POSTGRES_exec_ (PGconn *dbh, const char *sql, const char *filename, int l
109 * @param nparams number of parameters in sql 116 * @param nparams number of parameters in sql
110 * @param filename filename for error reporting 117 * @param filename filename for error reporting
111 * @param line code line for error reporting 118 * @param line code line for error reporting
112 * @return GNUNET_OK on success 119 * @return #GNUNET_OK on success
113 */ 120 */
114int 121int
115GNUNET_POSTGRES_prepare_ (PGconn *dbh, const char *name, const char *sql, 122GNUNET_POSTGRES_prepare_ (PGconn *dbh,
123 const char *name,
124 const char *sql,
116 int nparams, 125 int nparams,
117 const char *filename, int line); 126 const char *filename,
127 int line);
118 128
119 129
120/** 130/**
@@ -124,7 +134,7 @@ GNUNET_POSTGRES_prepare_ (PGconn *dbh, const char *name, const char *sql,
124 * @param name name for the prepared SQL statement 134 * @param name name for the prepared SQL statement
125 * @param sql SQL code to prepare 135 * @param sql SQL code to prepare
126 * @param nparams number of parameters in sql 136 * @param nparams number of parameters in sql
127 * @return GNUNET_OK on success 137 * @return #GNUNET_OK on success
128 */ 138 */
129#define GNUNET_POSTGRES_prepare(dbh,name,sql,nparams) GNUNET_POSTGRES_prepare_(dbh,name,sql,nparams,__FILE__,__LINE__) 139#define GNUNET_POSTGRES_prepare(dbh,name,sql,nparams) GNUNET_POSTGRES_prepare_(dbh,name,sql,nparams,__FILE__,__LINE__)
130 140
@@ -148,7 +158,7 @@ GNUNET_POSTGRES_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
148 * @param dbh database handle 158 * @param dbh database handle
149 * @param stmt name of the prepared statement 159 * @param stmt name of the prepared statement
150 * @param rowid which row to delete 160 * @param rowid which row to delete
151 * @return GNUNET_OK on success 161 * @return #GNUNET_OK on success
152 */ 162 */
153int 163int
154GNUNET_POSTGRES_delete_by_rowid (PGconn *dbh, 164GNUNET_POSTGRES_delete_by_rowid (PGconn *dbh,