diff options
| author | Bitflash <admin@bitflash.network> | 2026-08-14 15:35:42 -0300 |
|---|---|---|
| committer | Bitflash <admin@bitflash.network> | 2026-08-14 15:35:42 -0300 |
| commit | c08a32d26cabf5acc9dabf298a22051596308174 (patch) | |
| tree | 25c86213839210a08ff69983e7219e924d5dbb85 /src/wallet_sqlite.h | |
| parent | 9b281d890168c7c912857530d787fbc82203d848 (diff) | |
| parent | c49b92a9a79a398b51200e69f7dde8a467b9c925 (diff) | |
Merge pull request 'wallet: add experimental SQLite record store' (#47) from wallet-sqlite-skeleton into main
Diffstat (limited to 'src/wallet_sqlite.h')
| -rw-r--r-- | src/wallet_sqlite.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/wallet_sqlite.h b/src/wallet_sqlite.h new file mode 100644 index 0000000..9812d3a --- /dev/null +++ b/src/wallet_sqlite.h | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | // Copyright (c) 2026 Bitflash developers | ||
| 2 | // Distributed under the MIT/X11 software license. | ||
| 3 | |||
| 4 | #ifndef BITFLASH_WALLET_SQLITE_H | ||
| 5 | #define BITFLASH_WALLET_SQLITE_H | ||
| 6 | |||
| 7 | #include <sqlite3.h> | ||
| 8 | |||
| 9 | class CWalletDBSQLite | ||
| 10 | { | ||
| 11 | public: | ||
| 12 | CWalletDBSQLite(); | ||
| 13 | ~CWalletDBSQLite(); | ||
| 14 | |||
| 15 | bool Open(const string& strPath, string& strError); | ||
| 16 | void Close(); | ||
| 17 | |||
| 18 | bool BeginTransaction(string& strError); | ||
| 19 | bool CommitTransaction(string& strError); | ||
| 20 | bool RollbackTransaction(string& strError); | ||
| 21 | |||
| 22 | bool WriteRecord(const vector<unsigned char>& vchKey, | ||
| 23 | const vector<unsigned char>& vchValue, | ||
| 24 | string& strError); | ||
| 25 | bool ReadRecord(const vector<unsigned char>& vchKey, | ||
| 26 | vector<unsigned char>& vchValueRet, | ||
| 27 | string& strError); | ||
| 28 | bool CountRecords(int& nRecordsRet, string& strError); | ||
| 29 | |||
| 30 | private: | ||
| 31 | sqlite3* pdb; | ||
| 32 | |||
| 33 | bool Exec(const char* pszSql, string& strError); | ||
| 34 | bool InitSchema(string& strError); | ||
| 35 | |||
| 36 | CWalletDBSQLite(const CWalletDBSQLite&); | ||
| 37 | void operator=(const CWalletDBSQLite&); | ||
| 38 | }; | ||
| 39 | |||
| 40 | #endif | ||