From b89e4c3e4fcaadf166b7db38ec8a42aab9889e92 Mon Sep 17 00:00:00 2001 From: rbock Date: Sun, 27 Dec 2015 22:25:05 +0100 Subject: [PATCH] Fixed a bunch of missing initializations --- examples/insert.cpp | 6 +++--- examples/ppgen.cpp | 6 +++--- examples/remove.cpp | 6 +++--- examples/sample.cpp | 6 +++--- examples/select.cpp | 8 +++++--- examples/update.cpp | 5 ++--- test_constraints/count_of_count.cpp | 2 +- test_constraints/max_of_max.cpp | 2 +- test_constraints/must_not_insert.cpp | 2 +- test_constraints/must_not_update.cpp | 2 +- .../no_conversion_operator_if_null_not_trivial.cpp | 2 +- test_constraints/require_insert.cpp | 2 +- tests/BooleanExpression.cpp | 2 +- tests/CustomQuery.cpp | 6 +++--- tests/DateTime.cpp | 4 ++-- tests/Function.cpp | 4 ++-- tests/Insert.cpp | 6 +++--- tests/Interpret.cpp | 6 +++--- tests/Prepared.cpp | 2 +- tests/Remove.cpp | 6 +++--- tests/Result.cpp | 2 +- tests/Select.cpp | 6 +++--- tests/SelectType.cpp | 8 ++++---- tests/Union.cpp | 6 +++--- tests/Update.cpp | 5 ++--- tests/With.cpp | 2 +- 26 files changed, 57 insertions(+), 57 deletions(-) diff --git a/examples/insert.cpp b/examples/insert.cpp index ab3d0bdb..be067815 100644 --- a/examples/insert.cpp +++ b/examples/insert.cpp @@ -29,10 +29,10 @@ int insert(int, char**) { - MockDb db; + MockDb db{}; - test::TabPerson p; - test::TabFeature f; + const auto p = test::TabPerson{}; + const auto f = test::TabFeature{}; db(insert_into(f).set(f.name = "loves c++", f.fatal = false)); diff --git a/examples/ppgen.cpp b/examples/ppgen.cpp index 56374a22..eeaa13e2 100644 --- a/examples/ppgen.cpp +++ b/examples/ppgen.cpp @@ -65,9 +65,9 @@ SQLPP_DECLARE_TABLE( int ppgen(int, char**) { - MockDb db; - tab_person::tab_person p; - tab_feature::tab_feature f; + MockDb db{}; + const auto p = tab_person::tab_person{}; + const auto f = tab_feature::tab_feature{}; db(insert_into(f).set(f.name = "loves c++", f.fatal = false)); diff --git a/examples/remove.cpp b/examples/remove.cpp index c2b41b1d..98e7727c 100644 --- a/examples/remove.cpp +++ b/examples/remove.cpp @@ -29,10 +29,10 @@ int remove(int, char**) { - MockDb db; + MockDb db{}; - test::TabPerson p; - test::TabFeature q; + const auto p = test::TabPerson{}; + const auto q = test::TabFeature{}; db(remove_from(p).using_(p, q).where(p.feature == q.id and q.fatal == true)); return 0; diff --git a/examples/sample.cpp b/examples/sample.cpp index e506f443..c356b8ec 100644 --- a/examples/sample.cpp +++ b/examples/sample.cpp @@ -29,10 +29,10 @@ int main() { - MockDb db; + MockDb db{}; - test::TabPerson p; - test::TabFeature f; + const auto p = test::TabPerson{}; + const auto f = test::TabFeature{}; db(insert_into(f).set(f.name = "Loves C++", p.fatal = false)); diff --git a/examples/select.cpp b/examples/select.cpp index 77265d99..7e89a9be 100644 --- a/examples/select.cpp +++ b/examples/select.cpp @@ -41,10 +41,12 @@ int select(int, char**) static constexpr bool some_condition = true; static constexpr bool some_other_condition = false; - MockDb db; + MockDb db{}; - test::TabPerson p; - test::TabFeature f; + const auto p = test::TabPerson{}; +#if 0 + const auto f = test::TabFeature{}; +#endif for (const auto& row : db(select(all_of(p)).from(p).where(p.id > 7))) { diff --git a/examples/update.cpp b/examples/update.cpp index a6f0b0c5..89390805 100644 --- a/examples/update.cpp +++ b/examples/update.cpp @@ -29,10 +29,9 @@ int update(int, char**) { - MockDb db; + MockDb db{}; - test::TabPerson p; - // test::TabFeature q; + const auto p = test::TabPerson{}; db(update(p).set(p.feature = 7).where(p.id == 23)); return 0; diff --git a/test_constraints/count_of_count.cpp b/test_constraints/count_of_count.cpp index 4c6c7b85..4c480360 100644 --- a/test_constraints/count_of_count.cpp +++ b/test_constraints/count_of_count.cpp @@ -32,7 +32,7 @@ MockDb db; int main() { - test::TabBar t; + const auto t = test::TabBar{}; count(count(t.alpha)); } diff --git a/test_constraints/max_of_max.cpp b/test_constraints/max_of_max.cpp index b534b00b..8fb5a363 100644 --- a/test_constraints/max_of_max.cpp +++ b/test_constraints/max_of_max.cpp @@ -32,7 +32,7 @@ MockDb db; int main() { - test::TabBar t; + const auto t = test::TabBar{}; max(max(t.alpha)); } diff --git a/test_constraints/must_not_insert.cpp b/test_constraints/must_not_insert.cpp index bdd3b255..c3c3249f 100644 --- a/test_constraints/must_not_insert.cpp +++ b/test_constraints/must_not_insert.cpp @@ -32,7 +32,7 @@ MockDb db; int main() { - test::TabBar t; + const auto t = test::TabBar{}; insert_into(t).set(t.alpha = 7, t.gamma = false, t.beta = "alpha must not be set"); } diff --git a/test_constraints/must_not_update.cpp b/test_constraints/must_not_update.cpp index 2bb5f479..d24daa1c 100644 --- a/test_constraints/must_not_update.cpp +++ b/test_constraints/must_not_update.cpp @@ -31,7 +31,7 @@ MockDb db; int main() { - test::TabBar t; + const auto t = test::TabBar{}; update(t).set(t.alpha = 7, t.gamma = false, t.beta = "alpha must not be set"); } diff --git a/test_constraints/no_conversion_operator_if_null_not_trivial.cpp b/test_constraints/no_conversion_operator_if_null_not_trivial.cpp index 74927da9..091c5759 100644 --- a/test_constraints/no_conversion_operator_if_null_not_trivial.cpp +++ b/test_constraints/no_conversion_operator_if_null_not_trivial.cpp @@ -31,7 +31,7 @@ EnforceDb edb{}; int main() { - test::TabBar t; + const auto t = test::TabBar{}; static_assert(sqlpp::can_be_null_t::value, "t.alpha can be null"); static_assert(not sqlpp::null_is_trivial_value_t::value, "t.alpha does not say null_is_trivial"); diff --git a/test_constraints/require_insert.cpp b/test_constraints/require_insert.cpp index 2fda456f..0ab7fc7b 100644 --- a/test_constraints/require_insert.cpp +++ b/test_constraints/require_insert.cpp @@ -32,7 +32,7 @@ MockDb db; int main() { - test::TabBar t; + const auto t = test::TabBar{}; insert_into(t).set(t.beta = "need also to insert gamma"); } diff --git a/tests/BooleanExpression.cpp b/tests/BooleanExpression.cpp index ad1b668d..57489e63 100644 --- a/tests/BooleanExpression.cpp +++ b/tests/BooleanExpression.cpp @@ -31,7 +31,7 @@ int BooleanExpression(int, char**) { MockDb db = {}; - test::TabBar t; + const auto t = test::TabBar{}; auto x = boolean_expression(db, not(t.alpha == 7)); x = sqlpp::boolean_expression(t.beta.like("%cheesecake")); diff --git a/tests/CustomQuery.cpp b/tests/CustomQuery.cpp index 217cff29..8d134199 100644 --- a/tests/CustomQuery.cpp +++ b/tests/CustomQuery.cpp @@ -32,10 +32,10 @@ int CustomQuery(int, char**) { MockDb db = {}; - MockDb::_serializer_context_t printer; + MockDb::_serializer_context_t printer = {}; - test::TabFoo f; - test::TabBar t; + const auto f = test::TabFoo{}; + const auto t = test::TabBar{}; // A void custom query printer.reset(); diff --git a/tests/DateTime.cpp b/tests/DateTime.cpp index 10c90d34..f23765e1 100644 --- a/tests/DateTime.cpp +++ b/tests/DateTime.cpp @@ -33,8 +33,8 @@ SQLPP_ALIAS_PROVIDER(now) int DateTime(int, char**) { MockDb db = {}; - MockDb::_serializer_context_t printer; - test::TabDateTime t; + MockDb::_serializer_context_t printer = {}; + const auto t = test::TabDateTime{}; for (const auto& row : db(select(::sqlpp::value(std::chrono::system_clock::now()).as(now)))) { diff --git a/tests/Function.cpp b/tests/Function.cpp index bd2a47c9..7bbb5476 100644 --- a/tests/Function.cpp +++ b/tests/Function.cpp @@ -38,8 +38,8 @@ SQLPP_ALIAS_PROVIDER(kaesekuchen) int Function(int, char**) { MockDb db = {}; - test::TabFoo f; - test::TabBar t; + const auto f = test::TabFoo{}; + const auto t = test::TabBar{}; // f.omega + 4 *= ""; diff --git a/tests/Insert.cpp b/tests/Insert.cpp index f0a95a24..750c6f49 100644 --- a/tests/Insert.cpp +++ b/tests/Insert.cpp @@ -32,9 +32,9 @@ int Insert(int, char**) { - MockDb db; - MockDb::_serializer_context_t printer; - test::TabBar t; + MockDb db = {}; + MockDb::_serializer_context_t printer = {}; + const auto t = test::TabBar{}; // test::TabFoo f; { diff --git a/tests/Interpret.cpp b/tests/Interpret.cpp index c118bae8..f1620763 100644 --- a/tests/Interpret.cpp +++ b/tests/Interpret.cpp @@ -32,10 +32,10 @@ int Interpret(int, char**) { MockDb db = {}; - MockDb::_serializer_context_t printer; + MockDb::_serializer_context_t printer = {}; - test::TabFoo f; - test::TabBar t; + const auto f = test::TabFoo{}; + const auto t = test::TabBar{}; select(t.alpha.as(t.beta)); serialize(insert_into(t).columns(t.beta, t.gamma), printer).str(); diff --git a/tests/Prepared.cpp b/tests/Prepared.cpp index 72a73627..11d2683d 100644 --- a/tests/Prepared.cpp +++ b/tests/Prepared.cpp @@ -33,7 +33,7 @@ int Prepared(int, char**) { MockDb db = {}; // test::TabFoo f; - test::TabBar t; + const auto t = test::TabBar{}; // empty parameter lists { diff --git a/tests/Remove.cpp b/tests/Remove.cpp index f38d2b4a..6130cc98 100644 --- a/tests/Remove.cpp +++ b/tests/Remove.cpp @@ -31,10 +31,10 @@ int Remove(int, char**) { - MockDb db; - MockDb::_serializer_context_t printer; + MockDb db = {}; + MockDb::_serializer_context_t printer = {}; - test::TabBar t; + const auto t = test::TabBar{}; { using T = decltype(remove_from(t)); diff --git a/tests/Result.cpp b/tests/Result.cpp index ac67e6f4..23d756a7 100644 --- a/tests/Result.cpp +++ b/tests/Result.cpp @@ -36,7 +36,7 @@ int Result(int, char**) MockDb db = {}; EnforceDb edb{}; - test::TabBar t; + const auto t = test::TabBar{}; static_assert(sqlpp::can_be_null_t::value, "t.alpha can be null"); static_assert(not sqlpp::null_is_trivial_value_t::value, "t.alpha does not say null_is_trivial"); diff --git a/tests/Select.cpp b/tests/Select.cpp index 2d5a9a4c..2870fd92 100644 --- a/tests/Select.cpp +++ b/tests/Select.cpp @@ -45,10 +45,10 @@ int64_t getColumn(Db&& db, const Column& column) int Select(int, char**) { MockDb db = {}; - MockDb::_serializer_context_t printer; + MockDb::_serializer_context_t printer = {}; - test::TabFoo f; - test::TabBar t; + const auto f = test::TabFoo{}; + const auto t = test::TabBar{}; const auto tab_a = f.as(sqlpp::alias::a); getColumn(db, t.alpha); diff --git a/tests/SelectType.cpp b/tests/SelectType.cpp index 1e0dd7a7..7bbb4337 100644 --- a/tests/SelectType.cpp +++ b/tests/SelectType.cpp @@ -43,14 +43,14 @@ namespace alias int SelectType(int, char**) { MockDb db = {}; - MockDb::_serializer_context_t printer; + MockDb::_serializer_context_t printer = {}; - test::TabFoo f; - test::TabBar t; + const auto f = test::TabFoo{}; + const auto t = test::TabBar{}; // Test a table { - using T = decltype(t); + using T = typename std::decay::type; static_assert(not sqlpp::is_numeric_t::value, "type requirement"); static_assert(not sqlpp::is_integral_t::value, "type requirement"); static_assert(not sqlpp::is_floating_point_t::value, "type requirement"); diff --git a/tests/Union.cpp b/tests/Union.cpp index ed6a8f1e..142a46da 100644 --- a/tests/Union.cpp +++ b/tests/Union.cpp @@ -32,10 +32,10 @@ int Union(int, char**) { MockDb db; - MockDb::_serializer_context_t printer; + MockDb::_serializer_context_t printer = {}; - test::TabBar t; - test::TabFoo f; + const auto t = test::TabBar{}; + const auto f = test::TabFoo{}; db(select(t.alpha).from(t).where(true).union_distinct(select(f.epsilon.as(t.alpha)).from(f).where(true))); db(select(t.alpha).from(t).where(true).union_all(select(f.epsilon.as(t.alpha)).from(f).where(true))); diff --git a/tests/Update.cpp b/tests/Update.cpp index e9136340..a0e85405 100644 --- a/tests/Update.cpp +++ b/tests/Update.cpp @@ -32,10 +32,9 @@ int Update(int, char**) { MockDb db; - MockDb::_serializer_context_t printer; + MockDb::_serializer_context_t printer = {}; - test::TabBar t; - // test::TabFoo f; + const auto t = test::TabBar{}; { using T = decltype(update(t)); diff --git a/tests/With.cpp b/tests/With.cpp index cf6a447d..3462b1e4 100644 --- a/tests/With.cpp +++ b/tests/With.cpp @@ -32,7 +32,7 @@ int With(int, char**) { MockDb db; - MockDb::_serializer_context_t printer; + MockDb::_serializer_context_t printer = {}; const auto t = test::TabBar{};