Problem:
executed on an empty table bulk select operation returns a vector with size 1 if called with a vector with size 1.
What I expect:
The table is empty so the vector should have a size of 0 after executing the select statement.
Additional Information (works if I pass a vector with size 2)
executed on an empty table bulk select operation returns a vector with size 0 if called with a vector with size 2.
How to reproduce:
run this catch2 test
TEST_CASE ("bulk operation", "[soci]")
{
using namespace sqlite_api;
if (not std::filesystem::exists ("test_db"))
{
sqlite3 *db{};
int rc{};
rc = sqlite3_open ("test_db", &db);
if (rc)
{
fprintf (stderr, "Can't open database: %s\n", sqlite3_errmsg (db));
return;
}
sqlite3_close (db);
soci::session sql (soci::sqlite3, "test_db");
sql << "create table test1 ("
" id integer,"
")";
}
soci::session sql (soci::sqlite3, "test_db");
int count;
sql << "select count(*) from test1", soci::into (count);
CHECK (count == 0);
auto vec1 = std::vector<int> (1);
sql << "SELECT id FROM test1", soci::into (vec1);
CHECK (vec1.empty ());
auto vec2 = std::vector<int> (2);
sql << "SELECT id FROM test1", soci::into (vec2);
CHECK (vec2.empty ());
}