File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -295,26 +295,32 @@ namespace sqlite {
295295 public:
296296 value_type (database_binder *_binder): _binder(_binder) {};
297297 template <class T >
298- value_type &operator >>(T &result) {
298+ typename std::enable_if<database_binder::is_sqlite_value<T>::value, value_type &>::type operator >>(T &result) {
299299 get_col_from_db (*_binder, next_index++, result);
300300 return *this ;
301301 }
302+ template <class T , typename = typename std::enable_if<database_binder::is_sqlite_value<T>::value, value_type &>::type>
303+ operator T () {
304+ T result;
305+ *this >> result;
306+ return result;
307+ }
302308 template <class ...Types>
303309 value_type &operator >>(std::tuple<Types...>& values) {
304310 assert (!next_index);
305311 tuple_iterate<std::tuple<Types...>>::iterate(values, *_binder);
306312 next_index = sizeof ...(Types) + 1 ;
307313 return *this ;
308314 }
309- explicit operator bool () {
310- return sqlite3_column_count (_binder->_stmt .get ()) >= next_index;
311- }
312- template <class Type >
313- operator Type () {
314- Type value;
315+ template <class ...Types>
316+ operator std::tuple<Types...>() {
317+ std::tuple<Types...> value;
315318 *this >> value;
316319 return value;
317320 }
321+ explicit operator bool () {
322+ return sqlite3_column_count (_binder->_stmt .get ()) >= next_index;
323+ }
318324 private:
319325 database_binder *_binder;
320326 int next_index = 0 ;
@@ -342,7 +348,6 @@ namespace sqlite {
342348 _binder = nullptr ;
343349 break ;
344350 default :
345- _binder = nullptr ;
346351 exceptions::throw_sqlite_error (result, _binder->sql ());
347352 }
348353 return *this ;
You can’t perform that action at this time.
0 commit comments