3 #include "boost/filesystem.hpp" 7 #include "hep_concurrency/simultaneous_function_spawner.h" 18 namespace bfs = boost::filesystem;
27 string const f{
"a.db"};
38 r <<
select(
"*").from(*
c,
"onlyOne");
43 string const f1{
"b.db"};
44 string const f2{
"c.db"};
49 bfs::path
const p1{
f1};
50 bfs::path
const p2{
f2};
54 auto test_colliding_tables = [&cf](
string const& dbname) {
63 assert(
string{e.what()}.find(
"table colliding already exists") !=
69 string const f{
"d.db"};
70 test_colliding_tables(
f);
75 test_colliding_tables(
":memory:");
79 string const f{
"e.db"};
80 auto makeConnection = [&sharedFactory, &
f] {
83 simultaneous_function_spawner launch{repeated_task(10u, makeConnection)};
97 std::vector<std::function<void()>> tasks;
98 for (
unsigned i{1}; i < 6u; ++i) {
99 tasks.push_back([&n1, i] {
100 n1.insert(2 * i - 1);
103 tasks.push_back([&n2, i] {
108 simultaneous_function_spawner launch{tasks};
110 sum_odds <<
select(
"sum(Number)").from(*
c1,
"Odds");
112 sum_evens <<
select(
"sum(Number)").from(*c2,
"Evens");
118 cerr << e.what() <<
'\n';
122 cerr <<
"Caught unknown exception.\n";
T unique_value(query_result< T > const &r)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
auto make_connection(std::string const &file_name, PolicyArgs &&...) -> Connection *
bool exists(std::string path)
void create_table(sqlite3 *const db, std::string const &tablename, Cols const &...cols)
auto select(T const &...t)
cet::coded_exception< error, detail::translate > exception