mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-01-06 05:00:37 -06:00
Add size() function to mysql::char_result_t #562
This commit is contained in:
@@ -68,6 +68,11 @@ namespace sqlpp
|
|||||||
return _handle == rhs._handle;
|
return _handle == rhs._handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t size() const
|
||||||
|
{
|
||||||
|
return _handle ? mysql_num_rows(_handle->mysql_res) : size_t{};
|
||||||
|
}
|
||||||
|
|
||||||
template <typename ResultRow>
|
template <typename ResultRow>
|
||||||
void next(ResultRow& result_row)
|
void next(ResultRow& result_row)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -107,6 +107,10 @@ int Select(int, char*[])
|
|||||||
db(insert_into(tab).set(tab.gamma = true, tab.beta = "cheesecake"));
|
db(insert_into(tab).set(tab.gamma = true, tab.beta = "cheesecake"));
|
||||||
testSelectAll(db, 3);
|
testSelectAll(db, 3);
|
||||||
|
|
||||||
|
// Test size functionality
|
||||||
|
const auto test_size = db(select(all_of(tab)).from(tab).unconditionally());
|
||||||
|
assert(test_size.size() == 3ull);
|
||||||
|
|
||||||
// test functions and operators
|
// test functions and operators
|
||||||
db(select(all_of(tab)).from(tab).where(tab.alpha.is_null()));
|
db(select(all_of(tab)).from(tab).where(tab.alpha.is_null()));
|
||||||
db(select(all_of(tab)).from(tab).where(tab.alpha.is_not_null()));
|
db(select(all_of(tab)).from(tab).where(tab.alpha.is_not_null()));
|
||||||
|
|||||||
Reference in New Issue
Block a user