"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Rose/BinaryAnalysis/Concolic/Database.C" between
rose-0.11.49.0.tar.gz and rose-0.11.50.0.tar.gz

About: ROSE is a compiler infrastructure to build source-to-source program transformation and analysis tools for large-scale C, C++, UPC, Fortran, OpenMP, Java, Python and PHP applications.

Database.C  (rose-0.11.49.0):Database.C  (rose-0.11.50.0)
skipping to change at line 123 skipping to change at line 123
" constraint fk_test_suite foreign key (test_suite) references test_s uites (id))"); " constraint fk_test_suite foreign key (test_suite) references test_s uites (id))");
db.run("drop table if exists execution_events"); db.run("drop table if exists execution_events");
db.run("create table execution_events (" db.run("create table execution_events ("
" created_ts varchar(32) not null," " created_ts varchar(32) not null,"
" id integer primary key," " id integer primary key,"
" test_suite integer not null," " test_suite integer not null,"
// Identification // Identification
" test_case integer not null," // test case to which th is event belongs " test_case integer not null," // test case to which th is event belongs
" location_primary integer not null," // event location.primar " location_primary integer not null," // event location.primar
y field y property
" location_secondary integer not null," // events location.secon " location_secondary integer not null," // events location.secon
dary field dary property
" location_when integer not null," // events location.when
property
" instruction_pointer integer not null," // value of the instruct ion pointer register at this event " instruction_pointer integer not null," // value of the instruct ion pointer register at this event
" name varchar(32) not null," // arbitrary name for de bugging " name varchar(32) not null," // arbitrary name for de bugging
// Associated optional test case input variable // Associated optional test case input variable
" input_type string not null," // one of the InputType constants " input_type string not null," // one of the InputType constants
" input_variable string," // name of associated sy mbolic variable " input_variable string," // name of associated sy mbolic variable
" input_i1 integer," // first integer field " input_i1 integer," // first integer field
" input_i2 integer," // second integer field " input_i2 integer," // second integer field
// Actions. The interpretation of these fields depends on the action type. // Actions. The interpretation of these fields depends on the action type.
" action_type varchar(32) not null," // action to be performe d " action_type varchar(32) not null," // action to be performe d
" start_va integer," // starting address for actions that need one " start_va integer," // starting address for actions that need one
" scalar integer," // scalar value for thos e actions that need one " scalar integer," // scalar value for thos e actions that need one
" bytes bytea," // vector value for thos e actions that need one " bytes bytea," // vector value for thos e actions that need one
" symbolic bytea," // serialized SymbolicEx pr for actions that need one
"constraint fk_test_suite foreign key (test_suite) references test_su ites (id)," "constraint fk_test_suite foreign key (test_suite) references test_su ites (id),"
"constraint fk_test_case foreign key (test_case) references test_case s (id))"); "constraint fk_test_case foreign key (test_case) references test_case s (id))");
} }
static void static void
initTestSuite(const Database::Ptr &db) { initTestSuite(const Database::Ptr &db) {
if (auto id = db->connection().get<size_t>("select id from test_suites order by created_ts desc limit 1")) { if (auto id = db->connection().get<size_t>("select id from test_suites order by created_ts desc limit 1")) {
auto ts = db->object(TestSuiteId(*id)); auto ts = db->object(TestSuiteId(*id));
db->testSuite(ts); db->testSuite(ts);
skipping to change at line 425 skipping to change at line 427
static void static void
updateObject(const Database::Ptr &db, ExecutionEventId id, const ExecutionEvent: :Ptr &obj) { updateObject(const Database::Ptr &db, ExecutionEventId id, const ExecutionEvent: :Ptr &obj) {
ASSERT_not_null(db); ASSERT_not_null(db);
ASSERT_require(id); ASSERT_require(id);
ASSERT_not_null(obj); ASSERT_not_null(obj);
// 0 1 2 3 4 // 0 1 2 3 4
auto iter = db->connection().stmt("select created_ts, test_case, location_pr imary, location_secondary, instruction_pointer," auto iter = db->connection().stmt("select created_ts, test_case, location_pr imary, location_secondary, instruction_pointer,"
// 5 6 7 8 9 10 11 // 5 6 7 8 9 10 11
" action_type, start_va, scalar, bytes, na me, input_type, input_variable," " action_type, start_va, scalar, bytes, na me, input_type, input_variable,"
// 12 13 // 12 13 14 15
" input_i1, input_i2" " input_i1, input_i2, symbolic, location_w
hen"
" from execution_events" " from execution_events"
" where id = ?id" " where id = ?id"
" order by created_ts") " order by created_ts")
.bind("id", *id) .bind("id", *id)
.begin(); .begin();
if (!iter) if (!iter)
throw Exception("no such executon event in database where id=" + boost:: lexical_cast<std::string>(*id)); throw Exception("no such executon event in database where id=" + boost:: lexical_cast<std::string>(*id));
TestCaseId tcid(*iter->get<size_t>(1)); TestCaseId tcid(*iter->get<size_t>(1));
TestCase::Ptr testcase = db->object(tcid); TestCase::Ptr testcase = db->object(tcid);
ASSERT_not_null(testcase); ASSERT_not_null(testcase);
obj->timestamp(*iter->get<std::string>(0)); obj->timestamp(*iter->get<std::string>(0));
obj->testCase(testcase); obj->testCase(testcase);
obj->location(ExecutionLocation(*iter->get<uint64_t>(2), *iter->get<size_t>( When when;
3))); if (*iter->get<int>(15) == 0) {
when = When::PRE;
} else if (*iter->get<int>(15) == 1) {
when = When::POST;
} else {
ASSERT_not_reachable("invalid 'when' field: " + boost::lexical_cast<std:
:string>(*iter->get<std::string>(15)));
}
obj->location(ExecutionLocation(*iter->get<uint64_t>(2), *iter->get<size_t>(
3), when));
obj->instructionPointer(*iter->get<rose_addr_t>(4)); obj->instructionPointer(*iter->get<rose_addr_t>(4));
obj->name(*iter->get<std::string>(9)); obj->name(*iter->get<std::string>(9));
std::string inputType = iter->get<std::string>(10).orElse("none"); std::string inputType = iter->get<std::string>(10).orElse("none");
if ("none" == inputType) { if ("none" == inputType) {
obj->inputType(InputType::NONE); obj->inputType(InputType::NONE);
} else if ("argc" == inputType) { } else if ("argc" == inputType) {
obj->inputType(InputType::PROGRAM_ARGUMENT_COUNT); obj->inputType(InputType::PROGRAM_ARGUMENT_COUNT);
} else if ("argv" == inputType) { } else if ("argv" == inputType) {
obj->inputType(InputType::PROGRAM_ARGUMENT); obj->inputType(InputType::PROGRAM_ARGUMENT);
} else if ("envp" == inputType) { } else if ("envp" == inputType) {
obj->inputType(InputType::ENVIRONMENT); obj->inputType(InputType::ENVIRONMENT);
} else if ("syscall-ret" == inputType) { } else if ("syscall-ret" == inputType) {
obj->inputType(InputType::SYSTEM_CALL_RETVAL); obj->inputType(InputType::SYSTEM_CALL_RETVAL);
} else if ("shared-memory-read" == inputType) {
obj->inputType(InputType::SHARED_MEMORY_READ);
} else { } else {
ASSERT_not_reachable("invalid input type \"" + StringUtility::cEscape(in putType) + "\""); ASSERT_not_reachable("invalid input type \"" + StringUtility::cEscape(in putType) + "\"");
} }
if (auto serializedVar = iter->get<std::string>(11)) { if (auto serializedVar = iter->get<std::string>(11)) {
std::istringstream ss(*serializedVar); std::istringstream ss(*serializedVar);
boost::archive::binary_iarchive archive(ss); boost::archive::binary_iarchive archive(ss);
SymbolicExpr::Ptr var; SymbolicExpr::Ptr var;
archive >>var; archive >>var;
ASSERT_not_null(var); ASSERT_not_null(var);
obj->inputVariable(var); obj->inputVariable(var);
} else { } else {
obj->inputVariable(SymbolicExpr::Ptr()); obj->inputVariable(SymbolicExpr::Ptr());
} }
if (auto serializedSymbolic = iter->get<std::string>(14)) {
std::istringstream ss(*serializedSymbolic);
boost::archive::binary_iarchive archive(ss);
SymbolicExpr::Ptr symbolic;
archive >>symbolic;
ASSERT_not_null(symbolic);
obj->symbolic(symbolic);
} else {
obj->symbolic(SymbolicExpr::Ptr());
}
obj->inputI1(iter->get<size_t>(12).orElse(0)); obj->inputI1(iter->get<size_t>(12).orElse(0));
obj->inputI2(iter->get<size_t>(13).orElse(0)); obj->inputI2(iter->get<size_t>(13).orElse(0));
std::string action = *iter->get<std::string>(5); std::string action = *iter->get<std::string>(5);
auto startVa = iter->get<rose_addr_t>(6); auto startVa = iter->get<rose_addr_t>(6);
auto scalar = iter->get<size_t>(7); auto scalar = iter->get<size_t>(7);
auto bytes = iter->get<std::vector<uint8_t>>(8); auto bytes = iter->get<std::vector<uint8_t>>(8);
if ("none" == action) { if ("none" == action) {
obj->actionType(ExecutionEvent::Action::NONE); obj->actionType(ExecutionEvent::Action::NONE);
skipping to change at line 512 skipping to change at line 535
obj->actionType(ExecutionEvent::Action::HASH_MEMORY); obj->actionType(ExecutionEvent::Action::HASH_MEMORY);
ASSERT_require(startVa); ASSERT_require(startVa);
ASSERT_require(scalar); ASSERT_require(scalar);
obj->memoryLocation(AddressInterval::baseSize(*startVa, *scalar)); obj->memoryLocation(AddressInterval::baseSize(*startVa, *scalar));
ASSERT_require(bytes); ASSERT_require(bytes);
obj->bytes(*bytes); obj->bytes(*bytes);
} else if ("write_register" == action) { } else if ("write_register" == action) {
obj->actionType(ExecutionEvent::Action::WRITE_REGISTER); obj->actionType(ExecutionEvent::Action::WRITE_REGISTER);
ASSERT_require(scalar); ASSERT_require(scalar);
obj->scalar(*scalar); obj->scalar(*scalar);
ASSERT_require(bytes); if (bytes) {
obj->bytes(*bytes); obj->bytes(*bytes);
} else {
ASSERT_not_null(obj->symbolic());
}
} else if ("restore_registers" == action) { } else if ("restore_registers" == action) {
obj->actionType(ExecutionEvent::Action::RESTORE_REGISTERS); obj->actionType(ExecutionEvent::Action::RESTORE_REGISTERS);
ASSERT_require(bytes); ASSERT_require(bytes);
obj->bytes(*bytes); obj->bytes(*bytes);
} else if ("os_syscall" == action) { } else if ("os_syscall" == action) {
obj->actionType(ExecutionEvent::Action::OS_SYSCALL); obj->actionType(ExecutionEvent::Action::OS_SYSCALL);
ASSERT_require(scalar); ASSERT_require(scalar);
obj->scalar(*scalar); obj->scalar(*scalar);
ASSERT_require(bytes); ASSERT_require(bytes);
obj->bytes(*bytes); obj->bytes(*bytes);
} else if ("os_shm_read" == action) {
obj->actionType(ExecutionEvent::Action::OS_SHM_READ);
ASSERT_require(startVa);
ASSERT_require(scalar);
obj->memoryLocation(AddressInterval::baseSize(*startVa, *scalar));
if (bytes)
obj->bytes(*bytes);
} else { } else {
throw Exception("unrecognized execution action \"" + action + "\" where id=" + boost::lexical_cast<std::string>(*id)); throw Exception("unrecognized execution action \"" + action + "\" where id=" + boost::lexical_cast<std::string>(*id));
} }
} }
static void static void
updateDb(const Database::Ptr &db, ExecutionEventId id, const ExecutionEvent::Ptr &obj) { updateDb(const Database::Ptr &db, ExecutionEventId id, const ExecutionEvent::Ptr &obj) {
ASSERT_not_null(db); ASSERT_not_null(db);
ASSERT_require(id); ASSERT_require(id);
ASSERT_not_null(obj); ASSERT_not_null(obj);
skipping to change at line 550 skipping to change at line 583
" location_secondary = ?location_secondary ," " location_secondary = ?location_secondary ,"
" instruction_pointer = ?instruction_point er," " instruction_pointer = ?instruction_point er,"
" name = ?name," " name = ?name,"
" input_type = ?input_type," " input_type = ?input_type,"
" input_variable = ?input_variable," " input_variable = ?input_variable,"
" input_i1 = ?input_i1," " input_i1 = ?input_i1,"
" input_i2 = ?input_i2," " input_i2 = ?input_i2,"
" action_type = ?action_type," " action_type = ?action_type,"
" start_va = ?start_va," " start_va = ?start_va,"
" scalar = ?scalar," " scalar = ?scalar,"
" bytes = ?bytes" " bytes = ?bytes,"
" symbolic = ?symbolic,"
" location_when = ?location_when"
" where id = ?id"); " where id = ?id");
} else { } else {
std::string ts = obj->timestamp().empty() ? timestamp() : obj->timestamp (); std::string ts = obj->timestamp().empty() ? timestamp() : obj->timestamp ();
obj->timestamp(ts); obj->timestamp(ts);
stmt = db->connection().stmt("insert into execution_events (" stmt = db->connection().stmt("insert into execution_events ("
" id, created_ts, test_suite," " id, created_ts, test_suite,"
" test_case, location_primary, location_sec ondary, instruction_pointer, name," " test_case, location_primary, location_sec ondary, instruction_pointer, name,"
" input_type, input_variable, input_i1, inp ut_i2," " input_type, input_variable, input_i1, inp ut_i2,"
" action_type, start_va, scalar, bytes" " action_type, start_va, scalar, bytes, sym bolic, location_when"
") values (" ") values ("
" ?id, ?created_ts, ?test_suite," " ?id, ?created_ts, ?test_suite,"
" ?test_case, ?location_primary, ?location_ secondary, ?instruction_pointer, ?name," " ?test_case, ?location_primary, ?location_ secondary, ?instruction_pointer, ?name,"
" ?input_type, ?input_variable, ?input_i1, ?input_i2," " ?input_type, ?input_variable, ?input_i1, ?input_i2,"
" ?action_type, ?start_va, ?scalar, ?bytes" " ?action_type, ?start_va, ?scalar, ?bytes, ?symbolic, ?location_when"
")") ")")
.bind("created_ts", ts) .bind("created_ts", ts)
.bind("test_suite", *db->id(db->testSuite())); .bind("test_suite", *db->id(db->testSuite()));
} }
int when = -1;
switch (obj->location().when()) {
case When::PRE:
when = 0;
break;
case When::POST:
when = 1;
break;
}
ASSERT_forbid(-1 == when);
stmt stmt
.bind("id", *id) .bind("id", *id)
.bind("test_case", *db->id(obj->testCase(), Update::YES)) .bind("test_case", *db->id(obj->testCase(), Update::YES))
.bind("location_primary", obj->location().primary) .bind("location_primary", obj->location().primary())
.bind("location_secondary", obj->location().secondary) .bind("location_secondary", obj->location().secondary())
.bind("location_when", when)
.bind("instruction_pointer", obj->instructionPointer()) .bind("instruction_pointer", obj->instructionPointer())
.bind("name", obj->name()) .bind("name", obj->name())
.bind("input_i1", obj->inputI1()) .bind("input_i1", obj->inputI1())
.bind("input_i2", obj->inputI2()); .bind("input_i2", obj->inputI2());
switch (obj->inputType()) { switch (obj->inputType()) {
case InputType::NONE: case InputType::NONE:
stmt.bind("input_type", "none"); stmt.bind("input_type", "none");
break; break;
case InputType::PROGRAM_ARGUMENT_COUNT: case InputType::PROGRAM_ARGUMENT_COUNT:
skipping to change at line 596 skipping to change at line 643
break; break;
case InputType::PROGRAM_ARGUMENT: case InputType::PROGRAM_ARGUMENT:
stmt.bind("input_type", "argv"); stmt.bind("input_type", "argv");
break; break;
case InputType::ENVIRONMENT: case InputType::ENVIRONMENT:
stmt.bind("input_type", "environment"); stmt.bind("input_type", "environment");
break; break;
case InputType::SYSTEM_CALL_RETVAL: case InputType::SYSTEM_CALL_RETVAL:
stmt.bind("input_type", "syscall-ret"); stmt.bind("input_type", "syscall-ret");
break; break;
case InputType::SHARED_MEMORY_READ:
stmt.bind("input_type", "shared-memory-read");
break;
} }
if (SymbolicExpr::Ptr var = obj->inputVariable()) { if (SymbolicExpr::Ptr var = obj->inputVariable()) {
std::ostringstream ss; std::ostringstream ss;
{ {
boost::archive::binary_oarchive archive(ss); boost::archive::binary_oarchive archive(ss);
archive <<var; archive <<var;
} }
stmt.bind("input_variable", ss.str()); stmt.bind("input_variable", ss.str());
} else { } else {
stmt.bind("input_variable", Sawyer::Nothing()); stmt.bind("input_variable", Sawyer::Nothing());
} }
if (SymbolicExpr::Ptr symbolic = obj->symbolic()) {
std::ostringstream ss;
{
boost::archive::binary_oarchive archive(ss);
archive <<symbolic;
}
stmt.bind("symbolic", ss.str());
} else {
stmt.bind("symbolic", Sawyer::Nothing());
}
switch (obj->actionType()) { switch (obj->actionType()) {
case ExecutionEvent::Action::NONE: case ExecutionEvent::Action::NONE:
stmt.bind("action_type", "none"); stmt.bind("action_type", "none");
stmt.bind("start_va", Sawyer::Nothing()); stmt.bind("start_va", Sawyer::Nothing());
stmt.bind("scalar", Sawyer::Nothing()); stmt.bind("scalar", Sawyer::Nothing());
stmt.bind("bytes", Sawyer::Nothing()); stmt.bind("bytes", Sawyer::Nothing());
break; break;
case ExecutionEvent::Action::MAP_MEMORY: case ExecutionEvent::Action::MAP_MEMORY:
stmt.bind("action_type", "map_memory"); stmt.bind("action_type", "map_memory");
stmt.bind("start_va", obj->memoryLocation().least()); stmt.bind("start_va", obj->memoryLocation().least());
skipping to change at line 658 skipping to change at line 719
stmt.bind("action_type", "restore_registers"); stmt.bind("action_type", "restore_registers");
stmt.bind("start_va", Sawyer::Nothing()); stmt.bind("start_va", Sawyer::Nothing());
stmt.bind("scalar", Sawyer::Nothing()); stmt.bind("scalar", Sawyer::Nothing());
stmt.bind("bytes", obj->bytes()); stmt.bind("bytes", obj->bytes());
break; break;
case ExecutionEvent::Action::OS_SYSCALL: case ExecutionEvent::Action::OS_SYSCALL:
stmt.bind("action_type", "os_syscall"); stmt.bind("action_type", "os_syscall");
stmt.bind("start_va", Sawyer::Nothing()); stmt.bind("start_va", Sawyer::Nothing());
stmt.bind("scalar", obj->scalar()); stmt.bind("scalar", obj->scalar());
stmt.bind("bytes", obj->bytes()); stmt.bind("bytes", obj->bytes());
break;
case ExecutionEvent::Action::OS_SHM_READ:
stmt.bind("action_type", "os_shm_read");
stmt.bind("start_va", obj->memoryLocation().least());
stmt.bind("scalar", obj->memoryLocation().size());
stmt.bind("bytes", obj->bytes());
break;
} }
stmt.run(); stmt.run();
} }
static void static void
eraseDb(const Database::Ptr &db, ExecutionEventId id) { eraseDb(const Database::Ptr &db, ExecutionEventId id) {
ASSERT_not_null(db); ASSERT_not_null(db);
ASSERT_require(id); ASSERT_require(id);
db->connection().stmt("delete from execution_events where id = ?id") db->connection().stmt("delete from execution_events where id = ?id")
skipping to change at line 904 skipping to change at line 972
ASSERT_require(specimenId); ASSERT_require(specimenId);
for (TestCaseId tcid: testCases(specimenId)) for (TestCaseId tcid: testCases(specimenId))
erase(tcid); erase(tcid);
} }
std::vector<ExecutionEventId> std::vector<ExecutionEventId>
Database::executionEvents() { Database::executionEvents() {
std::vector<ExecutionEventId> retval; std::vector<ExecutionEventId> retval;
Sawyer::Database::Statement stmt; Sawyer::Database::Statement stmt;
if (testSuiteId_) { if (testSuiteId_) {
stmt = connection_.stmt("select id from execution_events where test_suit stmt = connection_.stmt("select id from execution_events where test_suit
e = ?tsid order by created_ts") e = ?tsid order by created_ts"
" order by location_primary, location_when, loca
tion_secondary")
.bind("tsid", *testSuiteId_); .bind("tsid", *testSuiteId_);
} else { } else {
stmt = connection_.stmt("select id from execution_units order by created _ts"); stmt = connection_.stmt("select id from execution_units order by created _ts");
} }
for (auto row: stmt) for (auto row: stmt)
retval.push_back(ExecutionEventId(row.get<size_t>(0))); retval.push_back(ExecutionEventId(row.get<size_t>(0)));
return retval; return retval;
} }
std::vector<ExecutionEventId> std::vector<ExecutionEventId>
Database::executionEvents(TestCaseId tcid) { Database::executionEvents(TestCaseId tcid) {
ASSERT_require(tcid); ASSERT_require(tcid);
Sawyer::Database::Statement stmt; Sawyer::Database::Statement stmt;
stmt = connection_.stmt("select id from execution_events where test_case = ? tcid" stmt = connection_.stmt("select id from execution_events where test_case = ? tcid"
" order by location_primary, location_secondary") " order by location_primary, location_when, location _secondary")
.bind("tcid", *tcid); .bind("tcid", *tcid);
std::vector<ExecutionEventId> retval; std::vector<ExecutionEventId> retval;
for (auto row: stmt) for (auto row: stmt)
retval.push_back(ExecutionEventId(row.get<size_t>(0))); retval.push_back(ExecutionEventId(row.get<size_t>(0)));
return retval; return retval;
} }
std::vector<ExecutionEventId> std::vector<ExecutionEventId>
Database::executionEventsSince(TestCaseId tcid, ExecutionEventId startingAtId) { Database::executionEventsSince(TestCaseId tcid, ExecutionEventId startingAtId) {
ASSERT_require(tcid); ASSERT_require(tcid);
ASSERT_require(startingAtId); ASSERT_require(startingAtId);
ExecutionEvent::Ptr startingAt = object(startingAtId, Update::NO); ExecutionEvent::Ptr startingAt = object(startingAtId, Update::NO);
int when = -1;
switch (startingAt->location().when()) {
case When::PRE:
when = 0;
break;
case When::POST:
when = 1;
break;
}
ASSERT_forbid(-1 == when);
Sawyer::Database::Statement stmt; Sawyer::Database::Statement stmt;
stmt = connection_.stmt("select id from execution_events" stmt = connection_.stmt("select id from execution_events"
" where (location_primary = ?location_primary and lo " where (location_primary > ?location_primary)"
cation_secondary >= ?location_secondary)" " or (location_primary = ?location_primary and locat
" or (location_primary > ?location_primary)" ion_when > ?location_when)"
" order by location_primary, location_secondary") " or (location_primary = ?location_primary and locat
.bind("location_primary", startingAt->location().primary) ion_when = ?location_when and"
.bind("location_secondary", startingAt->location().secondary); " location_secondary > ?location_secondary)"
" order by location_primary, location_when, location
_secondary")
.bind("location_primary", startingAt->location().primary())
.bind("location_secondary", startingAt->location().secondary())
.bind("location_when", when);
std::vector<ExecutionEventId> retval; std::vector<ExecutionEventId> retval;
for (auto row: stmt) for (auto row: stmt)
retval.push_back(ExecutionEventId(row.get<size_t>(0))); retval.push_back(ExecutionEventId(row.get<size_t>(0)));
return retval; return retval;
} }
size_t size_t
Database::nExecutionEvents(TestCaseId tcid) { Database::nExecutionEvents(TestCaseId tcid) {
ASSERT_require(tcid); ASSERT_require(tcid);
return connection_.stmt("select count(*) from execution_events where test_ca se = ?tcid") return connection_.stmt("select count(*) from execution_events where test_ca se = ?tcid")
skipping to change at line 961 skipping to change at line 1044
.get<size_t>() .get<size_t>()
.orElse(0); .orElse(0);
} }
std::vector<ExecutionEventId> std::vector<ExecutionEventId>
Database::executionEvents(TestCaseId tcid, uint64_t primaryKey) { Database::executionEvents(TestCaseId tcid, uint64_t primaryKey) {
ASSERT_require(tcid); ASSERT_require(tcid);
Sawyer::Database::Statement stmt; Sawyer::Database::Statement stmt;
stmt = connection_.stmt("select id from execution_events" stmt = connection_.stmt("select id from execution_events"
" where test_case = ?tcid and location_primary = ?lo cation_primary" " where test_case = ?tcid and location_primary = ?lo cation_primary"
" order by location_secondary") " order by location_primary, location_when, location _secondary")
.bind("tcid", *tcid) .bind("tcid", *tcid)
.bind("location_primary", primaryKey); .bind("location_primary", primaryKey);
std::vector<ExecutionEventId> retval; std::vector<ExecutionEventId> retval;
for (auto row: stmt) for (auto row: stmt)
retval.push_back(ExecutionEventId(row.get<size_t>(0))); retval.push_back(ExecutionEventId(row.get<size_t>(0)));
return retval; return retval;
} }
std::vector<uint64_t> std::vector<uint64_t>
Database::executionEventKeyFrames(TestCaseId tcid) { Database::executionEventKeyFrames(TestCaseId tcid) {
ASSERT_require(tcid); ASSERT_require(tcid);
Sawyer::Database::Statement stmt; Sawyer::Database::Statement stmt;
stmt = connection_.stmt("select distinct location_primary from execution_eve nts" stmt = connection_.stmt("select distinct location_primary from execution_eve nts"
" where test_case = ?tcid" " where test_case = ?tcid"
" order by location_primary, location_secondary") " order by location_primary, location_when, location _secondary")
.bind("tcid", *tcid); .bind("tcid", *tcid);
std::vector<uint64_t> retval; std::vector<uint64_t> retval;
for (auto row: stmt) for (auto row: stmt)
retval.push_back(*row.get<uint64_t>(0)); retval.push_back(*row.get<uint64_t>(0));
return retval; return retval;
} }
void void
Database::eraseExecutionEvents(TestCaseId tcid) { Database::eraseExecutionEvents(TestCaseId tcid) {
ASSERT_require(tcid); ASSERT_require(tcid);
 End of changes. 22 change blocks. 
26 lines changed or deleted 115 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)