From 6e55f8f6cd4dbb7775837168c9f96714578ae789 Mon Sep 17 00:00:00 2001 From: rbock Date: Wed, 22 Jan 2014 18:35:08 +0100 Subject: [PATCH] Fixed a few bugs found during mysql tests --- include/sqlpp11/insert.h | 7 ++----- include/sqlpp11/join.h | 1 + include/sqlpp11/select.h | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/sqlpp11/insert.h b/include/sqlpp11/insert.h index ecc57b47..0ca58d1e 100644 --- a/include/sqlpp11/insert.h +++ b/include/sqlpp11/insert.h @@ -57,7 +57,7 @@ namespace sqlpp -> use_default_values_t { static_assert(std::is_same::value, "cannot call default_values() after set() or default_values()"); - // FIXME: Need to check if all required columns are set + static_assert(Table::_required_insert_columns::size::value == 0, "cannot use default_values, because some columns are configured to require values"); return { _table, {}, @@ -110,10 +110,7 @@ namespace sqlpp template std::size_t run(Db& db) const { - // FIXME: check if set or default_values() has ben called - constexpr bool calledSet = not vendor::is_noop::value; - constexpr bool requireSet = Table::_required_insert_columns::size::value > 0; - static_assert(calledSet or not requireSet, "calling set() required for given table"); + static_assert(not vendor::is_noop::value, "calling set() or default_values()"); static_assert(_get_static_no_of_parameters() == 0, "cannot run insert directly with parameters, use prepare instead"); return db.insert(*this); } diff --git a/include/sqlpp11/join.h b/include/sqlpp11/join.h index c3c84299..39a2c214 100644 --- a/include/sqlpp11/join.h +++ b/include/sqlpp11/join.h @@ -156,6 +156,7 @@ namespace sqlpp context << " JOIN "; context << "("; interpret(t._rhs, context); + context << ")"; interpret(t._on, context); return context; } diff --git a/include/sqlpp11/select.h b/include/sqlpp11/select.h index 40c90ff9..d41bd9fd 100644 --- a/include/sqlpp11/select.h +++ b/include/sqlpp11/select.h @@ -595,7 +595,7 @@ namespace sqlpp const typename ColumnList::_dynamic_names_t& get_dynamic_names() const { - return _columns._dynamic_expressions._dynamic_expression_names; + return _columns._dynamic_columns._dynamic_expression_names; } static constexpr size_t _get_static_no_of_parameters()