mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Allow non-zero start values for dynamic limit and offset
This commit is contained in:
parent
8d12d23d67
commit
6f780a9542
@ -52,16 +52,6 @@ namespace sqlpp
|
||||
using _is_limit = std::true_type;
|
||||
using _is_dynamic = std::true_type;
|
||||
|
||||
dynamic_limit_t():
|
||||
_limit(0)
|
||||
{}
|
||||
|
||||
dynamic_limit_t(const dynamic_limit_t&) = default;
|
||||
dynamic_limit_t(dynamic_limit_t&&) = default;
|
||||
dynamic_limit_t& operator=(const dynamic_limit_t&) = default;
|
||||
dynamic_limit_t& operator=(dynamic_limit_t&&) = default;
|
||||
~dynamic_limit_t() = default;
|
||||
|
||||
void set(std::size_t limit)
|
||||
{
|
||||
_limit = limit;
|
||||
@ -75,7 +65,7 @@ namespace sqlpp
|
||||
os << " LIMIT " << _limit;
|
||||
}
|
||||
|
||||
std::size_t _limit = 0;
|
||||
std::size_t _limit;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -51,15 +51,6 @@ namespace sqlpp
|
||||
using _is_offset = std::true_type;
|
||||
using _is_dynamic = std::true_type;
|
||||
|
||||
dynamic_offset_t():
|
||||
_offset(0)
|
||||
{}
|
||||
dynamic_offset_t(const dynamic_offset_t&) = default;
|
||||
dynamic_offset_t(dynamic_offset_t&&) = default;
|
||||
dynamic_offset_t& operator=(const dynamic_offset_t&) = default;
|
||||
dynamic_offset_t& operator=(dynamic_offset_t&&) = default;
|
||||
~dynamic_offset_t() = default;
|
||||
|
||||
void set(std::size_t offset)
|
||||
{
|
||||
_offset = offset;
|
||||
@ -72,7 +63,7 @@ namespace sqlpp
|
||||
os << " OFFSET " << _offset;
|
||||
}
|
||||
|
||||
std::size_t _offset = 0;
|
||||
std::size_t _offset;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ namespace sqlpp
|
||||
};
|
||||
}
|
||||
|
||||
auto dynamic_limit()
|
||||
auto dynamic_limit(std::size_t limit = 0)
|
||||
->set_limit_t<dynamic_limit_t>
|
||||
{
|
||||
static_assert(not is_noop<From>::value, "cannot call limit() without a from()");
|
||||
@ -467,7 +467,7 @@ namespace sqlpp
|
||||
_group_by,
|
||||
_having,
|
||||
_order_by,
|
||||
{},
|
||||
{limit},
|
||||
_offset,
|
||||
};
|
||||
}
|
||||
@ -499,7 +499,7 @@ namespace sqlpp
|
||||
};
|
||||
}
|
||||
|
||||
auto dynamic_offset()
|
||||
auto dynamic_offset(std::size_t offset = 0)
|
||||
-> set_offset_t<dynamic_offset_t>
|
||||
{
|
||||
static_assert(not is_noop<Limit>::value, "cannot call offset() without a limit");
|
||||
@ -513,7 +513,7 @@ namespace sqlpp
|
||||
_having,
|
||||
_order_by,
|
||||
_limit,
|
||||
{},
|
||||
{offset},
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user