mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Fixed a bunch of bugs that came up when integrating with mySQL again.
Thanks Matthijs!
This commit is contained in:
parent
04aab4d79b
commit
1d82cf7f09
@ -29,6 +29,7 @@
|
||||
|
||||
#include <sqlpp11/type_traits.h>
|
||||
#include <sqlpp11/interpret_tuple.h>
|
||||
#include <sqlpp11/basic_expression_operators.h>
|
||||
#include <sqlpp11/detail/logic.h>
|
||||
|
||||
namespace sqlpp
|
||||
|
@ -101,7 +101,7 @@ namespace sqlpp
|
||||
template<typename Container>
|
||||
struct value_list_t // to be used in .in() method
|
||||
{
|
||||
using _traits = make_traits<value_type_t<typename Container::value_type>>;
|
||||
using _traits = make_traits<value_type_t<typename Container::value_type>, ::sqlpp::tag::expression>;
|
||||
using _recursive_traits = make_recursive_traits<>;
|
||||
|
||||
using _container_t = Container;
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <sqlpp11/interpret_tuple.h>
|
||||
#include <sqlpp11/insert_value.h>
|
||||
#include <sqlpp11/simple_column.h>
|
||||
#include <sqlpp11/no_data.h>
|
||||
|
||||
namespace sqlpp
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ namespace sqlpp
|
||||
_statement_t::_check_consistency();
|
||||
|
||||
static_assert(_statement_t::_get_static_no_of_parameters() == 0, "cannot run insert directly with parameters, use prepare instead");
|
||||
return db.insert(*this);
|
||||
return db.insert(_get_statement());
|
||||
}
|
||||
|
||||
template<typename Db>
|
||||
@ -122,7 +122,7 @@ namespace sqlpp
|
||||
{
|
||||
_statement_t::_check_consistency();
|
||||
|
||||
return {{}, db.prepare_insert(*this)};
|
||||
return {{}, db.prepare_insert(_get_statement())};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -35,7 +35,7 @@ namespace sqlpp
|
||||
template<typename Db, typename Insert>
|
||||
struct prepared_insert_t
|
||||
{
|
||||
using _parameter_list_t = typename Insert::_parameter_list_t;
|
||||
using _parameter_list_t = make_parameter_list_t<Insert>;
|
||||
using _prepared_statement_t = typename Db::_prepared_statement_t;
|
||||
|
||||
auto _run(Db& db) const
|
||||
|
@ -35,7 +35,7 @@ namespace sqlpp
|
||||
template<typename Db, typename Remove>
|
||||
struct prepared_remove_t
|
||||
{
|
||||
using _parameter_list_t = typename Remove::_parameter_list_t;
|
||||
using _parameter_list_t = make_parameter_list_t<Remove>;
|
||||
using _prepared_statement_t = typename Db::_prepared_statement_t;
|
||||
|
||||
auto _run(Db& db) const
|
||||
|
@ -36,7 +36,7 @@ namespace sqlpp
|
||||
struct prepared_select_t
|
||||
{
|
||||
using _result_row_t = typename Select::template _result_row_t<Database>;
|
||||
using _parameter_list_t = parameters_of<Select>;
|
||||
using _parameter_list_t = make_parameter_list_t<Select>;
|
||||
using _dynamic_names_t = typename Select::_dynamic_names_t;
|
||||
using _prepared_statement_t = typename Database::_prepared_statement_t;
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace sqlpp
|
||||
template<typename Db, typename Update>
|
||||
struct prepared_update_t
|
||||
{
|
||||
using _parameter_list_t = typename Update::_parameter_list_t;
|
||||
using _parameter_list_t = make_parameter_list_t<Update>;
|
||||
using _prepared_statement_t = typename Db::_prepared_statement_t;
|
||||
|
||||
auto _run(Db& db) const
|
||||
|
@ -62,7 +62,7 @@ namespace sqlpp
|
||||
_statement_t::_check_consistency();
|
||||
|
||||
static_assert(_statement_t::_get_static_no_of_parameters() == 0, "cannot run remove directly with parameters, use prepare instead");
|
||||
return db.remove(*this);
|
||||
return db.remove(_get_statement());
|
||||
}
|
||||
|
||||
template<typename Db>
|
||||
@ -71,7 +71,7 @@ namespace sqlpp
|
||||
{
|
||||
_statement_t::_check_consistency();
|
||||
|
||||
return {{}, db.prepare_remove(*this)};
|
||||
return {{}, db.prepare_remove(_get_statement())};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -299,7 +299,7 @@ namespace sqlpp
|
||||
{
|
||||
_statement_t::_check_consistency();
|
||||
|
||||
return {{}, get_dynamic_names(), db.prepare_select(*this)};
|
||||
return {{}, get_dynamic_names(), db.prepare_select(_get_statement())};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -132,7 +132,7 @@ namespace sqlpp
|
||||
_check_consistency();
|
||||
|
||||
static_assert(_get_static_no_of_parameters() == 0, "cannot run insert directly with parameters, use prepare instead");
|
||||
return db.insert(*this);
|
||||
return db.insert(_get_statement());
|
||||
}
|
||||
|
||||
template<typename Db>
|
||||
@ -141,7 +141,7 @@ namespace sqlpp
|
||||
{
|
||||
_check_consistency();
|
||||
|
||||
return {{}, db.prepare_insert(*this)};
|
||||
return {{}, db.prepare_insert(_get_statement())};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -28,6 +28,7 @@
|
||||
#define SQLPP_SORT_ORDER_H
|
||||
|
||||
#include <sqlpp11/detail/type_set.h>
|
||||
#include <sqlpp11/no_value.h>
|
||||
|
||||
namespace sqlpp
|
||||
{
|
||||
|
@ -90,6 +90,7 @@ int main()
|
||||
{
|
||||
auto s = select(all_of(t)).from(t).where(t.beta.like(parameter(t.beta)) and t.alpha == parameter(t.alpha) or t.gamma != parameter(t.gamma));
|
||||
auto p = db.prepare(s);
|
||||
p.params.alpha = 7;
|
||||
using S = decltype(s);
|
||||
using T = sqlpp::make_parameter_list_t<S>;
|
||||
T npl;
|
||||
|
Loading…
Reference in New Issue
Block a user