0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-15 20:31:16 +08:00

Merge tag '0.55' into develop

Multiple new data types (ddl2cpp) and a couple of small fixes
This commit is contained in:
rbock 2018-06-01 09:59:35 +02:00
commit 517f31348e
17 changed files with 59 additions and 60 deletions

View File

@ -53,5 +53,5 @@ namespace sqlpp
concat_t<Column, wrap_operand_t<T>>{*static_cast<const Column*>(this), rhs{t}}};
}
};
}
} // namespace sqlpp
#endif

View File

@ -45,5 +45,5 @@ namespace sqlpp
using blob = blob;
using mediumblob = blob;
}
} // namespace sqlpp
#endif

View File

@ -90,5 +90,5 @@ namespace sqlpp
return context;
}
};
}
} // namespace sqlpp
#endif

View File

@ -49,5 +49,5 @@ namespace sqlpp
target._bind_blob_parameter(index, &_value, _is_null);
}
};
}
} // namespace sqlpp
#endif

View File

@ -79,5 +79,5 @@ namespace sqlpp
return os << e.value();
}
}
}
} // namespace sqlpp
#endif

View File

@ -47,5 +47,5 @@ namespace sqlpp
{
using type = blob_operand;
};
}
} // namespace sqlpp
#endif

View File

@ -39,6 +39,6 @@ namespace sqlpp
};
template <typename T, typename Defer>
using return_type_like_t = typename return_type_like<T, Defer>::type;
}
} // namespace sqlpp
#endif

View File

