diff --git a/src/db_accessors.h b/src/db_accessors.h index a3f601b..4091fda 100644 --- a/src/db_accessors.h +++ b/src/db_accessors.h @@ -180,45 +180,13 @@ public: }; class sql_insert_name { - ro::sql csql_begin; ro::sql csql_into_names; - ro::sql csql_namekey_into_keys; - ro::sql csql_commit; - ro::sql csql_rollback; public: sql_insert_name(ISqlite3* p) : - csql_begin(p, R"|(BEGIN IMMEDIATE;)|"), - csql_into_names(p, R"|(INSERT OR FAIL INTO "Names" VALUES(NULL, ?1);)|"), - csql_namekey_into_keys(p, R"|(INSERT OR FAIL INTO "Keys" VALUES(NULL, ?1, last_insert_rowid(), 1);)|"), - /* NULL triggers special nonstandard Sqlite behavior to autogenerate a unique ROWID - Because we explicitly make the ROWID a named field in the table to avoid too much - non standard SQlite behavior, we must explicitly provide a placeholder in the INSERT - statement. So at least we only get special SQlite3 behavior when we deliberately - invoke it. */ - csql_commit(p, R"|(COMMIT;)|"), - csql_rollback(p, R"|(ROLLBACK;)|") - {} + csql_into_names(p, R"|(INSERT OR FAIL INTO "UserZookoIDs" VALUES(?1, ?2);)|"){} sql_insert_name(const std::unique_ptr& p) : sql_insert_name(p.get()) {} void operator()(const char* psz, const ristretto255::point& pt) { - csql_begin.do_one(); - try { - csql_into_names.do_one(psz); - csql_namekey_into_keys.do_one(pt); - } - catch (const MyException& e) { - csql_rollback.do_one(); - if (e.what_num() == 19) { - throw MyException("Name already in database"); - } - else { - throw; - } - } - catch (const std::exception &) { - csql_rollback.do_one(); - throw; - } - csql_commit.do_one(); + csql_into_names.do_one(psz,pt); } }; @@ -234,7 +202,5 @@ public: } }; - - constexpr auto WALLET_FILE_IDENTIFIER (0x56d34bc5a655dd1fi64); constexpr auto WALLET_FILE_SCHEMA_VERSION_0_0(1); diff --git a/src/display_wallet.cpp b/src/display_wallet.cpp index 954c880..0a3ee71 100644 --- a/src/display_wallet.cpp +++ b/src/display_wallet.cpp @@ -94,12 +94,13 @@ void display_wallet::OnClose(wxCloseEvent& event) { void display_wallet::refresh_from_database() { auto sizer = this->GetSizer(); + auto dirty_area = sizer->ComputeFittingClientSize(singletonFrame); auto m_lsizer = sizer->GetItem((size_t)0)->GetSizer(); assert(m_lsizer); auto m_rsizer = sizer->GetItem(1)->GetSizer(); assert(m_rsizer); - m_lsizer->Clear(); - m_rsizer->Clear(); + m_lsizer->Clear(true); + m_rsizer->Clear(true); try { m_read_names_and_keys->reset(); while (m_read_names_and_keys->step() == Icompiled_sql::ROW) { @@ -111,7 +112,7 @@ void display_wallet::refresh_from_database() { this, wxID_ANY, name, - wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT | wxST_ELLIPSIZE_END + wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT | wxEXPAND| wxFIXED_MINSIZE| wxST_ELLIPSIZE_END ), 10, wxALL, // and make border all around @@ -121,7 +122,7 @@ void display_wallet::refresh_from_database() { this, wxID_ANY, "#" + base58(pubkey).operator std::string(), - wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT | wxST_ELLIPSIZE_END + wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT | wxEXPAND | wxFIXED_MINSIZE | wxST_ELLIPSIZE_END ), 10, wxALL, // and make border all around @@ -141,12 +142,11 @@ void display_wallet::refresh_from_database() { throw MyException(sz_unknown_error, __LINE__, __func__, SrcFilename); } auto desired_size = sizer->ComputeFittingClientSize(singletonFrame); - singletonFrame->SetMinClientSize(desired_size); + dirty_area.IncTo(desired_size); + //singletonFrame->SetMinClientSize(desired_size); auto clientSize = singletonFrame->GetClientSize(); desired_size.IncTo(clientSize); if (desired_size.GetHeight() > clientSize.GetHeight() || desired_size.GetWidth() > clientSize.GetWidth() )singletonFrame->SetClientSize(desired_size); - - } diff --git a/src/frame.cpp b/src/frame.cpp index ab63b07..4ae63cf 100644 --- a/src/frame.cpp +++ b/src/frame.cpp @@ -391,11 +391,11 @@ COMMIT; BEGIN IMMEDIATE TRANSACTION; CREATE TRIGGER InsertUserZookoID INSTEAD OF INSERT ON UserZookoIDs FOR EACH ROW BEGIN - INSERT OR FAIL INTO "Names" VALUES( + INSERT OR ROLLBACK INTO "Names" VALUES( NULL, NEW."name" ); - INSERT OR FAIL INTO "Keys" VALUES( + INSERT OR ROLLBACK INTO "Keys" VALUES( NULL, NEW."pubkey", last_insert_rowid(),