diff options
author | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2011-09-14 12:29:57 +0000 |
---|---|---|
committer | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2011-09-14 12:29:57 +0000 |
commit | 8cbfc4f249504672cf783afe1e18d244c79a0ab2 (patch) | |
tree | 795cc12dbedb80ea13df25a755f4c3ce02212ddb /src/datastore/plugin_datastore_sqlite.c | |
parent | 3958c23082be541486afdc3d9757d565405c5581 (diff) |
use INDEXED BY only for sqlite >= 3.7
git-svn-id: https://gnunet.org/svn/gnunet@16835 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/datastore/plugin_datastore_sqlite.c')
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index 2620c3682e..9312027071 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c @@ -326,23 +326,41 @@ database_setup (const struct GNUNET_CONFIGURATION_Handle *cfg, (sq_prepare (plugin->dbh, "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ " - "FROM gn090 INDEXED BY idx_repl_rvalue WHERE repl=?2 AND " + "FROM gn090 " +#if SQLITE_VERSION_NUMBER >= 3007000 + "INDEXED BY idx_repl_rvalue " +#endif + "WHERE repl=?2 AND " " (rvalue>=?1 OR " - " NOT EXISTS (SELECT 1 FROM gn090 INDEXED BY idx_repl_rvalue WHERE repl=?2 AND rvalue>=?1 LIMIT 1) ) " + " NOT EXISTS (SELECT 1 FROM gn090 " +#if SQLITE_VERSION_NUMBER >= 3007000 + "INDEXED BY idx_repl_rvalue " +#endif + "WHERE repl=?2 AND rvalue>=?1 LIMIT 1) ) " "ORDER BY rvalue ASC LIMIT 1", &plugin->selRepl) != SQLITE_OK) || (sq_prepare - (plugin->dbh, "SELECT MAX(repl) FROM gn090 INDEXED BY idx_repl_rvalue", + (plugin->dbh, "SELECT MAX(repl) FROM gn090" +#if SQLITE_VERSION_NUMBER >= 3007000 + " INDEXED BY idx_repl_rvalue" +#endif + "", &plugin->maxRepl) != SQLITE_OK) || (sq_prepare (plugin->dbh, "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ " - "FROM gn090 INDEXED BY idx_expire " + "FROM gn090 " +#if SQLITE_VERSION_NUMBER >= 3007000 + "INDEXED BY idx_expire " +#endif "WHERE NOT EXISTS (SELECT 1 FROM gn090 WHERE expire < ?1 LIMIT 1) OR (expire < ?1) " "ORDER BY expire ASC LIMIT 1", &plugin->selExpi) != SQLITE_OK) || (sq_prepare (plugin->dbh, "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ " - "FROM gn090 INDEXED BY idx_anon_type_hash " + "FROM gn090 " +#if SQLITE_VERSION_NUMBER >= 3007000 + "INDEXED BY idx_anon_type_hash " +#endif "WHERE (anonLevel = 0 AND type=?1) " "ORDER BY hash DESC LIMIT 1 OFFSET ?2", &plugin->selZeroAnon) != SQLITE_OK) || |