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.
|
* Native Postgres database handle.
|
||||||
*/
|
*/
|
||||||
PGconn *dbh;
|
struct GNUNET_PQ_Context *dbh;
|
||||||
|
|
||||||
enum Transactions transaction;
|
enum Transactions transaction;
|
||||||
|
|
||||||
@ -160,22 +160,7 @@ database_setup (struct Plugin *plugin)
|
|||||||
GNUNET_PQ_EXECUTE_STATEMENT_END
|
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 */
|
/* Prepare statements */
|
||||||
{
|
|
||||||
struct GNUNET_PQ_PreparedStatement ps[] = {
|
struct GNUNET_PQ_PreparedStatement ps[] = {
|
||||||
GNUNET_PQ_make_prepare ("transaction_begin",
|
GNUNET_PQ_make_prepare ("transaction_begin",
|
||||||
"BEGIN", 0),
|
"BEGIN", 0),
|
||||||
@ -346,15 +331,14 @@ database_setup (struct Plugin *plugin)
|
|||||||
GNUNET_PQ_PREPARED_STATEMENT_END
|
GNUNET_PQ_PREPARED_STATEMENT_END
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
/* Open database and precompile statements */
|
||||||
GNUNET_PQ_prepare_statements (plugin->dbh,
|
plugin->dbh = GNUNET_PQ_connect_with_cfg (plugin->cfg,
|
||||||
ps))
|
"psycstore-postgres",
|
||||||
{
|
es,
|
||||||
PQfinish (plugin->dbh);
|
ps);
|
||||||
plugin->dbh = NULL;
|
|
||||||
|
if (NULL == plugin->dbh)
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
@ -368,7 +352,7 @@ database_setup (struct Plugin *plugin)
|
|||||||
static void
|
static void
|
||||||
database_shutdown (struct Plugin *plugin)
|
database_shutdown (struct Plugin *plugin)
|
||||||
{
|
{
|
||||||
PQfinish (plugin->dbh);
|
GNUNET_PQ_disconnect (plugin->dbh);
|
||||||
plugin->dbh = NULL;
|
plugin->dbh = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user