mirror of
https://github.com/ikawrakow/ik_llama.cpp.git
synced 2026-03-11 14:30:02 +00:00
Pull in full sqlite_modern_cpp repo for the license as it is not attached to source files
This commit is contained in:
23
common/sqlite_modern_cpp/tests/exception_dont_execute.cc
Normal file
23
common/sqlite_modern_cpp/tests/exception_dont_execute.cc
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <sqlite_modern_cpp.h>
|
||||
#include <catch2/catch.hpp>
|
||||
using namespace sqlite;
|
||||
using namespace std;
|
||||
|
||||
|
||||
TEST_CASE("Prepared statement will not execute on exceptions", "[prepared_statements]") {
|
||||
database db(":memory:");
|
||||
db << "CREATE TABLE person (id integer primary key not null, name TEXT not null);";
|
||||
|
||||
try {
|
||||
auto stmt = db << "INSERT INTO person (id,name) VALUES (?,?)";
|
||||
throw 1;
|
||||
} catch (int) { }
|
||||
|
||||
int count;
|
||||
db << "select count(*) from person" >> count;
|
||||
REQUIRE(count == 0);
|
||||
}
|
||||
Reference in New Issue
Block a user