diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-07-16 20:50:15 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-07-16 20:50:15 +0000 |
commit | a2f39db8185a9906c3eb0e0d5784cf4f505bee88 (patch) | |
tree | 15312423c31861193ff72ab46e6bc1dfc3ad59e8 /src/datacache | |
parent | 7f67be6f1f8390bbdcd69a8dfd9bf8178452af6b (diff) | |
download | gnunet-a2f39db8185a9906c3eb0e0d5784cf4f505bee88.tar.gz gnunet-a2f39db8185a9906c3eb0e0d5784cf4f505bee88.zip |
checkret
Diffstat (limited to 'src/datacache')
-rw-r--r-- | src/datacache/plugin_datacache_sqlite.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c index eb24f5423..fd451e2b4 100644 --- a/src/datacache/plugin_datacache_sqlite.c +++ b/src/datacache/plugin_datacache_sqlite.c | |||
@@ -203,9 +203,15 @@ sqlite_plugin_get (void *cls, | |||
203 | sqlite3_errmsg (plugin->dbh)); | 203 | sqlite3_errmsg (plugin->dbh)); |
204 | return 0; | 204 | return 0; |
205 | } | 205 | } |
206 | if (GNUNET_OK != | 206 | ntime = (int64_t) now.abs_value; |
207 | sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode), | 207 | GNUNET_assert (ntime >= 0); |
208 | SQLITE_TRANSIENT)) | 208 | if ( (SQLITE_OK != |
209 | sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode), | ||
210 | SQLITE_TRANSIENT)) || | ||
211 | (SQLITE_OK != | ||
212 | sqlite3_bind_int (stmt, 2, type)) || | ||
213 | (SQLITE_OK != | ||
214 | sqlite3_bind_int64 (stmt, 3, now.abs_value)) ) | ||
209 | { | 215 | { |
210 | LOG_SQLITE (plugin->dbh, | 216 | LOG_SQLITE (plugin->dbh, |
211 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 217 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
@@ -213,10 +219,7 @@ sqlite_plugin_get (void *cls, | |||
213 | sqlite3_finalize (stmt); | 219 | sqlite3_finalize (stmt); |
214 | return 0; | 220 | return 0; |
215 | } | 221 | } |
216 | sqlite3_bind_int (stmt, 2, type); | 222 | |
217 | ntime = (int64_t) now.abs_value; | ||
218 | GNUNET_assert (ntime >= 0); | ||
219 | sqlite3_bind_int64 (stmt, 3, now.abs_value); | ||
220 | if (SQLITE_ROW != sqlite3_step (stmt)) | 223 | if (SQLITE_ROW != sqlite3_step (stmt)) |
221 | { | 224 | { |
222 | LOG_SQLITE (plugin->dbh, | 225 | LOG_SQLITE (plugin->dbh, |
@@ -247,10 +250,20 @@ sqlite_plugin_get (void *cls, | |||
247 | sqlite3_errmsg (plugin->dbh)); | 250 | sqlite3_errmsg (plugin->dbh)); |
248 | return cnt; | 251 | return cnt; |
249 | } | 252 | } |
250 | sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode), | 253 | if ( (SQLITE_OK != |
251 | SQLITE_TRANSIENT); | 254 | sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode), |
252 | sqlite3_bind_int (stmt, 2, type); | 255 | SQLITE_TRANSIENT)) || |
253 | sqlite3_bind_int64 (stmt, 3, now.abs_value); | 256 | (SQLITE_OK != |
257 | sqlite3_bind_int (stmt, 2, type)) || | ||
258 | (SQLITE_OK != | ||
259 | sqlite3_bind_int64 (stmt, 3, now.abs_value)) ) | ||
260 | { | ||
261 | LOG_SQLITE (plugin->dbh, | ||
262 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
263 | "sqlite3_bind_xxx"); | ||
264 | sqlite3_finalize (stmt); | ||
265 | return cnt; | ||
266 | } | ||
254 | if (sqlite3_step (stmt) != SQLITE_ROW) | 267 | if (sqlite3_step (stmt) != SQLITE_ROW) |
255 | break; | 268 | break; |
256 | size = sqlite3_column_bytes (stmt, 0); | 269 | size = sqlite3_column_bytes (stmt, 0); |