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

Merge branch 'release/0.26'

This commit is contained in:
rbock 2014-08-22 22:20:14 +02:00
commit b13fd68d00
9 changed files with 54 additions and 19 deletions

View File

@ -115,12 +115,12 @@ namespace sqlpp
return { *static_cast<const Base*>(this) }; return { *static_cast<const Base*>(this) };
} }
sort_order_t<Base, sort_type::asc> asc() sort_order_t<Base, sort_type::asc> asc() const
{ {
return { *static_cast<const Base*>(this) }; return { *static_cast<const Base*>(this) };
} }
sort_order_t<Base, sort_type::desc> desc() sort_order_t<Base, sort_type::desc> desc() const
{ {
return { *static_cast<const Base*>(this) }; return { *static_cast<const Base*>(this) };
} }
@ -145,7 +145,7 @@ namespace sqlpp
struct alias_operators struct alias_operators
{ {
template<typename alias_provider> template<typename alias_provider>
expression_alias_t<Base, alias_provider> as(const alias_provider&) expression_alias_t<Base, alias_provider> as(const alias_provider&) const
{ {
return { *static_cast<const Base*>(this) }; return { *static_cast<const Base*>(this) };
} }

View File

@ -90,7 +90,7 @@ namespace sqlpp
auto operator =(T t) const -> assignment_t<column_t, wrap_operand_t<T>> auto operator =(T t) const -> assignment_t<column_t, wrap_operand_t<T>>
{ {
using rhs = wrap_operand_t<T>; using rhs = wrap_operand_t<T>;
static_assert(_is_valid_operand<rhs>::value, "invalid rhs operand assignment operand"); static_assert(_is_valid_operand<rhs>::value, "invalid rhs assignment operand");
return { *this, {rhs{t}} }; return { *this, {rhs{t}} };
} }

View File

@ -205,7 +205,7 @@ namespace sqlpp
using rhs = wrap_operand_t<T>; using rhs = wrap_operand_t<T>;
static_assert(_is_valid_operand<rhs>::value, "invalid rhs assignment operand"); static_assert(_is_valid_operand<rhs>::value, "invalid rhs assignment operand");
return { *static_cast<const Base*>(this), { *static_cast<const Base*>(this), rhs{t} } }; return { *static_cast<const Base*>(this), {{*static_cast<const Base*>(this), rhs{t}}}};
} }
template<typename T> template<typename T>
@ -214,7 +214,7 @@ namespace sqlpp
using rhs = wrap_operand_t<T>; using rhs = wrap_operand_t<T>;
static_assert(_is_valid_operand<rhs>::value, "invalid rhs assignment operand"); static_assert(_is_valid_operand<rhs>::value, "invalid rhs assignment operand");
return { *static_cast<const Base*>(this), { *static_cast<const Base*>(this), rhs{t} } }; return { *static_cast<const Base*>(this), {{*static_cast<const Base*>(this), rhs{t}}}};
} }
template<typename T> template<typename T>
@ -223,7 +223,7 @@ namespace sqlpp
using rhs = wrap_operand_t<T>; using rhs = wrap_operand_t<T>;
static_assert(_is_valid_operand<rhs>::value, "invalid rhs assignment operand"); static_assert(_is_valid_operand<rhs>::value, "invalid rhs assignment operand");
return { *static_cast<const Base*>(this), { *static_cast<const Base*>(this), rhs{t} } }; return { *static_cast<const Base*>(this), {{*static_cast<const Base*>(this), rhs{t}}}};
} }
template<typename T> template<typename T>
@ -232,7 +232,7 @@ namespace sqlpp
using rhs = wrap_operand_t<T>; using rhs = wrap_operand_t<T>;
static_assert(_is_valid_operand<rhs>::value, "invalid rhs assignment operand"); static_assert(_is_valid_operand<rhs>::value, "invalid rhs assignment operand");
return { *static_cast<const Base*>(this), { *static_cast<const Base*>(this), rhs{t} } }; return { *static_cast<const Base*>(this), {{*static_cast<const Base*>(this), rhs{t}}}};
} }
}; };
}; };

View File

