- indent
[oweals/gnunet.git] / src / namestore / plugin_namestore_sqlite.c
index 569f10f5b0276c799f9799fd3c9c6c6b5cf56add..f0deb7fa9c55f82e2574fdf39a5f37a3390861dd 100644 (file)
@@ -213,13 +213,8 @@ database_setup (struct Plugin *plugin)
       return GNUNET_SYSERR;
     }
   }
-#ifdef ENABLE_NLS
-  plugin->fn =
-      GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir), nl_langinfo (CODESET));
-#else
-  plugin->fn = GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir), "UTF-8");       /* good luck */
-#endif
-  GNUNET_free (afsdir);
+  /* afsdir should be UTF-8-encoded. If it isn't, it's a bug */
+  plugin->fn = afsdir;
 
   /* Open database and precompile statements */
   if (sqlite3_open (plugin->fn, &plugin->dbh) != SQLITE_OK)
@@ -287,10 +282,9 @@ database_setup (struct Plugin *plugin)
 
   create_indices (plugin->dbh);
 
-#define ALL "zone_key, record_name, record_count, record_data, block_expiration_time, signature"
   if ((sq_prepare
        (plugin->dbh,
-        "INSERT INTO ns091records (" ALL ", zone_delegation, zone_hash, record_name_hash, rvalue) VALUES "
+        "INSERT INTO ns091records (zone_key, record_name, record_count, record_data, block_expiration_time, signature, zone_delegation, zone_hash, record_name_hash, rvalue) VALUES "
        "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
         &plugin->put_records) != SQLITE_OK) ||
       (sq_prepare
@@ -299,27 +293,27 @@ database_setup (struct Plugin *plugin)
         &plugin->remove_records) != SQLITE_OK) ||
       (sq_prepare
        (plugin->dbh,
-        "SELECT " ALL
+        "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
        " FROM ns091records WHERE zone_hash=? AND record_name_hash=? ORDER BY rvalue LIMIT 1 OFFSET ?",
         &plugin->iterate_records) != SQLITE_OK) ||
       (sq_prepare
        (plugin->dbh,
-        "SELECT " ALL
+        "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" 
        " FROM ns091records WHERE zone_hash=? ORDER BY rvalue  LIMIT 1 OFFSET ?",
         &plugin->iterate_by_zone) != SQLITE_OK) ||
       (sq_prepare
        (plugin->dbh,
-        "SELECT " ALL 
+        "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" 
        " FROM ns091records WHERE record_name_hash=? ORDER BY rvalue LIMIT 1 OFFSET ?",
         &plugin->iterate_by_name) != SQLITE_OK) ||
       (sq_prepare
        (plugin->dbh,
-        "SELECT " ALL
+        "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" 
        " FROM ns091records ORDER BY rvalue LIMIT 1 OFFSET ?",
         &plugin->iterate_all) != SQLITE_OK) ||
       (sq_prepare
        (plugin->dbh,
-        "SELECT " ALL
+        "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
        " FROM ns091records WHERE zone_hash=? AND zone_delegation=?",
         &plugin->zone_to_name) != SQLITE_OK) ||
       (sq_prepare
@@ -330,7 +324,6 @@ database_setup (struct Plugin *plugin)
     LOG_SQLITE (plugin,GNUNET_ERROR_TYPE_ERROR, "precompiling");
     return GNUNET_SYSERR;
   }
-#undef ALL
   return GNUNET_OK;
 }