[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r38141 - gnunet/src/psycstore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r38141 - gnunet/src/psycstore |
Date: |
Wed, 12 Oct 2016 21:31:44 +0200 |
Author: tg
Date: 2016-10-12 21:31:44 +0200 (Wed, 12 Oct 2016)
New Revision: 38141
Modified:
gnunet/src/psycstore/plugin_psycstore_mysql.c
gnunet/src/psycstore/plugin_psycstore_postgres.c
Log:
psycstore: postgres fixes
Modified: gnunet/src/psycstore/plugin_psycstore_mysql.c
===================================================================
--- gnunet/src/psycstore/plugin_psycstore_mysql.c 2016-10-12 19:11:03 UTC
(rev 38140)
+++ gnunet/src/psycstore/plugin_psycstore_mysql.c 2016-10-12 19:31:44 UTC
(rev 38141)
@@ -1590,8 +1590,8 @@
const char *name, const void *value, size_t value_size)
{
struct Plugin *plugin = cls;
- return state_assign (cls, plugin->insert_state_sync, channel_key,
- name, value, value_size);
+ return state_assign (cls, plugin->insert_state_sync,
+ channel_key, name, value, value_size);
}
Modified: gnunet/src/psycstore/plugin_psycstore_postgres.c
===================================================================
--- gnunet/src/psycstore/plugin_psycstore_postgres.c 2016-10-12 19:11:03 UTC
(rev 38140)
+++ gnunet/src/psycstore/plugin_psycstore_postgres.c 2016-10-12 19:31:44 UTC
(rev 38141)
@@ -101,8 +101,8 @@
"CREATE TABLE IF NOT EXISTS channels (\n"
" id SERIAL,\n"
" pub_key BYTEA,\n"
- " max_state_message_id INT,\n"
- " state_hash_message_id INT,\n"
+ " max_state_message_id BIGINT,\n"
+ " state_hash_message_id BIGINT,\n"
" PRIMARY KEY(id)\n"
")" "WITH OIDS")) ||
@@ -141,9 +141,9 @@
(GNUNET_OK !=
GNUNET_POSTGRES_exec(plugin->dbh,
"CREATE TABLE IF NOT EXISTS membership (\n"
- " channel_id INT NOT NULL REFERENCES
channels(id),\n"
- " slave_id INT NOT NULL REFERENCES
slaves(id),\n"
- " did_join INT NOT NULL,\n"
+ " channel_id BIGINT NOT NULL REFERENCES
channels(id),\n"
+ " slave_id BIGINT NOT NULL REFERENCES
slaves(id),\n"
+ " did_join BIGINT NOT NULL,\n"
" announced_at BIGINT NOT NULL,\n"
" effective_since BIGINT NOT NULL,\n"
" group_generation BIGINT NOT NULL\n"
@@ -158,7 +158,7 @@
(GNUNET_OK !=
GNUNET_POSTGRES_exec(plugin->dbh,
"CREATE TABLE IF NOT EXISTS messages (\n"
- " channel_id INT NOT NULL REFERENCES
channels(id),\n"
+ " channel_id BIGINT NOT NULL REFERENCES
channels(id),\n"
" hop_counter BIGINT NOT NULL,\n"
" signature BYTEA,\n"
" purpose BYTEA,\n"
@@ -176,7 +176,7 @@
(GNUNET_OK !=
GNUNET_POSTGRES_exec(plugin->dbh,
"CREATE TABLE IF NOT EXISTS state (\n"
- " channel_id INT NOT NULL REFERENCES
channels(id),\n"
+ " channel_id BIGINT NOT NULL REFERENCES
channels(id),\n"
" name TEXT NOT NULL,\n"
" value_current BYTEA,\n"
" value_signed BYTEA\n"
@@ -191,7 +191,7 @@
(GNUNET_OK !=
GNUNET_POSTGRES_exec(plugin->dbh,
"CREATE TABLE IF NOT EXISTS state_sync (\n"
- " channel_id INT NOT NULL REFERENCES
channels(id),\n"
+ " channel_id BIGINT NOT NULL REFERENCES
channels(id),\n"
" name TEXT NOT NULL,\n"
" value BYTEA,\n"
" PRIMARY KEY (channel_id)\n"
@@ -724,11 +724,12 @@
GNUNET_PQ_result_spec_end
};
- switch(GNUNET_PQ_extract_result (res, results_select, 0))
+ switch (GNUNET_PQ_extract_result (res, results_select, 0))
{
case GNUNET_OK:
ret = GNUNET_YES;
break;
+
default:
ret = GNUNET_NO;
break;
@@ -1255,7 +1256,7 @@
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (channel_key),
GNUNET_PQ_query_param_string (name),
- GNUNET_PQ_query_param_auto_from_type (value),
+ GNUNET_PQ_query_param_fixed_size (value, value_size),
GNUNET_PQ_query_param_end
};
@@ -1328,6 +1329,7 @@
case GNUNET_NO: // no state yet
ret = GNUNET_OK;
break;
+
default:
return ret;
}
@@ -1366,8 +1368,8 @@
switch (op)
{
case GNUNET_PSYC_OP_ASSIGN:
- return state_assign (plugin, "insert_state_current", channel_key,
- name, value, value_size);
+ return state_assign (plugin, "insert_state_current",
+ channel_key, name, value, value_size);
default: /** @todo implement more state operations */
GNUNET_break (0);
@@ -1422,8 +1424,8 @@
const char *name, const void *value, size_t value_size)
{
struct Plugin *plugin = cls;
- return state_assign (plugin, "insert_state_sync", channel_key,
- name, value, value_size);
+ return state_assign (plugin, "insert_state_sync",
+ channel_key, name, value, value_size);
}
@@ -1599,17 +1601,17 @@
GNUNET_PQ_result_spec_end
};
+ res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select);
+ if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh,
+ res,
+ PGRES_TUPLES_OK,
+ "PQexecPrepared", stmt))
+ {
+ return GNUNET_SYSERR;
+ }
+
do
{
- res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select);
- if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh,
- res,
- PGRES_TUPLES_OK,
- "PQexecPrepared", stmt))
- {
- break;
- }
-
if (PQntuples (res) == 0)
{
PQclear (res);
@@ -1669,17 +1671,17 @@
GNUNET_PQ_result_spec_end
};
+ res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select);
+ if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh,
+ res,
+ PGRES_TUPLES_OK,
+ "PQexecPrepared", stmt))
+ {
+ return GNUNET_SYSERR;
+ }
+
do
{
- res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select);
- if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh,
- res,
- PGRES_TUPLES_OK,
- "PQexecPrepared", stmt))
- {
- break;
- }
-
if (PQntuples (res) == 0)
{
PQclear (res);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r38141 - gnunet/src/psycstore,
gnunet <=