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 @@ -276,26 +276,32 @@ namespace sqlite {
276276 public:
277277 value_type (database_binder *_binder): _binder(_binder) {};
278278 template <class T >
279- value_type &operator >>(T &result) {
279+ typename std::enable_if<database_binder::is_sqlite_value<T>::value, value_type &>::type operator >>(T &result) {
280280 get_col_from_db (*_binder, next_index++, result);
281281 return *this ;
282282 }
283+ template <class T , typename = typename std::enable_if<database_binder::is_sqlite_value<T>::value, value_type &>::type>
284+ operator T () {
285+ T result;
286+ *this >> result;
287+ return result;
288+ }
283289 template <class ...Types>
284290 value_type &operator >>(std::tuple<Types...>& values) {
285291 assert (!next_index);
286292 tuple_iterate<std::tuple<Types...>>::iterate(values, *_binder);
287293 next_index = sizeof ...(Types) + 1 ;
288294 return *this ;
289295 }
290- explicit operator bool () {
291- return sqlite3_column_count (_binder->_stmt .get ()) >= next_index;
292- }
293- template <class Type >
294- operator Type () {
295- Type value;
296+ template <class ...Types>
297+ operator std::tuple<Types...>() {
298+ std::tuple<Types...> value;
296299 *this >> value;
297300 return value;
298301 }
302+ explicit operator bool () {
303+ return sqlite3_column_count (_binder->_stmt .get ()) >= next_index;
304+ }
299305 private:
300306 database_binder *_binder;
301307 int next_index = 0 ;
@@ -323,7 +329,6 @@ namespace sqlite {
323329 _binder = nullptr ;
324330 break ;
325331 default :
326- _binder = nullptr ;
327332 exceptions::throw_sqlite_error (result, _binder->sql ());
328333 }
329334 return *this ;
You can’t perform that action at this time.
0 commit comments