diff --git a/mpir b/mpir index bc42eee..dda9307 160000 --- a/mpir +++ b/mpir @@ -1 +1 @@ -Subproject commit bc42eee0b5d04b508b196231165a567db9f8f4b6 +Subproject commit dda9307f16da43d1da8f003734f465ae9cf7fa9e diff --git a/src/frame.cpp b/src/frame.cpp index 7483213..250e2f2 100644 --- a/src/frame.cpp +++ b/src/frame.cpp @@ -242,21 +242,28 @@ void Frame::NewWallet(wxFileName& filename, ristretto255::hash<256>& secret) { // Disk operations to create wallet, which may throw. // This try/catch block exists to catch disk io issues. db.reset(Sqlite3_create(filename.GetFullPath().ToUTF8())); + // To avoid legacy quirks and backward bug compatibility, every sqlite3 table needs an INTEGER PRIMARY KEY or a WITHOUT ROWID. + // if you want a non integer primary key and do not want to use sqlite3's complicated backward bug compatibility special feature, + // instead use a CREATE INDEX rather than making the thing a primary key. db->exec(R"|( PRAGMA journal_mode = WAL; PRAGMA synchronous = 1; BEGIN IMMEDIATE TRANSACTION; CREATE TABLE "Keys"( - "pubkey" BLOB NOT NULL UNIQUE PRIMARY KEY, + "oid" INTEGER PRIMARY KEY, + "pubkey" BLOB NOT NULL UNIQUE, "id" integer NOT NULL, "use" INTEGER NOT NULL); +CREATE UNIQUE INDEX i_pubkey ON Keys (pubkey); + CREATE TABLE "Names"( + "oid" INTEGER PRIMARY KEY, "name" TEXT NOT NULL UNIQUE ); CREATE TABLE "Misc"( - "index" INTEGER NOT NULL UNIQUE PRIMARY KEY, + "index" INTEGER PRIMARY KEY, "m" BLOB ); COMMIT;)|");