class SSQLite3Statement: public SSqlStatement
{
public:
- SSQLite3Statement(SSQLite3 *db, bool dolog, const string& query) : d_prepared(false)
+ SSQLite3Statement(SSQLite3 *db, bool dolog, const string& query) :
+ d_query(query),
+ d_db(db),
+ d_dolog(dolog)
{
- this->d_query = query;
- this->d_dolog = dolog;
- d_stmt = NULL;
- d_rc = 0;
- d_db = db;
}
int name2idx(const string& name) {
const string& getQuery() { return d_query; };
private:
string d_query;
- sqlite3_stmt* d_stmt;
- SSQLite3* d_db;
- int d_rc;
- bool d_dolog;
- bool d_prepared;
DTime d_dtime;
+ sqlite3_stmt* d_stmt{nullptr};
+ SSQLite3* d_db{nullptr};
+ int d_rc{0};
+ bool d_dolog;
+ bool d_prepared{false};
+
void prepareStatement() {
const char *pTail;
void releaseStatement() {
if (d_stmt)
sqlite3_finalize(d_stmt);
- d_stmt = NULL;
+ d_stmt = nullptr;
d_prepared = false;
}
};
// Constructor.
-SSQLite3::SSQLite3( const std::string & database, bool creat )
+SSQLite3::SSQLite3( const std::string & database, const std::string & journalmode, bool creat )
{
if (access( database.c_str(), F_OK ) == -1){
if (!creat)
m_dolog = 0;
m_in_transaction = false;
sqlite3_busy_handler(m_pDB, busyHandler, 0);
+
+ if(journalmode.length())
+ execute("PRAGMA journal_mode="+journalmode);
}
void SSQLite3::setLog(bool state)