convert fs publish to MQ
[oweals/gnunet.git] / src / include / gnunet_postgres_lib.h
index 8f720474893f5175b583a12029799a33a71e00be..0307df50d183e0c33d5c45f53266b5d1f79c05eb 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     (C) 2012 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2012 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 /**
- * @file include/gnunet_postgres_lib.h
- * @brief library to help with access to a Postgres database
  * @author Christian Grothoff
+ *
+ * @file
+ * Helper library to access a PostgreSQL database
+ *
+ * @defgroup postgres  PostgreSQL library
+ * Helper library to access a PostgreSQL database.
+ * @{
  */
 #ifndef GNUNET_POSTGRES_LIB_H
 #define GNUNET_POSTGRES_LIB_H
 
 #include "gnunet_util_lib.h"
-#include <postgresql/libpq-fe.h>
+#include <libpq-fe.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -40,34 +45,38 @@ extern "C"
 /**
  * Check if the result obtained from Postgres has
  * the desired status code.  If not, log an error, clear the
- * result and return GNUNET_SYSERR.
+ * result and return #GNUNET_SYSERR.
  *
  * @param dbh database handle
  * @param ret return value from database operation to check
  * @param expected_status desired status
  * @param command description of the command that was run
- * @param args arguments given to the command 
+ * @param args arguments given to the command
  * @param filename name of the source file where the command was run
  * @param line line number in the source file
- * @return GNUNET_OK if the result is acceptable
+ * @return #GNUNET_OK if the result is acceptable
  */
 int
-GNUNET_POSTGRES_check_result_ (PGconn *dbh, PGresult * ret, int expected_status,
-                              const char *command, const char *args,
-                              const char *filename, int line);
+GNUNET_POSTGRES_check_result_ (PGconn *dbh, 
+                              PGresult *ret,
+                              int expected_status,
+                               const char *command, 
+                              const char *args,
+                               const char *filename, 
+                              int line);
 
 
 /**
  * Check if the result obtained from Postgres has
  * the desired status code.  If not, log an error, clear the
- * result and return GNUNET_SYSERR.
+ * result and return #GNUNET_SYSERR.
  *
  * @param dbh database handle
  * @param ret return value from database operation to check
  * @param expected_status desired status
  * @param command description of the command that was run
- * @param args arguments given to the command 
- * @return GNUNET_OK if the result is acceptable
+ * @param args arguments given to the command
+ * @return #GNUNET_OK if the result is acceptable
  */
 #define GNUNET_POSTGRES_check_result(dbh,ret,expected_status,command,args) GNUNET_POSTGRES_check_result_(dbh,ret,expected_status,command,args,__FILE__,__LINE__)
 
@@ -78,11 +87,14 @@ GNUNET_POSTGRES_check_result_ (PGconn *dbh, PGresult * ret, int expected_status,
  * @param dbh database handle
  * @param sql statement to run
  * @param filename filename for error reporting
- * @param line code line for error reporting 
- * @return GNUNET_OK on success
+ * @param line code line for error reporting
+ * @return #GNUNET_OK on success
  */
 int
-GNUNET_POSTGRES_exec_ (PGconn *dbh, const char *sql, const char *filename, int line);
+GNUNET_POSTGRES_exec_ (PGconn *dbh, 
+                      const char *sql, 
+                      const char *filename, 
+                      int line);
 
 
 /**
@@ -90,7 +102,7 @@ GNUNET_POSTGRES_exec_ (PGconn *dbh, const char *sql, const char *filename, int l
  *
  * @param dbh database handle
  * @param sql statement to run
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
  */
 #define GNUNET_POSTGRES_exec(dbh,sql) GNUNET_POSTGRES_exec_(dbh,sql,__FILE__,__LINE__)
 
@@ -104,12 +116,15 @@ GNUNET_POSTGRES_exec_ (PGconn *dbh, const char *sql, const char *filename, int l
  * @param nparams number of parameters in sql
  * @param filename filename for error reporting
  * @param line code line for error reporting
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
  */
 int
-GNUNET_POSTGRES_prepare_ (PGconn *dbh, const char *name, const char *sql,
-                         int nparams,
-                         const char *filename, int line);
+GNUNET_POSTGRES_prepare_ (PGconn *dbh, 
+                         const char *name, 
+                         const char *sql,
+                          int nparams,
+                          const char *filename, 
+                         int line);
 
 
 /**
@@ -119,7 +134,7 @@ GNUNET_POSTGRES_prepare_ (PGconn *dbh, const char *name, const char *sql,
  * @param name name for the prepared SQL statement
  * @param sql SQL code to prepare
  * @param nparams number of parameters in sql
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
  */
 #define GNUNET_POSTGRES_prepare(dbh,name,sql,nparams) GNUNET_POSTGRES_prepare_(dbh,name,sql,nparams,__FILE__,__LINE__)
 
@@ -133,7 +148,7 @@ GNUNET_POSTGRES_prepare_ (PGconn *dbh, const char *name, const char *sql,
  */
 PGconn *
 GNUNET_POSTGRES_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                        const char *section);
+                         const char *section);
 
 
 /**
@@ -143,13 +158,12 @@ GNUNET_POSTGRES_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
  * @param dbh database handle
  * @param stmt name of the prepared statement
  * @param rowid which row to delete
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
  */
 int
 GNUNET_POSTGRES_delete_by_rowid (PGconn *dbh,
-                                const char *stmt,
-                                uint32_t rowid);
-
+                                 const char *stmt,
+                                 uint32_t rowid);
 
 
 #if 0                           /* keep Emacsens' auto-indent happy */
@@ -159,5 +173,6 @@ GNUNET_POSTGRES_delete_by_rowid (PGconn *dbh,
 }
 #endif
 
-/* end of gnunet_postgres_lib.h */
 #endif
+
+/** @} */  /* end of group */