/*
This file is part of GNUnet
- (C) 2009, 2010, 2012 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2009, 2010, 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 postgres/postgres.c
* @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)
{
if (ret == NULL)
{
* @param sql statement to run
* @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_exec_ (PGconn * dbh, const char *sql, const char *filename,
+GNUNET_POSTGRES_exec_ (PGconn * dbh,
+ const char *sql,
+ const char *filename,
int line)
{
PGresult *ret;
* @param dbh database handle
* @param name name for the prepared SQL statement
* @param sql SQL code to prepare
- * @param nparms number of parameters in sql
+ * @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 nparms, const char *filename, int line)
+GNUNET_POSTGRES_prepare_ (PGconn *dbh,
+ const char *name,
+ const char *sql,
+ int nparams,
+ const char *filename,
+ int line)
{
PGresult *ret;
- ret = PQprepare (dbh, name, sql, nparms, NULL);
+ ret = PQprepare (dbh,
+ name,
+ sql,
+ nparams, NULL);
if (GNUNET_OK !=
- GNUNET_POSTGRES_check_result_ (dbh, ret, PGRES_COMMAND_OK, "PQprepare",
- sql, filename, line))
+ GNUNET_POSTGRES_check_result_ (dbh,
+ ret,
+ PGRES_COMMAND_OK,
+ "PQprepare",
+ sql,
+ filename,
+ line))
return GNUNET_SYSERR;
PQclear (ret);
return GNUNET_OK;
* @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)
+GNUNET_POSTGRES_delete_by_rowid (PGconn * dbh,
+ const char *stmt,
+ uint32_t rowid)
{
uint32_t brow = htonl (rowid);
const char *paramValues[] = { (const char *) &brow };
PGresult *ret;
ret =
- PQexecPrepared (dbh, stmt, 1, paramValues, paramLengths, paramFormats, 1);
+ PQexecPrepared (dbh, stmt, 1,
+ paramValues,
+ paramLengths,
+ paramFormats,
+ 1);
if (GNUNET_OK !=
- GNUNET_POSTGRES_check_result_ (dbh, ret, PGRES_COMMAND_OK,
- "PQexecPrepared", "delrow", __FILE__,
+ GNUNET_POSTGRES_check_result_ (dbh, ret,
+ PGRES_COMMAND_OK,
+ "PQexecPrepared",
+ "delrow",
+ __FILE__,
__LINE__))
{
return GNUNET_SYSERR;