/freebsd/contrib/kyua/utils/sqlite/ |
H A D | statement_test.cpp | 43 namespace sqlite = utils::sqlite; 49 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 50 sqlite::statement stmt = db.create_statement( in ATF_TEST_CASE_BODY() 52 ATF_REQUIRE_THROW(sqlite::error, db.exec("SELECT * FROM foo")); in ATF_TEST_CASE_BODY() 61 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 63 sqlite::statement stmt = db.create_statement( in ATF_TEST_CASE_BODY() 74 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 75 sqlite::statement stmt = db.create_statement( in ATF_TEST_CASE_BODY() 85 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 86 sqlite::statement stmt = db.create_statement( in ATF_TEST_CASE_BODY() [all …]
|
H A D | statement.cpp | 46 namespace sqlite = utils::sqlite; 52 static sqlite::type c_type_to_cxx(const int) UTILS_PURE; 60 static sqlite::type 64 case SQLITE_BLOB: return sqlite::type_blob; in c_type_to_cxx() 65 case SQLITE_FLOAT: return sqlite::type_float; in c_type_to_cxx() 66 case SQLITE_INTEGER: return sqlite::type_integer; in c_type_to_cxx() 67 case SQLITE_NULL: return sqlite::type_null; in c_type_to_cxx() 68 case SQLITE_TEXT: return sqlite::type_text; in c_type_to_cxx() 84 handle_bind_error(sqlite::database& db, const char* api_function, in handle_bind_error() 95 throw sqlite::api_error::from_database(db, api_function); in handle_bind_error() [all …]
|
H A D | database_test.cpp | 41 namespace sqlite = utils::sqlite; 49 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 68 sqlite::database db = sqlite::database::open(fs::path("test.db"), in ATF_TEST_CASE_BODY() 69 sqlite::open_readonly); in ATF_TEST_CASE_BODY() 79 sqlite::database::open(fs::path("missing.db"), sqlite::open_readonly)); in ATF_TEST_CASE_BODY() 88 sqlite::database db = sqlite::database::open(fs::path("test.db"), in ATF_TEST_CASE_BODY() 89 sqlite::open_readwrite | sqlite::open_create); in ATF_TEST_CASE_BODY() 112 sqlite::database::open(fs::path("protected/test.db"), in ATF_TEST_CASE_BODY() 113 sqlite::open_readwrite | sqlite::open_create)); in ATF_TEST_CASE_BODY() 125 sqlite::database db = sqlite::database::temporary(); in ATF_TEST_CASE_BODY() [all …]
|
H A D | Makefile.am.inc | 33 libutils_a_SOURCES += utils/sqlite/c_gate.cpp 34 libutils_a_SOURCES += utils/sqlite/c_gate.hpp 35 libutils_a_SOURCES += utils/sqlite/c_gate_fwd.hpp 36 libutils_a_SOURCES += utils/sqlite/database.cpp 37 libutils_a_SOURCES += utils/sqlite/database.hpp 38 libutils_a_SOURCES += utils/sqlite/database_fwd.hpp 39 libutils_a_SOURCES += utils/sqlite/exceptions.cpp 40 libutils_a_SOURCES += utils/sqlite/exceptions.hpp 41 libutils_a_SOURCES += utils/sqlite/statement.cpp 42 libutils_a_SOURCES += utils/sqlite/statement.hpp [all …]
|
H A D | exceptions_test.cpp | 46 namespace sqlite = utils::sqlite; 54 const sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 55 const sqlite::error e(db.db_filename(), "Some text"); in ATF_TEST_CASE_BODY() 65 const sqlite::database db = sqlite::database::open( in ATF_TEST_CASE_BODY() 66 fs::path("test.db"), sqlite::open_readwrite | sqlite::open_create); in ATF_TEST_CASE_BODY() 67 const sqlite::error e(db.db_filename(), "Some text"); in ATF_TEST_CASE_BODY() 76 const sqlite::api_error e(none, "some_function", "Some text"); in ATF_TEST_CASE_BODY() 88 sqlite::database db = sqlite::database::open( in ATF_TEST_CASE_BODY() 89 fs::path("test.db"), sqlite::open_readwrite | sqlite::open_create); in ATF_TEST_CASE_BODY() 94 sqlite::database_c_gate gate(db); in ATF_TEST_CASE_BODY() [all …]
|
H A D | database.cpp | 49 namespace sqlite = utils::sqlite; 56 struct utils::sqlite::database::impl : utils::noncopyable { 114 sqlite::database error_db(utils::make_optional(fs::path(file)), in safe_open() 116 throw sqlite::api_error::from_database(error_db, in safe_open() 149 sqlite::database::database( in database() 162 sqlite::database::~database(void) in ~database() 173 sqlite::database 174 sqlite::database::in_memory(void) in in_memory() 192 sqlite::database 193 sqlite::database::open(const fs::path& file, int open_flags) in open() [all …]
|
H A D | transaction_test.cpp | 38 namespace sqlite = utils::sqlite; 54 check_in_table(sqlite::database& db, const char* table_name, in check_in_table() 57 sqlite::statement stmt = db.create_statement( in check_in_table() 74 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 78 sqlite::transaction tx = db.begin_transaction(); in ATF_TEST_CASE_BODY() 89 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 93 sqlite::transaction tx = db.begin_transaction(); in ATF_TEST_CASE_BODY() 105 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 109 sqlite::transaction tx = db.begin_transaction(); in ATF_TEST_CASE_BODY() 121 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() [all …]
|
H A D | exceptions.cpp | 44 namespace sqlite = utils::sqlite; 75 sqlite::error::error(const optional< fs::path >& db_filename_, in error() 85 sqlite::error::~error(void) throw() in ~error() 94 sqlite::error::db_filename(void) const in db_filename() 106 sqlite::api_error::api_error(const optional< fs::path >& db_filename_, in api_error() 116 sqlite::api_error::~api_error(void) throw() in ~api_error() 128 sqlite::api_error 129 sqlite::api_error::from_database(database& database_, in from_database() 142 sqlite::api_error::api_function(void) const in api_function() 153 sqlite::invalid_column_error::invalid_column_error( in invalid_column_error() [all …]
|
H A D | c_gate_test.cpp | 39 namespace sqlite = utils::sqlite; 49 sqlite::database database = sqlite::database_c_gate::connect(raw_db); in ATF_TEST_CASE_BODY() 62 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 65 sqlite::database_c_gate gate(db); in ATF_TEST_CASE_BODY() 85 sqlite::database database = sqlite::database_c_gate::connect(raw_db); in ATF_TEST_CASE_BODY()
|
H A D | c_gate.cpp | 35 namespace sqlite = utils::sqlite; 44 sqlite::database_c_gate::database_c_gate(database& database_) : in database_c_gate() 55 sqlite::database_c_gate::~database_c_gate(void) in ~database_c_gate() 69 sqlite::database 70 sqlite::database_c_gate::connect(::sqlite3* raw_database) in connect() 80 sqlite::database_c_gate::c_database(void) in c_database()
|
H A D | transaction.cpp | 39 namespace sqlite = utils::sqlite; 43 struct utils::sqlite::transaction::impl : utils::noncopyable { 75 } catch (const sqlite::error& e) { in ~impl() 113 sqlite::transaction::transaction(database& db) : in transaction() 120 sqlite::transaction::~transaction(void) in ~transaction() 129 sqlite::transaction::commit(void) in commit() 139 sqlite::transaction::rollback(void) in rollback()
|
/freebsd/contrib/kyua/cli/ |
H A D | cmd_db_exec_test.cpp | 39 namespace sqlite = utils::sqlite; 56 sqlite::database db = sqlite::database::in_memory(); in do_format_cell_test() 58 sqlite::statement create = db.create_statement( in do_format_cell_test() 62 sqlite::statement insert = db.create_statement( in do_format_cell_test() 67 sqlite::statement query = db.create_statement("SELECT * FROM test"); in do_format_cell_test() 82 "BLOB", sqlite::blob(contents, std::strlen(contents)), in ATF_TEST_CASE_BODY() 104 do_format_cell_test("TEXT", sqlite::null(), "NULL"); in ATF_TEST_CASE_BODY() 118 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 120 sqlite::statement create = db.create_statement( in ATF_TEST_CASE_BODY() 124 sqlite::statement query = db.create_statement( in ATF_TEST_CASE_BODY() [all …]
|
H A D | cmd_db_exec.cpp | 56 namespace sqlite = utils::sqlite; 92 cli::format_cell(sqlite::statement& stmt, const int index) in format_cell() 95 case sqlite::type_blob: { in format_cell() 96 const sqlite::blob blob = stmt.column_blob(index); in format_cell() 100 case sqlite::type_float: in format_cell() 103 case sqlite::type_integer: in format_cell() 106 case sqlite::type_null: in format_cell() 109 case sqlite::type_text: in format_cell() 123 cli::format_headers(sqlite::statement& stmt) in format_headers() 140 cli::format_row(sqlite::statement& stmt) in format_row() [all …]
|
/freebsd/contrib/kyua/store/ |
H A D | read_backend_test.cpp | 44 namespace sqlite = utils::sqlite; 51 sqlite::database db = sqlite::database::open( in ATF_TEST_CASE_BODY() 52 fs::path("test.db"), sqlite::open_readwrite | sqlite::open_create); in ATF_TEST_CASE_BODY() 58 sqlite::database db = store::detail::open_and_setup( in ATF_TEST_CASE_BODY() 59 fs::path("test.db"), sqlite::open_readwrite); in ATF_TEST_CASE_BODY() 63 ATF_REQUIRE_THROW(sqlite::error, in ATF_TEST_CASE_BODY() 73 sqlite::open_readonly)); in ATF_TEST_CASE_BODY() 87 sqlite::database db = sqlite::database::open( in ATF_TEST_CASE_BODY() 88 fs::path("test.db"), sqlite::open_readwrite | sqlite::open_create); in ATF_TEST_CASE_BODY() 115 sqlite::database db = sqlite::database::open( in ATF_TEST_CASE_BODY() [all …]
|
H A D | write_transaction.cpp | 62 namespace sqlite = utils::sqlite; 78 put_env_vars(sqlite::database& db, in put_env_vars() 81 sqlite::statement stmt = db.create_statement( in put_env_vars() 101 last_rowid(sqlite::database& db, const std::string& table) in last_rowid() 103 sqlite::statement stmt = db.create_statement( in last_rowid() 106 if (stmt.column_type(0) == sqlite::type_null) { in last_rowid() 109 INV(stmt.column_type(0) == sqlite::type_integer); in last_rowid() 122 put_metadata(sqlite::database& db, const model::metadata& md) in put_metadata() 128 sqlite::statement stmt = db.create_statement( in put_metadata() 154 put_file(sqlite::database& db, const fs::path& path) in put_file() [all …]
|
H A D | dbtypes.cpp | 40 namespace sqlite = utils::sqlite; 49 store::bind_bool(sqlite::statement& stmt, const char* field, const bool value) in bind_bool() 61 store::bind_delta(sqlite::statement& stmt, const char* field, in bind_delta() 77 store::bind_optional_string(sqlite::statement& stmt, const char* field, in bind_optional_string() 81 stmt.bind(field, sqlite::null()); in bind_optional_string() 93 store::bind_test_result_type(sqlite::statement& stmt, const char* field, in bind_test_result_type() 129 store::bind_timestamp(sqlite::statement& stmt, const char* field, in bind_timestamp() 145 store::column_bool(sqlite::statement& stmt, const char* column) in column_bool() 148 if (stmt.column_type(id) != sqlite::type_text) in column_bool() 170 store::column_delta(sqlite::statement& stmt, const char* column) in column_delta() [all …]
|
H A D | read_transaction.cpp | 60 namespace sqlite = utils::sqlite; 76 get_env_vars(sqlite::database& db) in get_env_vars() 80 sqlite::statement stmt = db.create_statement( in get_env_vars() 100 get_metadata(sqlite::database& db, const int64_t metadata_id) in get_metadata() 104 sqlite::statement stmt = db.create_statement( in get_metadata() 127 get_file(sqlite::database& db, const int64_t file_id) in get_file() 129 sqlite::statement stmt = db.create_statement( in get_file() 137 const sqlite::blob raw_contents = stmt.safe_column_blob("contents"); in get_file() 145 } catch (const sqlite::error& e) { in get_file() 161 get_test_cases(sqlite::database& db, const int64_t test_program_id) in get_test_cases() [all …]
|
H A D | write_backend_test.cpp | 46 namespace sqlite = utils::sqlite; 57 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 70 sqlite::statement stmt = db.create_statement( in ATF_TEST_CASE_BODY() 84 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 99 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 133 sqlite::database db = sqlite::database::open( in ATF_TEST_CASE_BODY() 134 fs::path("test.db"), sqlite::open_readwrite | sqlite::open_create); in ATF_TEST_CASE_BODY() 151 sqlite::database db = sqlite::database::open( in ATF_TEST_CASE_BODY() 152 fs::path("test.db"), sqlite::open_readwrite | sqlite::open_create); in ATF_TEST_CASE_BODY() 186 ATF_REQUIRE_THROW(utils::sqlite::error, in ATF_TEST_CASE_BODY()
|
H A D | dbtypes.hpp | 50 void bind_bool(utils::sqlite::statement&, const char*, const bool); 51 void bind_delta(utils::sqlite::statement&, const char*, 53 void bind_optional_string(utils::sqlite::statement&, const char*, 55 void bind_test_result_type(utils::sqlite::statement&, const char*, 57 void bind_timestamp(utils::sqlite::statement&, const char*, 59 bool column_bool(utils::sqlite::statement&, const char*); 60 utils::datetime::delta column_delta(utils::sqlite::statement&, const char*); 61 std::string column_optional_string(utils::sqlite::statement&, const char*); 63 utils::sqlite::statement&, const char*); 64 utils::datetime::timestamp column_timestamp(utils::sqlite::statement&,
|
H A D | metadata_test.cpp | 40 namespace sqlite = utils::sqlite; 56 static sqlite::database 59 sqlite::database db = sqlite::database::in_memory(); in create_database() 77 sqlite::database db = create_database(); in ATF_TEST_CASE_BODY() 97 sqlite::database db = create_database(); in ATF_TEST_CASE_BODY() 106 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 119 sqlite::database db = sqlite::database::in_memory(); in ATF_TEST_CASE_BODY() 137 sqlite::database db = create_database(); in ATF_TEST_CASE_BODY()
|
H A D | write_backend.cpp | 49 namespace sqlite = utils::sqlite; 75 empty_database(sqlite::database& db) in empty_database() 77 sqlite::statement stmt = db.create_statement("SELECT * FROM sqlite_master"); in empty_database() 105 store::detail::initialize(sqlite::database& db) in initialize() 125 } catch (const sqlite::error& e) { in initialize() 136 sqlite::database database; 141 impl(sqlite::database& database_) : database(database_) in impl() 173 sqlite::database db = detail::open_and_setup( in open_rw() 174 file, sqlite::open_readwrite | sqlite::open_create); in open_rw() 194 sqlite::database&
|
H A D | read_backend.cpp | 42 namespace sqlite = utils::sqlite; 56 sqlite::database 60 sqlite::database database = sqlite::database::open(file, flags); in open_and_setup() 63 } catch (const sqlite::error& e) { in open_and_setup() 72 sqlite::database database; 86 impl(sqlite::database& database_, const metadata& metadata_) : in impl() 130 sqlite::database db = detail::open_and_setup(file, sqlite::open_readonly); in open_ro() 146 sqlite::database&
|
H A D | migrate.cpp | 56 namespace sqlite = utils::sqlite; 78 sqlite::database db = store::detail::open_and_setup( in get_schema_version() 79 file, sqlite::open_readonly); in get_schema_version() 111 sqlite::database db = store::detail::open_and_setup( in migrate_schema_step() 112 file, sqlite::open_readwrite); in migrate_schema_step() 133 } catch (const sqlite::error& e) { in migrate_schema_step() 152 sqlite::database old_db = store::detail::open_and_setup( in chunk_database() 153 old_file, sqlite::open_readonly); in chunk_database() 155 sqlite::statement actions_stmt = old_db.create_statement( in chunk_database() 158 sqlite::statement start_time_stmt = old_db.create_statement( in chunk_database() [all …]
|
H A D | dbtypes_test.cpp | 43 namespace sqlite = utils::sqlite; 58 do_ok_test(void (*bind)(sqlite::statement&, const char*, Type1), in do_ok_test() 60 Type3 (*column)(sqlite::statement&, const char*)) in do_ok_test() 62 sqlite::database db = sqlite::database::in_memory(); in do_ok_test() 65 sqlite::statement insert = db.create_statement("INSERT INTO test " in do_ok_test() 70 sqlite::statement query = db.create_statement("SELECT * FROM test"); in do_ok_test() 85 Type2 (*column)(sqlite::statement&, const char*), in do_invalid_test() 88 sqlite::database db = sqlite::database::in_memory(); in do_invalid_test() 91 sqlite::statement insert = db.create_statement("INSERT INTO test " in do_invalid_test() 96 sqlite::statement query = db.create_statement("SELECT * FROM test"); in do_invalid_test()
|
H A D | metadata.cpp | 38 namespace sqlite = utils::sqlite; 54 int64_column(sqlite::statement& stmt, const char* column) in int64_column() 59 } catch (const sqlite::invalid_column_error& e) { in int64_column() 63 if (stmt.column_type(index) != sqlite::type_integer) in int64_column() 115 store::metadata::fetch_latest(sqlite::database& db) in fetch_latest() 118 sqlite::statement stmt = db.create_statement( in fetch_latest() 133 } catch (const sqlite::error& e) { in fetch_latest()
|