diff options
Diffstat (limited to 'src/datastore/plugin_datastore_postgres.c')
-rw-r--r-- | src/datastore/plugin_datastore_postgres.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index 994118bfa..7b04cc68a 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c | |||
@@ -76,6 +76,11 @@ init_connection (struct Plugin *plugin) | |||
76 | if (NULL == plugin->dbh) | 76 | if (NULL == plugin->dbh) |
77 | return GNUNET_SYSERR; | 77 | return GNUNET_SYSERR; |
78 | 78 | ||
79 | /* FIXME: PostgreSQL does not have unsigned integers! This is ok for the type column because | ||
80 | * we only test equality on it and can cast it to/from uint32_t. For repl, prio, and anonLevel | ||
81 | * we do math or inequality tests, so we can't handle the entire range of uint32_t. | ||
82 | * This will also cause problems for expiration times after 294247-01-10-04:00:54 UTC. | ||
83 | */ | ||
79 | ret = | 84 | ret = |
80 | PQexec (plugin->dbh, | 85 | PQexec (plugin->dbh, |
81 | "CREATE TABLE IF NOT EXISTS gn090 (" | 86 | "CREATE TABLE IF NOT EXISTS gn090 (" |
@@ -869,9 +874,7 @@ postgres_plugin_get_expiration (void *cls, | |||
869 | * @param cls our `struct Plugin *` | 874 | * @param cls our `struct Plugin *` |
870 | * @param uid unique identifier of the datum | 875 | * @param uid unique identifier of the datum |
871 | * @param delta by how much should the priority | 876 | * @param delta by how much should the priority |
872 | * change? If priority + delta < 0 the | 877 | * change? |
873 | * priority should be set to 0 (never go | ||
874 | * negative). | ||
875 | * @param expire new expiration time should be the | 878 | * @param expire new expiration time should be the |
876 | * MAX of any existing expiration time and | 879 | * MAX of any existing expiration time and |
877 | * this value | 880 | * this value |
@@ -881,16 +884,15 @@ postgres_plugin_get_expiration (void *cls, | |||
881 | static void | 884 | static void |
882 | postgres_plugin_update (void *cls, | 885 | postgres_plugin_update (void *cls, |
883 | uint64_t uid, | 886 | uint64_t uid, |
884 | int delta, | 887 | uint32_t delta, |
885 | struct GNUNET_TIME_Absolute expire, | 888 | struct GNUNET_TIME_Absolute expire, |
886 | PluginUpdateCont cont, | 889 | PluginUpdateCont cont, |
887 | void *cont_cls) | 890 | void *cont_cls) |
888 | { | 891 | { |
889 | struct Plugin *plugin = cls; | 892 | struct Plugin *plugin = cls; |
890 | uint32_t idelta = delta; | ||
891 | uint32_t oid = (uint32_t) uid; | 893 | uint32_t oid = (uint32_t) uid; |
892 | struct GNUNET_PQ_QueryParam params[] = { | 894 | struct GNUNET_PQ_QueryParam params[] = { |
893 | GNUNET_PQ_query_param_uint32 (&idelta), | 895 | GNUNET_PQ_query_param_uint32 (&delta), |
894 | GNUNET_PQ_query_param_absolute_time (&expire), | 896 | GNUNET_PQ_query_param_absolute_time (&expire), |
895 | GNUNET_PQ_query_param_uint32 (&oid), | 897 | GNUNET_PQ_query_param_uint32 (&oid), |
896 | GNUNET_PQ_query_param_end | 898 | GNUNET_PQ_query_param_end |