moved parameter_binder from member to parameter to bind, execute and fetch methods
This commit is contained in:
@@ -17,12 +17,12 @@ TEST_CASE("Test statement cache", "[statement][cache]") {
|
||||
backend_provider::instance().register_backend("noop", std::make_unique<orm::test_backend_service>());
|
||||
|
||||
connection_pool pool("noop://noop.db", 4);
|
||||
statement_cache cache(pool, 4);
|
||||
statement_cache cache(pool, 2);
|
||||
|
||||
query_context ctx;
|
||||
ctx.sql = "SELECT * FROM person";
|
||||
|
||||
REQUIRE(cache.capacity() == 4);
|
||||
REQUIRE(cache.capacity() == 2);
|
||||
REQUIRE(cache.empty());
|
||||
|
||||
auto result = cache.acquire(ctx);
|
||||
@@ -30,7 +30,25 @@ TEST_CASE("Test statement cache", "[statement][cache]") {
|
||||
|
||||
REQUIRE(cache.size() == 1);
|
||||
REQUIRE(!cache.empty());
|
||||
REQUIRE(cache.capacity() == 4);
|
||||
REQUIRE(cache.capacity() == 2);
|
||||
|
||||
const auto stmt = result.value();
|
||||
|
||||
ctx.sql = "SELECT title FROM book";
|
||||
|
||||
result = cache.acquire(ctx);
|
||||
REQUIRE(result);
|
||||
|
||||
REQUIRE(cache.size() == 2);
|
||||
REQUIRE(!cache.empty());
|
||||
REQUIRE(cache.capacity() == 2);
|
||||
|
||||
ctx.sql = "SELECT name FROM author";
|
||||
|
||||
result = cache.acquire(ctx);
|
||||
REQUIRE(result);
|
||||
|
||||
REQUIRE(cache.size() == 2);
|
||||
REQUIRE(!cache.empty());
|
||||
REQUIRE(cache.capacity() == 2);
|
||||
}
|
||||
Reference in New Issue
Block a user