From 54fb59db04bdde2ce99a863a38ab02ea2fcb684b Mon Sep 17 00:00:00 2001 From: ejentzsx Date: Wed, 4 Feb 2015 16:21:36 +0100 Subject: [PATCH] Linux compatibility fixes --- scv_tr_sqlite/src/scv_tr_sqlite.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scv_tr_sqlite/src/scv_tr_sqlite.cpp b/scv_tr_sqlite/src/scv_tr_sqlite.cpp index 127caed..7bb1888 100644 --- a/scv_tr_sqlite/src/scv_tr_sqlite.cpp +++ b/scv_tr_sqlite/src/scv_tr_sqlite.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "scv/scv_util.h" #include "scv/scv_introspection.h" #include "scv/scv_tr.h" @@ -27,7 +28,6 @@ struct SQLiteDB { : runtime_error(msg), mnErrCode(0){ if (doFree && msg) sqlite3_free(const_cast(msg)); } - virtual ~SQLiteException()_NOEXCEPT {} const int errorCode() { return mnErrCode; } const char* errorMessage() { return what(); } private: @@ -146,6 +146,8 @@ static void streamCb(const scv_tr_stream& s, scv_tr_stream::callback_reason reas queryBuilder << "INSERT INTO " STREAM_TABLE " (id, name, kind) values (" << s.get_id() << ",'" << s.get_name() << "','" << (s.get_stream_kind() ? s.get_stream_kind() : "") << "');"; db.exec(queryBuilder.str().c_str()); + if(concurrencyLevel.size()<=s.get_id())concurrencyLevel.resize(s.get_id()+1); + concurrencyLevel[s.get_id()]=new vector(); } catch (SQLiteDB::SQLiteException& e) { _scv_message::message(_scv_message::TRANSACTION_RECORDING_INTERNAL, "Can't create stream"); } @@ -316,7 +318,10 @@ static void transactionCb(const scv_tr_handle& t, scv_tr_handle::callback_reason vector* levels=concurrencyLevel[streamId]; for(concurrencyIdx=0; concurrencyIdxsize(); ++concurrencyIdx) if((*levels)[concurrencyIdx]==id) break; - (*levels)[concurrencyIdx]=0; + if(concurrencyIdx==levels->size()) + levels->push_back(id); + else + levels->at(concurrencyIdx)=id; queryBuilder.str(""); queryBuilder << "INSERT INTO " TX_EVENT_TABLE " (tx,type,time)" << " values (" << t.get_id() << "," << END << "," << t.get_end_sc_time().value() << ");";