Skip to content

Commit

Permalink
set sqlite temp store in memory
Browse files Browse the repository at this point in the history
  • Loading branch information
heropan committed Apr 25, 2020
1 parent 590039c commit 3d9fb25
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions SDK/Database/Sqlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ namespace Elastos {
close();
}

int Sqlite::ExtendedEerrCode() const {
return sqlite3_extended_errcode(_dataBasePtr);
}

bool Sqlite::IsValid() {
return _dataBasePtr != NULL;
}
Expand Down
2 changes: 2 additions & 0 deletions SDK/Database/Sqlite.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ namespace Elastos {
~Sqlite();

bool IsValid();

int ExtendedEerrCode() const;
/*
* The sqlite3_exec() interface is a convenience wrapper around sqlite3_prepare_v2(),
* sqlite3_step(), and sqlite3_finalize(), that allows an application to run multiple
Expand Down
5 changes: 3 additions & 2 deletions SDK/Database/TransactionNormal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,9 @@ namespace Elastos {

GetSelectedTxns(txns, chainID, stmt);

if (!_sqlite->Finalize(stmt)) {
Log::error("Tx get utxo txn finalize");
int r = sqlite3_finalize(stmt);
if (SQLITE_OK != r) {
Log::error("Tx get utxo txn({}) finalize: r = {}, extend code: {}", txns.size(), r, _sqlite->ExtendedEerrCode());
return {};
}

Expand Down
2 changes: 0 additions & 2 deletions SDK/Implement/MainchainSubWallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@
#include <Plugin/Transaction/Payload/CRCProposalReview.h>
#include <Plugin/Transaction/Payload/CRCProposalTracking.h>
#include <Plugin/Transaction/Payload/CRCProposalWithdraw.h>
#include <Plugin/Transaction/TransactionInput.h>
#include <Plugin/Transaction/TransactionOutput.h>
#include <SpvService/Config.h>
#include <Plugin/Transaction/Payload/ReturnDepositCoin.h>
#include <CMakeConfig.h>

#include <vector>
#include <map>
#include <boost/scoped_ptr.hpp>

namespace Elastos {
namespace ElaWallet {
Expand Down
3 changes: 3 additions & 0 deletions ThirdParty/libsqlite/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
project(libsqlite)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSQLITE_TEMP_STORE=3")

include(ProjectDefaults)
include(ExternalProject)
include(ExternalConfigureArgs)

set(CONFIGURE_CMD
./configure
--disable-shared
--enable-tempstore=always
--prefix=${PROJECT_INT_DIST_DIR}
${CONFIGURE_ARGS_INIT})

Expand Down

0 comments on commit 3d9fb25

Please sign in to comment.