@ -62,31 +62,31 @@ namespace sqlpp
template<typename T> template<typename T>
join_t<inner_join_t, Table, T> join(T t) join_t<inner_join_t, Table, T> join(T t) const
{ {
return { *static_cast<const Table*>(this), t }; return { *static_cast<const Table*>(this), t };
} }
template<typename T> template<typename T>
join_t<inner_join_t, Table, T> inner_join(T t) join_t<inner_join_t, Table, T> inner_join(T t) const
{ {
return { *static_cast<const Table*>(this), t }; return { *static_cast<const Table*>(this), t };
} }
template<typename T> template<typename T>
join_t<outer_join_t, Table, T> outer_join(T t) join_t<outer_join_t, Table, T> outer_join(T t) const
{ {
return { *static_cast<const Table*>(this), t }; return { *static_cast<const Table*>(this), t };
} }
template<typename T> template<typename T>
join_t<left_outer_join_t, Table, T> left_outer_join(T t) join_t<left_outer_join_t, Table, T> left_outer_join(T t) const
{ {
return { *static_cast<const Table*>(this), t }; return { *static_cast<const Table*>(this), t };
} }
template<typename T> template<typename T>
join_t<right_outer_join_t, Table, T> right_outer_join(T t) join_t<right_outer_join_t, Table, T> right_outer_join(T t) const
{ {
return { *static_cast<const Table*>(this), t }; return { *static_cast<const Table*>(this), t };
} }

View File

@ -54,7 +54,7 @@ namespace sqlpp
static_assert(required_tables_of<Table>::size::value == 0, "table aliases must not depend on external tables"); static_assert(required_tables_of<Table>::size::value == 0, "table aliases must not depend on external tables");
using _name_t = typename AliasProvider::_name_t; using _name_t = typename AliasProvider::_name_t;
using _column_tuple_t = std::tuple<column_t<Table, ColumnSpec>...>; using _column_tuple_t = std::tuple<column_t<AliasProvider, ColumnSpec>...>;
table_alias_t(Table table): table_alias_t(Table table):
_table(table) _table(table)

View File

@ -150,7 +150,7 @@ namespace sqlpp
using rhs = wrap_operand_t<T>; using rhs = wrap_operand_t<T>;
static_assert(_is_valid_operand<rhs>::value, "invalid rhs assignment operand"); static_assert(_is_valid_operand<rhs>::value, "invalid rhs assignment operand");
return { *static_cast<const Base*>(this), { *static_cast<const Base*>(this), rhs{t} } }; return { *static_cast<const Base*>(this), concat_t<Base, wrap_operand_t<T>>{ *static_cast<const Base*>(this), rhs{t} } };
} }
}; };
}; };

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2013-2014, Roland Bock
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "Sample.h"
#include "MockDb.h"
#include <sqlpp11/update.h>
MockDb db;
int main()
{
test::TabBar t;
update(t).set(t.alpha = 7, t.gamma = false, t.beta = "alpha must not be set");
}

View File

@ -165,8 +165,6 @@ struct MockDbT: public sqlpp::connection
template<typename PreparedInsert> template<typename PreparedInsert>
size_t run_prepared_insert(const PreparedInsert& x) size_t run_prepared_insert(const PreparedInsert& x)
{ {
_serializer_context_t context;
::sqlpp::serialize(x, context);
return 0; return 0;
} }
@ -181,8 +179,6 @@ struct MockDbT: public sqlpp::connection
template<typename PreparedSelect> template<typename PreparedSelect>
result_t run_prepared_select(PreparedSelect& x) result_t run_prepared_select(PreparedSelect& x)
{ {
_serializer_context_t context;
::sqlpp::serialize(x, context);
return {}; return {};
} }

View File

@ -68,6 +68,8 @@ int main()
db(update(t).set(t.delta = sqlpp::null).where(true)); db(update(t).set(t.delta = sqlpp::null).where(true));
db(update(t).set(t.delta = sqlpp::default_value).where(true)); db(update(t).set(t.delta = sqlpp::default_value).where(true));
db(update(t).set(t.delta += t.alpha * 2, t.beta += " and cake").where(true));
return 0; return 0;
} }