mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-01-04 12:10:43 -06:00
Added serializer to interpreter
The serializer has partial specializations for all templates. It is a good basis if the connector/database requires strings close to the standard. The interpreter is unspecialized (and uses a static assert to say so). It is a good basis if the connector/database requires a different interpretation, e.g. re-writing the expression tree. The interpretable_t implements three methods for interpretation: serializing with the sqlpp::serializer_context, serializing with the database's serialization context and interpretation with the database's interpretation context.
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
#include "is_regular.h"
|
||||
|
||||
DbMock db;
|
||||
DbMock::_context_t printer(std::cerr);
|
||||
DbMock::_serializer_context_t printer(std::cerr);
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -56,13 +56,13 @@ int main()
|
||||
static_assert(sqlpp::is_regular<T>::value, "type requirement");
|
||||
}
|
||||
|
||||
interpret(update(t), printer).flush();
|
||||
interpret(update(t).set(t.gamma = false), printer).flush();
|
||||
interpret(update(t).set(t.gamma = false).where(t.beta != "transparent"), printer).flush();
|
||||
interpret(update(t).set(t.beta = "opaque").where(t.beta != t.beta), printer).flush();
|
||||
serialize(update(t), printer).flush();
|
||||
serialize(update(t).set(t.gamma = false), printer).flush();
|
||||
serialize(update(t).set(t.gamma = false).where(t.beta != "transparent"), printer).flush();
|
||||
serialize(update(t).set(t.beta = "opaque").where(t.beta != t.beta), printer).flush();
|
||||
auto u = dynamic_update(db, t).dynamic_set(t.gamma = false).dynamic_where();
|
||||
u.add_set(t.gamma = false);
|
||||
interpret(u, printer).flush();
|
||||
serialize(u, printer).flush();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user