@@ -679,6 +679,31 @@ BOOST_AUTO_TEST_CASE(noto_migrations_apply_validate_and_rollback) {
|
||||
BOOST_TEST(static_cast<std::bool_t>(missing->rows.empty()));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(noto_direct_and_prepared_queries_share_limits_and_binding_rules) {
|
||||
auto io = boost::asio::io_context{};
|
||||
auto connection = noto::connection{io.get_executor(), noto::memory_connection_config()};
|
||||
BOOST_REQUIRE(run(io, connection.async_connect()));
|
||||
auto sql = std::string{"SELECT ? AS value UNION ALL SELECT 'second'"};
|
||||
auto statement = run(io, connection.async_prepare(sql));
|
||||
BOOST_REQUIRE(statement);
|
||||
for (auto limit : {std::size_t{0}, std::size_t{1}, std::size_t{8}, std::size_t{100}}) {
|
||||
auto options = noto::execute_options{};
|
||||
options.max_result_bytes = limit;
|
||||
auto direct = run(io, connection.async_execute(sql, {"first"}, options));
|
||||
auto reusable = run(io, statement->async_execute({"first"}, options));
|
||||
BOOST_REQUIRE(direct.has_value() == reusable.has_value());
|
||||
if (!direct) {
|
||||
BOOST_TEST(direct.error().code() == reusable.error().code());
|
||||
}
|
||||
auto recovered = run(io, statement->async_execute({"replacement"}));
|
||||
BOOST_REQUIRE(recovered);
|
||||
BOOST_TEST(recovered->rows.size() == 2U);
|
||||
BOOST_TEST(std::get<std::string>(recovered->rows[0][0].value) == "replacement");
|
||||
}
|
||||
BOOST_REQUIRE(run(io, statement->async_finalize()));
|
||||
BOOST_REQUIRE(run(io, connection.async_close()));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(noto_backup_export_integrity_and_pragmas_work) {
|
||||
auto io = boost::asio::io_context{};
|
||||
auto source_path = temp_database_path("source");
|
||||
|
||||
Reference in New Issue
Block a user