diff options
Diffstat (limited to 'libdbpp/selectcommandUtil.impl.h')
-rw-r--r-- | libdbpp/selectcommandUtil.impl.h | 66 |
1 files changed, 32 insertions, 34 deletions
diff --git a/libdbpp/selectcommandUtil.impl.h b/libdbpp/selectcommandUtil.impl.h index b8f62e5..ec1d56a 100644 --- a/libdbpp/selectcommandUtil.impl.h +++ b/libdbpp/selectcommandUtil.impl.h @@ -6,9 +6,9 @@ /// @cond namespace DB { - template<typename Fields, typename Func, unsigned int field, typename ... Fn, typename ... Args> + template<typename Fields, typename Func, unsigned int field, typename... Fn, typename... Args> inline void - forEachField(DB::SelectCommand * sel, const Func & func, const Args & ... args) + forEachField(DB::SelectCommand * sel, const Func & func, const Args &... args) { if constexpr (field >= std::tuple_size<Fields>::value) { (void)sel; @@ -21,41 +21,39 @@ namespace DB { } } - template<typename ... Fn, typename Func> - inline void SelectCommand::forEachRow(const Func & func) + template<typename... Fn, typename Func> + inline void + SelectCommand::forEachRow(const Func & func) { while (fetch()) { forEachField<std::tuple<Fn...>, Func, 0>(this, func); } } - template<typename ... Fn> - inline RowRange<Fn...> SelectCommand::as() + 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 RowRange<Fn...>::RowRange(SelectCommand * s) : sel(s) { } - template<typename ... Fn> - inline RowRangeIterator<Fn...> RowRange<Fn...>::begin() const + template<typename... Fn> + inline RowRangeIterator<Fn...> + RowRange<Fn...>::begin() const { return RowRangeIterator<Fn...>(sel); } - template<typename ... Fn> - inline RowRangeIterator<Fn...> RowRange<Fn...>::end() const + 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) + template<typename... Fn> inline RowRangeIterator<Fn...>::RowRangeIterator(SelectCommand * s) : sel(s) { if (sel) { validRow = sel->fetch(); @@ -65,40 +63,41 @@ namespace DB { } } - template<typename ... Fn> - inline bool RowRangeIterator<Fn...>::operator!=(const RowRangeIterator &) const + template<typename... Fn> + inline bool + RowRangeIterator<Fn...>::operator!=(const RowRangeIterator &) const { return validRow; } - template<typename ... Fn> - inline void RowRangeIterator<Fn...>::operator++() + template<typename... Fn> + inline void + RowRangeIterator<Fn...>::operator++() { validRow = sel->fetch(); } - template<typename ... Fn> - inline Row<Fn...> RowRangeIterator<Fn...>::operator*() const + 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> inline Row<Fn...>::Row(SelectCommand * s) : RowBase(s) { } - template<typename ... Fn> + template<typename... Fn> template<unsigned int C> - inline typename Row<Fn...>::template FieldType<C> Row<Fn...>::value() const + inline typename Row<Fn...>::template FieldType<C> + Row<Fn...>::value() const { return get<C>(); } - template<typename ... Fn> + template<typename... Fn> template<unsigned int C> - inline typename Row<Fn...>::template FieldType<C> Row<Fn...>::get() const + inline typename Row<Fn...>::template FieldType<C> + Row<Fn...>::get() const { FieldType<C> a; sel->operator[](C) >> a; @@ -108,4 +107,3 @@ namespace DB { /// @endcond #endif - |