summaryrefslogtreecommitdiff
path: root/libdbpp/selectcommandUtil.impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'libdbpp/selectcommandUtil.impl.h')
-rw-r--r--libdbpp/selectcommandUtil.impl.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/libdbpp/selectcommandUtil.impl.h b/libdbpp/selectcommandUtil.impl.h
index 26e9635..4c0e035 100644
--- a/libdbpp/selectcommandUtil.impl.h
+++ b/libdbpp/selectcommandUtil.impl.h
@@ -30,6 +30,75 @@ namespace DB {
forEachField<std::tuple<Fn...>, Func, 0>(this, func);
}
}
+
+ template<typename ... Fn>
+ inline RowRange<Fn...> SelectCommand::as()
+ {
+ return RowRange<Fn...>(this);
+ }
+
+ template<typename ... Fn>
+ inline RowRange<Fn...>::RowRange(SelectCommand * s) :
+ sel(s)
+ {
+ }
+
+ template<typename ... Fn>
+ inline RowRangeIterator<Fn...> RowRange<Fn...>::begin() const
+ {
+ return RowRangeIterator<Fn...>(sel);
+ }
+
+ template<typename ... Fn>
+ inline RowRangeIterator<Fn...> RowRange<Fn...>::end() const
+ {
+ return RowRangeIterator<Fn...>(nullptr);
+ }
+
+ template<typename ... Fn>
+ inline RowRangeIterator<Fn...>::RowRangeIterator(SelectCommand * s) :
+ sel(s)
+ {
+ if (sel) {
+ validRow = sel->fetch();
+ }
+ else {
+ validRow = false;
+ }
+ }
+
+ template<typename ... Fn>
+ inline bool RowRangeIterator<Fn...>::operator!=(const RowRangeIterator &) const
+ {
+ return validRow;
+ }
+
+ template<typename ... Fn>
+ inline void RowRangeIterator<Fn...>::operator++()
+ {
+ validRow = sel->fetch();
+ }
+
+ template<typename ... Fn>
+ inline Row<Fn...> RowRangeIterator<Fn...>::operator*() const
+ {
+ return Row<Fn...>(sel);
+ }
+
+ template<typename ... Fn>
+ inline Row<Fn...>::Row(SelectCommand * s) :
+ RowBase(s)
+ {
+ }
+
+ template<typename ... Fn>
+ template<unsigned int C>
+ inline typename std::tuple_element<C, std::tuple<Fn...>>::type Row<Fn...>::value() const
+ {
+ typename std::tuple_element<C, std::tuple<Fn...>>::type a;
+ sel->operator[](C) >> a;
+ return a;
+ }
}
/// @endcond