mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Formatting...
This commit is contained in:
parent
a643095958
commit
cc96fc44ef
@ -53,5 +53,5 @@ namespace sqlpp
|
|||||||
concat_t<Column, wrap_operand_t<T>>{*static_cast<const Column*>(this), rhs{t}}};
|
concat_t<Column, wrap_operand_t<T>>{*static_cast<const Column*>(this), rhs{t}}};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
} // namespace sqlpp
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,5 +45,5 @@ namespace sqlpp
|
|||||||
|
|
||||||
using blob = blob;
|
using blob = blob;
|
||||||
using mediumblob = blob;
|
using mediumblob = blob;
|
||||||
}
|
} // namespace sqlpp
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,5 +90,5 @@ namespace sqlpp
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
} // namespace sqlpp
|
||||||
#endif
|
#endif
|
||||||
|
@ -49,5 +49,5 @@ namespace sqlpp
|
|||||||
target._bind_blob_parameter(index, &_value, _is_null);
|
target._bind_blob_parameter(index, &_value, _is_null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
} // namespace sqlpp
|
||||||
#endif
|
#endif
|
||||||
|
@ -79,5 +79,5 @@ namespace sqlpp
|
|||||||
return os << e.value();
|
return os << e.value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // namespace sqlpp
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,5 +47,5 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
using type = blob_operand;
|
using type = blob_operand;
|
||||||
};
|
};
|
||||||
}
|
} // namespace sqlpp
|
||||||
#endif
|
#endif
|
||||||
|
@ -39,6 +39,6 @@ namespace sqlpp
|
|||||||
};
|
};
|
||||||
template <typename T, typename Defer>
|
template <typename T, typename Defer>
|
||||||
using return_type_like_t = typename return_type_like<T, Defer>::type;
|
using return_type_like_t = typename return_type_like<T, Defer>::type;
|
||||||
}
|
} // namespace sqlpp
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -140,21 +140,25 @@ namespace sqlpp
|
|||||||
std::tuple<rhs_t<Assignments>...> _values;
|
std::tuple<rhs_t<Assignments>...> _values;
|
||||||
interpretable_list_t<Database> _dynamic_columns;
|
interpretable_list_t<Database> _dynamic_columns;
|
||||||
interpretable_list_t<Database> _dynamic_values;
|
interpretable_list_t<Database> _dynamic_values;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <size_t... Indexes>
|
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;
|
(void)assignments;
|
||||||
return decltype(_columns)(std::get<Indexes>(assignments)._lhs...);
|
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)>{};
|
const auto seq = detail::make_index_sequence<sizeof...(Assignments)>{};
|
||||||
return columns_from_tuple(seq, assignments);
|
return columns_from_tuple(seq, assignments);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t... Indexes>
|
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;
|
(void)assignments;
|
||||||
return decltype(_values)(std::get<Indexes>(assignments)._rhs...);
|
return decltype(_values)(std::get<Indexes>(assignments)._rhs...);
|
||||||
|
@ -50,7 +50,7 @@ namespace
|
|||||||
{
|
{
|
||||||
return std::vector<std::uint8_t>(s.begin(), s.end());
|
return std::vector<std::uint8_t>(s.begin(), s.end());
|
||||||
}
|
}
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
int Blob(int, char*[])
|
int Blob(int, char*[])
|
||||||
{
|
{
|
||||||
|
@ -71,9 +71,7 @@ int Insert(int, char* [])
|
|||||||
|
|
||||||
db(multi_insert);
|
db(multi_insert);
|
||||||
|
|
||||||
auto values=[&t](){
|
auto values = [&t]() { return std::make_tuple(t.gamma = true, t.delta = sqlpp::tvin(0)); };
|
||||||
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::verbatim<sqlpp::integer>("17+4")));
|
||||||
db(insert_into(t).set(t.gamma = true, t.delta = sqlpp::null));
|
db(insert_into(t).set(t.gamma = true, t.delta = sqlpp::null));
|
||||||
|
@ -292,7 +292,6 @@ struct MockDbT : public sqlpp::connection
|
|||||||
using MockDb = MockDbT<false>;
|
using MockDb = MockDbT<false>;
|
||||||
using EnforceDb = MockDbT<true>;
|
using EnforceDb = MockDbT<true>;
|
||||||
|
|
||||||
|
|
||||||
struct MockSizeDb : public sqlpp::connection
|
struct MockSizeDb : public sqlpp::connection
|
||||||
{
|
{
|
||||||
using _traits = MockDb::_traits;
|
using _traits = MockDb::_traits;
|
||||||
@ -323,7 +322,10 @@ struct MockSizeDb : public sqlpp::connection
|
|||||||
class result_t : public MockDb::result_t
|
class result_t : public MockDb::result_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
size_t size() const { return 0; }
|
size_t size() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Directly executed statements start here
|
// Directly executed statements start here
|
||||||
|
@ -79,24 +79,13 @@ int Ppgen(int, char* [])
|
|||||||
db(insert_into(f).default_values());
|
db(insert_into(f).default_values());
|
||||||
|
|
||||||
auto i = insert_into(p).columns(p.name, p.feature, p.age, p.level);
|
auto i = insert_into(p).columns(p.name, p.feature, p.age, p.level);
|
||||||
i.values.add(p.name = "Roland"
|
i.values.add(p.name = "Roland", p.feature = 1, p.age = static_cast<unsigned int>(32), p.level = 3.14);
|
||||||
, p.feature = 1
|
i.values.add(p.name = "Zaphod", p.feature = sqlpp::default_value, p.age = static_cast<unsigned int>(16),
|
||||||
, p.age = static_cast<unsigned int>(32)
|
p.level = 3.14 * 2);
|
||||||
, 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);
|
db(i);
|
||||||
|
|
||||||
auto pi = db.prepare(
|
auto pi = db.prepare(insert_into(p).set(p.name = parameter(f.name), p.feature = parameter(p.feature),
|
||||||
insert_into(p).set(
|
p.age = parameter(p.age), p.level = parameter(p.level)));
|
||||||
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.name = "likes java";
|
||||||
pi.params.feature = 2;
|
pi.params.feature = 2;
|
||||||
pi.params.age = 21;
|
pi.params.age = 21;
|
||||||
|
@ -119,7 +119,7 @@ namespace test
|
|||||||
};
|
};
|
||||||
using _traits = sqlpp::make_traits<sqlpp::blob, sqlpp::tag::can_be_null>;
|
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>
|
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>;
|
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>
|
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>;
|
using _traits = sqlpp::make_traits<sqlpp::time_of_day, sqlpp::tag::can_be_null>;
|
||||||
};
|
};
|
||||||
}
|
} // namespace TabDateTime_
|
||||||
|
|
||||||
struct TabDateTime
|
struct TabDateTime
|
||||||
: sqlpp::table_t<TabDateTime, TabDateTime_::ColDayPoint, TabDateTime_::ColTimePoint, TabDateTime_::ColTimeOfDay>
|
: sqlpp::table_t<TabDateTime, TabDateTime_::ColDayPoint, TabDateTime_::ColTimePoint, TabDateTime_::ColTimeOfDay>
|
||||||
@ -350,5 +350,5 @@ namespace test
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
} // namespace test
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,9 +63,7 @@ int Update(int, char* [])
|
|||||||
|
|
||||||
db(u);
|
db(u);
|
||||||
|
|
||||||
auto values=[&t](){
|
auto values = [&t]() { return std::make_tuple(t.delta += t.alpha, t.beta = "no cake this time"); };
|
||||||
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::verbatim<sqlpp::integer>("17+4")).unconditionally());
|
||||||
db(update(t).set(t.delta = sqlpp::null).unconditionally());
|
db(update(t).set(t.delta = sqlpp::null).unconditionally());
|
||||||
|
Loading…
Reference in New Issue
Block a user