psycstore: adapt to changed gnunetpq API
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
5fc42cc72b
commit
be0d5ec3c0
@ -70,7 +70,7 @@ struct Plugin
|
||||
/**
|
||||
* Native Postgres database handle.
|
||||
*/
|
||||
PGconn *dbh;
|
||||
struct GNUNET_PQ_Context *dbh;
|
||||
|
||||
enum Transactions transaction;
|
||||
|
||||
@ -160,22 +160,7 @@ database_setup (struct Plugin *plugin)
|
||||
GNUNET_PQ_EXECUTE_STATEMENT_END
|
||||
};
|
||||
|
||||
/* Open database and precompile statements */
|
||||
plugin->dbh = GNUNET_PQ_connect_with_cfg (plugin->cfg,
|
||||
"psycstore-postgres");
|
||||
if (NULL == plugin->dbh)
|
||||
return GNUNET_SYSERR;
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_PQ_exec_statements (plugin->dbh,
|
||||
es))
|
||||
{
|
||||
PQfinish (plugin->dbh);
|
||||
plugin->dbh = NULL;
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
|
||||
/* Prepare statements */
|
||||
{
|
||||
struct GNUNET_PQ_PreparedStatement ps[] = {
|
||||
GNUNET_PQ_make_prepare ("transaction_begin",
|
||||
"BEGIN", 0),
|
||||
@ -346,15 +331,14 @@ database_setup (struct Plugin *plugin)
|
||||
GNUNET_PQ_PREPARED_STATEMENT_END
|
||||
};
|
||||
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_PQ_prepare_statements (plugin->dbh,
|
||||
ps))
|
||||
{
|
||||
PQfinish (plugin->dbh);
|
||||
plugin->dbh = NULL;
|
||||
/* Open database and precompile statements */
|
||||
plugin->dbh = GNUNET_PQ_connect_with_cfg (plugin->cfg,
|
||||
"psycstore-postgres",
|
||||
es,
|
||||
ps);
|
||||
|
||||
if (NULL == plugin->dbh)
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
}
|
||||
|
||||
return GNUNET_OK;
|
||||
}
|
||||
@ -368,7 +352,7 @@ database_setup (struct Plugin *plugin)
|
||||
static void
|
||||
database_shutdown (struct Plugin *plugin)
|
||||
{
|
||||
PQfinish (plugin->dbh);
|
||||
GNUNET_PQ_disconnect (plugin->dbh);
|
||||
plugin->dbh = NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user