" value BYTEA NOT NULL DEFAULT '',"
" path BYTEA DEFAULT '')"
"WITH OIDS");
- if ( (ret == NULL) ||
- ((PQresultStatus (ret) != PGRES_COMMAND_OK) &&
+ if ( (ret == NULL) ||
+ ((PQresultStatus (ret) != PGRES_COMMAND_OK) &&
(0 != strcmp ("42P07", /* duplicate table */
PQresultErrorField
(ret,
PG_DIAG_SQLSTATE)))))
{
- (void) GNUNET_POSTGRES_check_result (plugin->dbh, ret,
+ (void) GNUNET_POSTGRES_check_result (plugin->dbh, ret,
PGRES_COMMAND_OK, "CREATE TABLE",
"gn090dc");
PQfinish (plugin->dbh);
struct Plugin *plugin = cls;
PGresult *ret;
uint32_t btype = htonl (type);
- uint64_t bexpi = GNUNET_TIME_absolute_hton (discard_time).abs_value__;
+ uint64_t bexpi = GNUNET_TIME_absolute_hton (discard_time).abs_value_us__;
const char *paramValues[] = {
(const char *) &btype,
PQexecPrepared (plugin->dbh, "put", 5, paramValues, paramLengths,
paramFormats, 1);
if (GNUNET_OK !=
- GNUNET_POSTGRES_check_result (plugin->dbh, ret,
+ GNUNET_POSTGRES_check_result (plugin->dbh, ret,
PGRES_COMMAND_OK, "PQexecPrepared", "put"))
return -1;
PQclear (ret);
if (0 == (cnt = PQntuples (res)))
{
/* no result */
- LOG (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Ending iteration (no more results)\n");
PQclear (res);
return 0;
}
for (i = 0; i < cnt; i++)
{
- expiration_time.abs_value =
+ expiration_time.abs_value_us =
GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, i, 0));
type = ntohl (*(uint32_t *) PQgetvalue (res, i, 1));
size = PQgetlength (res, i, 2);
}
path_len %= sizeof (struct GNUNET_PeerIdentity);
path = (const struct GNUNET_PeerIdentity *) PQgetvalue (res, i, 3);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Found result of size %u bytes and type %u in database\n",
(unsigned int) size, (unsigned int) type);
if (GNUNET_SYSERR ==
path_len,
path))
{
- LOG (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Ending iteration (client error)\n");
PQclear (res);
return cnt;
if (GNUNET_OK !=
GNUNET_POSTGRES_check_result (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "getm"))
{
- LOG (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Ending iteration (postgres error)\n");
return 0;
}
if (0 == PQntuples (res))
{
/* no result */
- LOG (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Ending iteration (no more results)\n");
PQclear (res);
return GNUNET_SYSERR;
struct GNUNET_DATACACHE_PluginFunctions *api;
struct Plugin *plugin;
- plugin = GNUNET_malloc (sizeof (struct Plugin));
+ plugin = GNUNET_new (struct Plugin);
plugin->env = env;
if (GNUNET_OK != init_connection (plugin))
return NULL;
}
- api = GNUNET_malloc (sizeof (struct GNUNET_DATACACHE_PluginFunctions));
+ api = GNUNET_new (struct GNUNET_DATACACHE_PluginFunctions);
api->cls = plugin;
api->get = &postgres_plugin_get;
api->put = &postgres_plugin_put;
api->del = &postgres_plugin_del;
- LOG (GNUNET_ERROR_TYPE_INFO,
+ LOG (GNUNET_ERROR_TYPE_INFO,
_("Postgres datacache running\n"));
return api;
}