avoiding the implicit creation of the oid primary key to avoid sqlite backwards bug compatible quirks
This commit is contained in:
parent
c344a597a2
commit
529cc368c9
2
mpir
2
mpir
@ -1 +1 @@
|
||||
Subproject commit bc42eee0b5d04b508b196231165a567db9f8f4b6
|
||||
Subproject commit dda9307f16da43d1da8f003734f465ae9cf7fa9e
|
@ -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;)|");
|
||||
|
Loading…
Reference in New Issue
Block a user