#
# patch "ChangeLog"
# from [e25a4f6abb58b8dde374a5de26593236d367f3ed]
# to [d5da81ada8f1e7d829229752a9c2bf56763042cc]
#
# patch "database.cc"
# from [75ebed650a1c9e414cd83c07ec07b4e2ad712805]
# to [f2eafea294e650896563c5ca4542807a22d6099a]
#
# patch "schema_migration.cc"
# from [f3ff31fcbb6673a7a7847cd669e33eee20d32eae]
# to [b82d2a90393e271ef19935cfc41e28326f5e39a9]
#
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,16 @@
+2005-05-23 Derek Scherger
+
+ * database.cc (sqlite3_exec_printf, sqlite3_exec_vprintf): remove
+ (dump_table_cb): remove use of printf exec
+ (assert_sqlite3_ok): tweak error message format
+ * database_migration.cc (calculate_schema_id):
+ (move_table):
+ (migrate_client_merge_url_and_group):
+ (migrate_client_add_hashes_and_merkle_trees):
+ (migrate_client_to_revisions):
+ (migrate_client_to_epochs):
+ (migrate_client_to_vars): remove use of printf exec's
+
2005-04-27 Matt Johnston
* vocab.cc (verify(file_path)): don't find() twice.
--- database.cc
+++ database.cc
@@ -56,43 +56,10 @@
extern "C" {
// some wrappers to ease migration
- int sqlite3_exec_printf(sqlite3*,const char *sqlFormat,sqlite3_callback,
- void *,char **errmsg,...);
- int sqlite3_exec_vprintf(sqlite3*,const char *sqlFormat,sqlite3_callback,
- void *,char **errmsg,va_list ap);
const char *sqlite3_value_text_s(sqlite3_value *v);
const char *sqlite3_column_text_s(sqlite3_stmt*, int iCol);
}
-int sqlite3_exec_printf(sqlite3 * db,
- char const * sqlFormat,
- sqlite3_callback cb,
- void * user_data,
- char ** errmsg,
- ...)
-{
- va_list ap;
- va_start(ap, errmsg);
- int result = sqlite3_exec_vprintf(db, sqlFormat, cb,
- user_data, errmsg, ap);
- va_end(ap);
- return result;
-}
-
-int sqlite3_exec_vprintf(sqlite3 * db,
- char const * sqlFormat,
- sqlite3_callback cb,
- void * user_data,
- char ** errmsg,
- va_list ap)
-{
- char * formatted = sqlite3_vmprintf(sqlFormat, ap);
- int result = sqlite3_exec(db, formatted, cb,
- user_data, errmsg);
- sqlite3_free(formatted);
- return result;
-}
-
database::database(fs::path const & fn) :
filename(fn),
// nb. update this if you change the schema. unfortunately we are not
@@ -200,7 +167,7 @@
const char * errmsg = sqlite3_errmsg(s);
ostringstream oss;
- oss << "sqlite errcode=" << errcode << " " << errmsg;
+ oss << "sqlite error [" << errcode << "]: " << errmsg;
throw oops(oss.str());
}
@@ -316,8 +283,9 @@
{
*(dump->out) << vals[2] << ";\n";
dump->table_name = string(vals[0]);
- sqlite3_exec_printf(dump->sql, "SELECT * FROM '%q'",
- dump_row_cb, data, NULL, vals[0]);
+ string query = "SELECT * FROM " + string(vals[0]);
+ int result = sqlite3_exec(dump->sql, query.c_str(), dump_row_cb, data, NULL);
+
}
return 0;
}
--- schema_migration.cc
+++ schema_migration.cc
@@ -37,9 +37,6 @@
typedef boost::tokenizer > tokenizer;
extern "C" {
-// some wrappers to ease migration
- int sqlite3_exec_printf(sqlite3*,const char *sqlFormat,sqlite3_callback,
- void *,char **errmsg,...);
const char *sqlite3_value_text_s(sqlite3_value *v);
}
@@ -155,11 +152,12 @@
{
id.clear();
string tmp, tmp2;
- int res = sqlite3_exec_printf(sql,
- "SELECT sql FROM sqlite_master "
- "WHERE type = 'table' "
- "ORDER BY name",
- &append_sql_stmt, &tmp, NULL);
+
+ int res = sqlite3_exec(sql,
+ "SELECT sql FROM sqlite_master "
+ "WHERE type = 'table' "
+ "ORDER BY name",
+ &append_sql_stmt, &tmp, NULL);
if (res != SQLITE_OK)
{
sqlite3_exec(sql, "ROLLBACK", NULL, NULL, NULL);
@@ -260,21 +258,28 @@
char const * dstname,
char const * dstschema)
{
- int res =
- sqlite3_exec_printf(sql, "CREATE TABLE %s %s", NULL, NULL, errmsg,
- dstname, dstschema);
+ string create = "CREATE TABLE ";
+ create += dstname;
+ create += " ";
+ create += dstschema;
+
+ int res = sqlite3_exec(sql, create.c_str(), NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res =
- sqlite3_exec_printf(sql, "INSERT INTO %s SELECT * FROM %s",
- NULL, NULL, errmsg, dstname, srcname);
+ string insert = "INSERT INTO ";
+ insert += dstname;
+ insert += " SELECT * FROM ";
+ insert += srcname;
+
+ res = sqlite3_exec(sql, insert.c_str(), NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
-
- res =
- sqlite3_exec_printf(sql, "DROP TABLE %s",
- NULL, NULL, errmsg, srcname);
+
+ string drop = "DROP TABLE ";
+ drop += srcname;
+
+ res = sqlite3_exec(sql, drop.c_str(), NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
@@ -298,23 +303,23 @@
")"))
return false;
- int res = sqlite3_exec_printf(sql, "CREATE TABLE posting_queue "
- "("
- "url not null, -- URL we are going to send this to\n"
- "content not null -- the packets we're going to send\n"
- ")", NULL, NULL, errmsg);
+ int res = sqlite3_exec(sql, "CREATE TABLE posting_queue "
+ "("
+ "url not null, -- URL we are going to send this to\n"
+ "content not null -- the packets we're going to send\n"
+ ")", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "INSERT INTO posting_queue "
- "SELECT "
- "(url || '/' || groupname), "
- "content "
- "FROM tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "INSERT INTO posting_queue "
+ "SELECT "
+ "(url || '/' || groupname), "
+ "content "
+ "FROM tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
@@ -330,23 +335,23 @@
")"))
return false;
- res = sqlite3_exec_printf(sql, "CREATE TABLE incoming_queue "
- "("
- "url not null, -- URL we got this bundle from\n"
- "content not null -- the packets we're going to read\n"
- ")", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "CREATE TABLE incoming_queue "
+ "("
+ "url not null, -- URL we got this bundle from\n"
+ "content not null -- the packets we're going to read\n"
+ ")", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "INSERT INTO incoming_queue "
- "SELECT "
- "(url || '/' || groupname), "
- "content "
- "FROM tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "INSERT INTO incoming_queue "
+ "SELECT "
+ "(url || '/' || groupname), "
+ "content "
+ "FROM tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
@@ -365,25 +370,25 @@
))
return false;
- res = sqlite3_exec_printf(sql, "CREATE TABLE sequence_numbers "
- "("
- "url primary key, -- URL to read from\n"
- "major not null, -- 0 in news servers, may be higher in depots\n"
- "minor not null -- last article / packet sequence number we got\n"
- ")", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "CREATE TABLE sequence_numbers "
+ "("
+ "url primary key, -- URL to read from\n"
+ "major not null, -- 0 in news servers, may be higher in depots\n"
+ "minor not null -- last article / packet sequence number we got\n"
+ ")", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "INSERT INTO sequence_numbers "
- "SELECT "
- "(url || '/' || groupname), "
- "major, "
- "minor "
- "FROM tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "INSERT INTO sequence_numbers "
+ "SELECT "
+ "(url || '/' || groupname), "
+ "major, "
+ "minor "
+ "FROM tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
@@ -401,24 +406,24 @@
))
return false;
- res = sqlite3_exec_printf(sql, "CREATE TABLE netserver_manifests "
- "("
- "url not null, -- url of some server\n"
- "manifest not null, -- manifest which exists on url\n"
- "unique(url, manifest)"
- ")", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "CREATE TABLE netserver_manifests "
+ "("
+ "url not null, -- url of some server\n"
+ "manifest not null, -- manifest which exists on url\n"
+ "unique(url, manifest)"
+ ")", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "INSERT INTO netserver_manifests "
- "SELECT "
- "(url || '/' || groupname), "
- "manifest "
- "FROM tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "INSERT INTO netserver_manifests "
+ "SELECT "
+ "(url || '/' || groupname), "
+ "manifest "
+ "FROM tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
@@ -444,28 +449,28 @@
")"))
return false;
- int res = sqlite3_exec_printf(sql, "CREATE TABLE manifest_certs\n"
- "(\n"
- "hash not null unique, -- hash of remaining fields separated by \":\"\n"
- "id not null, -- joins with manifests.id or manifest_deltas.id\n"
- "name not null, -- opaque string chosen by user\n"
- "value not null, -- opaque blob\n"
- "keypair not null, -- joins with public_keys.id\n"
- "signature not null, -- RSA/SHA1 signature of \"address@hidden:val]\"\n"
- "unique(name, id, value, keypair, signature)\n"
- ")", NULL, NULL, errmsg);
+ int res = sqlite3_exec(sql, "CREATE TABLE manifest_certs\n"
+ "(\n"
+ "hash not null unique, -- hash of remaining fields separated by \":\"\n"
+ "id not null, -- joins with manifests.id or manifest_deltas.id\n"
+ "name not null, -- opaque string chosen by user\n"
+ "value not null, -- opaque blob\n"
+ "keypair not null, -- joins with public_keys.id\n"
+ "signature not null, -- RSA/SHA1 signature of \"address@hidden:val]\"\n"
+ "unique(name, id, value, keypair, signature)\n"
+ ")", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "INSERT INTO manifest_certs "
- "SELECT "
- "sha1(':', id, name, value, keypair, signature), "
- "id, name, value, keypair, signature "
- "FROM tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "INSERT INTO manifest_certs "
+ "SELECT "
+ "sha1(':', id, name, value, keypair, signature), "
+ "id, name, value, keypair, signature "
+ "FROM tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
@@ -483,28 +488,28 @@
")"))
return false;
- res = sqlite3_exec_printf(sql, "CREATE TABLE file_certs\n"
- "(\n"
- "hash not null unique, -- hash of remaining fields separated by \":\"\n"
- "id not null, -- joins with files.id or file_deltas.id\n"
- "name not null, -- opaque string chosen by user\n"
- "value not null, -- opaque blob\n"
- "keypair not null, -- joins with public_keys.id\n"
- "signature not null, -- RSA/SHA1 signature of \"address@hidden:val]\"\n"
- "unique(name, id, value, keypair, signature)\n"
- ")", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "CREATE TABLE file_certs\n"
+ "(\n"
+ "hash not null unique, -- hash of remaining fields separated by \":\"\n"
+ "id not null, -- joins with files.id or file_deltas.id\n"
+ "name not null, -- opaque string chosen by user\n"
+ "value not null, -- opaque blob\n"
+ "keypair not null, -- joins with public_keys.id\n"
+ "signature not null, -- RSA/SHA1 signature of \"address@hidden:val]\"\n"
+ "unique(name, id, value, keypair, signature)\n"
+ ")", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "INSERT INTO file_certs "
- "SELECT "
- "sha1(':', id, name, value, keypair, signature), "
- "id, name, value, keypair, signature "
- "FROM tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "INSERT INTO file_certs "
+ "SELECT "
+ "sha1(':', id, name, value, keypair, signature), "
+ "id, name, value, keypair, signature "
+ "FROM tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
@@ -518,24 +523,24 @@
")"))
return false;
- res = sqlite3_exec_printf(sql, "CREATE TABLE public_keys\n"
- "(\n"
- "hash not null unique, -- hash of remaining fields separated by \":\"\n"
- "id primary key, -- key identifier chosen by user\n"
- "keydata not null -- RSA public params\n"
- ")", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "CREATE TABLE public_keys\n"
+ "(\n"
+ "hash not null unique, -- hash of remaining fields separated by \":\"\n"
+ "id primary key, -- key identifier chosen by user\n"
+ "keydata not null -- RSA public params\n"
+ ")", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "INSERT INTO public_keys "
- "SELECT "
- "sha1(':', id, keydata), "
- "id, keydata "
- "FROM tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "INSERT INTO public_keys "
+ "SELECT "
+ "sha1(':', id, keydata), "
+ "id, keydata "
+ "FROM tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
@@ -549,39 +554,39 @@
")"))
return false;
- res = sqlite3_exec_printf(sql, "CREATE TABLE private_keys\n"
- "(\n"
- "hash not null unique, -- hash of remaining fields separated by \":\"\n"
- "id primary key, -- as in public_keys (same identifiers, in fact)\n"
- "keydata not null -- encrypted RSA private params\n"
- ")", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "CREATE TABLE private_keys\n"
+ "(\n"
+ "hash not null unique, -- hash of remaining fields separated by \":\"\n"
+ "id primary key, -- as in public_keys (same identifiers, in fact)\n"
+ "keydata not null -- encrypted RSA private params\n"
+ ")", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "INSERT INTO private_keys "
- "SELECT "
- "sha1(':', id, keydata), "
- "id, keydata "
- "FROM tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "INSERT INTO private_keys "
+ "SELECT "
+ "sha1(':', id, keydata), "
+ "id, keydata "
+ "FROM tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE tmp", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
// add the merkle tree stuff
- res = sqlite3_exec_printf(sql,
- "CREATE TABLE merkle_nodes\n"
- "(\n"
- "type not null, -- \"key\", \"mcert\", \"fcert\", \"manifest\"\n"
- "collection not null, -- name chosen by user\n"
- "level not null, -- tree level this prefix encodes\n"
- "prefix not null, -- label identifying node in tree\n"
- "body not null, -- binary, base64'ed node contents\n"
- "unique(type, collection, level, prefix)\n"
- ")", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql,
+ "CREATE TABLE merkle_nodes\n"
+ "(\n"
+ "type not null, -- \"key\", \"mcert\", \"fcert\", \"manifest\"\n"
+ "collection not null, -- name chosen by user\n"
+ "level not null, -- tree level this prefix encodes\n"
+ "prefix not null, -- label identifying node in tree\n"
+ "body not null, -- binary, base64'ed node contents\n"
+ "unique(type, collection, level, prefix)\n"
+ ")", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
@@ -594,74 +599,74 @@
{
int res;
- res = sqlite3_exec_printf(sql, "DROP TABLE schema_version;", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE schema_version;", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE posting_queue;", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE posting_queue;", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE incoming_queue;", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE incoming_queue;", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE sequence_numbers;", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE sequence_numbers;", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE file_certs;", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE file_certs;", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE netserver_manifests;", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE netserver_manifests;", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "DROP TABLE merkle_nodes;", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE merkle_nodes;", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql,
- "CREATE TABLE merkle_nodes\n"
- "(\n"
- "type not null, -- \"key\", \"mcert\", \"fcert\", \"rcert\"\n"
- "collection not null, -- name chosen by user\n"
- "level not null, -- tree level this prefix encodes\n"
- "prefix not null, -- label identifying node in tree\n"
- "body not null, -- binary, base64'ed node contents\n"
- "unique(type, collection, level, prefix)\n"
- ")", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql,
+ "CREATE TABLE merkle_nodes\n"
+ "(\n"
+ "type not null, -- \"key\", \"mcert\", \"fcert\", \"rcert\"\n"
+ "collection not null, -- name chosen by user\n"
+ "level not null, -- tree level this prefix encodes\n"
+ "prefix not null, -- label identifying node in tree\n"
+ "body not null, -- binary, base64'ed node contents\n"
+ "unique(type, collection, level, prefix)\n"
+ ")", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "CREATE TABLE revision_certs\n"
- "(\n"
- "hash not null unique, -- hash of remaining fields separated by \":\"\n"
- "id not null, -- joins with revisions.id\n"
- "name not null, -- opaque string chosen by user\n"
- "value not null, -- opaque blob\n"
- "keypair not null, -- joins with public_keys.id\n"
- "signature not null, -- RSA/SHA1 signature of \"address@hidden:val]\"\n"
- "unique(name, id, value, keypair, signature)\n"
- ")", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "CREATE TABLE revision_certs\n"
+ "(\n"
+ "hash not null unique, -- hash of remaining fields separated by \":\"\n"
+ "id not null, -- joins with revisions.id\n"
+ "name not null, -- opaque string chosen by user\n"
+ "value not null, -- opaque blob\n"
+ "keypair not null, -- joins with public_keys.id\n"
+ "signature not null, -- RSA/SHA1 signature of \"address@hidden:val]\"\n"
+ "unique(name, id, value, keypair, signature)\n"
+ ")", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "CREATE TABLE revisions\n"
- "(\n"
- "id primary key, -- SHA1(text of revision)\n"
- "data not null -- compressed, encoded contents of a revision\n"
- ")", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "CREATE TABLE revisions\n"
+ "(\n"
+ "id primary key, -- SHA1(text of revision)\n"
+ "data not null -- compressed, encoded contents of a revision\n"
+ ")", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql, "CREATE TABLE revision_ancestry\n"
- "(\n"
- "parent not null, -- joins with revisions.id\n"
- "child not null, -- joins with revisions.id\n"
- "unique(parent, child)\n"
- ")", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "CREATE TABLE revision_ancestry\n"
+ "(\n"
+ "parent not null, -- joins with revisions.id\n"
+ "child not null, -- joins with revisions.id\n"
+ "unique(parent, child)\n"
+ ")", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
@@ -675,19 +680,18 @@
{
int res;
- res = sqlite3_exec_printf(sql, "DROP TABLE merkle_nodes;", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql, "DROP TABLE merkle_nodes;", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
- res = sqlite3_exec_printf(sql,
-
- "CREATE TABLE branch_epochs\n"
- "(\n"
- "hash not null unique, -- hash of remaining fields separated by \":\"\n"
- "branch not null unique, -- joins with revision_certs.value\n"
- "epoch not null -- random hex-encoded id\n"
- ");", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql,
+ "CREATE TABLE branch_epochs\n"
+ "(\n"
+ "hash not null unique, -- hash of remaining fields separated by \":\"\n"
+ "branch not null unique, -- joins with revision_certs.value\n"
+ "epoch not null -- random hex-encoded id\n"
+ ");", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;
@@ -700,14 +704,14 @@
{
int res;
- res = sqlite3_exec_printf(sql,
- "CREATE TABLE db_vars\n"
- "(\n"
- "domain not null, -- scope of application of a var\n"
- "name not null, -- var key\n"
- "value not null, -- var value\n"
- "unique(domain, name)\n"
- ");", NULL, NULL, errmsg);
+ res = sqlite3_exec(sql,
+ "CREATE TABLE db_vars\n"
+ "(\n"
+ "domain not null, -- scope of application of a var\n"
+ "name not null, -- var key\n"
+ "value not null, -- var value\n"
+ "unique(domain, name)\n"
+ ");", NULL, NULL, errmsg);
if (res != SQLITE_OK)
return false;