@ -140,21 +140,25 @@ namespace sqlpp
std::tuple<rhs_t<Assignments>...> _values;
interpretable_list_t<Database> _dynamic_columns;
interpretable_list_t<Database> _dynamic_values;
private:
template <size_t... Indexes>
auto columns_from_tuple( detail::index_sequence<Indexes... >, std::tuple<Assignments ...> assignments ) -> decltype (_columns)
auto columns_from_tuple(detail::index_sequence<Indexes...>, std::tuple<Assignments...> assignments)
-> decltype(_columns)
{
(void)assignments;
return decltype(_columns)(std::get<Indexes>(assignments)._lhs...);
}
auto columns_from_tuple(std::tuple<Assignments ...> assignments) -> decltype (_columns) {
auto columns_from_tuple(std::tuple<Assignments...> assignments) -> decltype(_columns)
{
const auto seq = detail::make_index_sequence<sizeof...(Assignments)>{};
return columns_from_tuple(seq, assignments);
}
template <size_t... Indexes>
auto values_from_tuple( detail::index_sequence<Indexes... >, std::tuple<Assignments ...> assignments ) -> decltype(_values)
auto values_from_tuple(detail::index_sequence<Indexes...>, std::tuple<Assignments...> assignments)
-> decltype(_values)
{
(void)assignments;
return decltype(_values)(std::get<Indexes>(assignments)._rhs...);

View File

@ -74,6 +74,14 @@ def repl_func_for_args(m):
else:
return m.group(1) + m.group(2).upper()
def toClassName(s):
return re.sub("(^|\s|[_0-9])(\S)", repl_func, s)
def toMemberName(s):
return re.sub("(\s|_|[0-9])(\S)", repl_func, s)
def setArgumentBool(s, bool_value):
first_lower = lambda s: s[:1].lower() + s[1:] if s else '' # http://stackoverflow.com/a/3847369/5006740
var_name = first_lower(re.sub("(\s|-|[0-9])(\S)", repl_func_for_args, s))

View File

@ -50,7 +50,7 @@ namespace
{
return std::vector<std::uint8_t>(s.begin(), s.end());
}
}
} // namespace
int Blob(int, char*[])
{

View File

@ -71,9 +71,7 @@ int Insert(int, char* [])
db(multi_insert);
auto values=[&t](){
return std::make_tuple(t.gamma = true, t.delta = sqlpp::tvin(0));
};
auto values = [&t]() { return std::make_tuple(t.gamma = true, t.delta = sqlpp::tvin(0)); };
db(insert_into(t).set(t.gamma = true, t.delta = sqlpp::verbatim<sqlpp::integer>("17+4")));
db(insert_into(t).set(t.gamma = true, t.delta = sqlpp::null));

View File

@ -292,7 +292,6 @@ struct MockDbT : public sqlpp::connection
using MockDb = MockDbT<false>;
using EnforceDb = MockDbT<true>;
struct MockSizeDb : public sqlpp::connection
{
using _traits = MockDb::_traits;
@ -323,7 +322,10 @@ struct MockSizeDb : public sqlpp::connection
class result_t : public MockDb::result_t
{
public:
size_t size() const { return 0; }
size_t size() const
{
return 0;
}
};
// Directly executed statements start here

View File

@ -79,24 +79,13 @@ int Ppgen(int, char* [])
db(insert_into(f).default_values());
auto i = insert_into(p).columns(p.name, p.feature, p.age, p.level);
i.values.add(p.name = "Roland"
, p.feature = 1
, p.age = static_cast<unsigned int>(32)
, p.level = 3.14);
i.values.add(p.name = "Zaphod"
, p.feature = sqlpp::default_value
, p.age = static_cast<unsigned int>(16)
, p.level = 3.14*2);
i.values.add(p.name = "Roland", p.feature = 1, p.age = static_cast<unsigned int>(32), p.level = 3.14);
i.values.add(p.name = "Zaphod", p.feature = sqlpp::default_value, p.age = static_cast<unsigned int>(16),
p.level = 3.14 * 2);
db(i);
auto pi = db.prepare(
insert_into(p).set(
p.name = parameter(f.name)
,p.feature = parameter(p.feature)
,p.age = parameter(p.age)
,p.level = parameter(p.level)
)
);
auto pi = db.prepare(insert_into(p).set(p.name = parameter(f.name), p.feature = parameter(p.feature),
p.age = parameter(p.age), p.level = parameter(p.level)));
pi.params.name = "likes java";
pi.params.feature = 2;
pi.params.age = 21;

View File

@ -119,7 +119,7 @@ namespace test
};
using _traits = sqlpp::make_traits<sqlpp::blob, sqlpp::tag::can_be_null>;
};
}
} // namespace TabFoo_
struct TabFoo : sqlpp::table_t<TabFoo, TabFoo_::Delta, TabFoo_::Epsilon, TabFoo_::Omega, TabFoo_::Psi, TabFoo_::Book>
{
@ -233,7 +233,7 @@ namespace test
};
using _traits = sqlpp::make_traits<sqlpp::integer, sqlpp::tag::can_be_null>;
};
}
} // namespace TabBar_
struct TabBar : sqlpp::table_t<TabBar, TabBar_::Alpha, TabBar_::Beta, TabBar_::Gamma, TabBar_::Delta>
{
@ -326,7 +326,7 @@ namespace test
};
using _traits = sqlpp::make_traits<sqlpp::time_of_day, sqlpp::tag::can_be_null>;
};
}
} // namespace TabDateTime_
struct TabDateTime
: sqlpp::table_t<TabDateTime, TabDateTime_::ColDayPoint, TabDateTime_::ColTimePoint, TabDateTime_::ColTimeOfDay>
@ -350,5 +350,5 @@ namespace test
};
};
};
}
} // namespace test
#endif

View File

@ -63,9 +63,7 @@ int Update(int, char* [])
db(u);
auto values=[&t](){
return std::make_tuple(t.delta += t.alpha, t.beta = "no cake this time");
};
auto values = [&t]() { return std::make_tuple(t.delta += t.alpha, t.beta = "no cake this time"); };
db(update(t).set(t.delta = sqlpp::verbatim<sqlpp::integer>("17+4")).unconditionally());
db(update(t).set(t.delta = sqlpp::null).unconditionally());