mirror of
https://github.com/ikawrakow/ik_llama.cpp.git
synced 2026-03-05 19:40:19 +00:00
24 lines
580 B
C++
24 lines
580 B
C++
#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);
|
|
}
|