diff --git a/include/sqlpp11/core/basic/column.h b/include/sqlpp11/core/basic/column.h
index 4d0d521c..684b638b 100644
--- a/include/sqlpp11/core/basic/column.h
+++ b/include/sqlpp11/core/basic/column.h
@@ -116,10 +116,6 @@ namespace sqlpp
{
using T = column_t
;
- name_to_sql_string(context, name_tag_of_t::name);
- context << '.';
- name_to_sql_string(context, name_tag_of_t::name);
-
- return context;
+ return name_to_sql_string(context, name_tag_of_t::name) + "." + name_to_sql_string(context, name_tag_of_t::name);
}
} // namespace sqlpp
diff --git a/include/sqlpp11/core/basic/join.h b/include/sqlpp11/core/basic/join.h
index 76edcf32..ca3d9905 100644
--- a/include/sqlpp11/core/basic/join.h
+++ b/include/sqlpp11/core/basic/join.h
@@ -87,8 +87,6 @@ namespace sqlpp
template
auto to_sql_string(Context& context, const join_t& t) -> std::string
{
- to_sql_string(context, t._pre_join);
- to_sql_string(context, t._on);
- return context;
+ return to_sql_string(context, t._pre_join) + to_sql_string(context, t._on);
}
} // namespace sqlpp
diff --git a/include/sqlpp11/core/basic/on.h b/include/sqlpp11/core/basic/on.h
index 2aa13aba..dad05a16 100644
--- a/include/sqlpp11/core/basic/on.h
+++ b/include/sqlpp11/core/basic/on.h
@@ -61,16 +61,14 @@ namespace sqlpp
};
template
- auto to_sql_string(Context& context, const on_t&) -> std::string
+ auto to_sql_string(Context& , const on_t&) -> std::string
{
- return context;
+ return {};
}
template
auto to_sql_string(Context& context, const on_t& t) -> std::string
{
- context << " ON ";
- to_sql_string(context, t._expression);
- return context;
+ return " ON " + to_sql_string(context, t._expression);
}
} // namespace sqlpp
diff --git a/include/sqlpp11/core/basic/parameter.h b/include/sqlpp11/core/basic/parameter.h
index 53ea5eb7..2f26e167 100644
--- a/include/sqlpp11/core/basic/parameter.h
+++ b/include/sqlpp11/core/basic/parameter.h
@@ -64,10 +64,9 @@ namespace sqlpp
};
template
- auto to_sql_string(Context& context, const parameter_t&) -> std::string
+ auto to_sql_string(Context& , const parameter_t&) -> std::string
{
- context << "?";
- return context;
+ return "?";
}
template
diff --git a/include/sqlpp11/core/basic/parameterized_verbatim.h b/include/sqlpp11/core/basic/parameterized_verbatim.h
index 11b2b485..1622c05d 100644
--- a/include/sqlpp11/core/basic/parameterized_verbatim.h
+++ b/include/sqlpp11/core/basic/parameterized_verbatim.h
@@ -71,10 +71,7 @@ namespace sqlpp
template
auto to_sql_string(Context& context, const parameterized_verbatim_t& t) -> std::string
{
- context << t._verbatim_lhs;
- to_sql_string(context, t._expr);
- context << t._verbatim_rhs;
- return context;
+ return t._verbatim_lhs + to_sql_string(context, t._expr) + t._verbatim_rhs;
}
template
diff --git a/include/sqlpp11/core/basic/pre_join.h b/include/sqlpp11/core/basic/pre_join.h
index 48af1451..0a635092 100644
--- a/include/sqlpp11/core/basic/pre_join.h
+++ b/include/sqlpp11/core/basic/pre_join.h
@@ -135,11 +135,7 @@ namespace sqlpp
template
auto to_sql_string(Context& context, const pre_join_t& t) -> std::string
{
- to_sql_string(context, t._lhs);
- context << JoinType::_name;
- context << " JOIN ";
- to_sql_string(context, t._rhs);
- return context;
+ return to_sql_string(context, t._lhs) + JoinType::_name + " JOIN " + to_sql_string(context, t._rhs);
}
namespace detail
diff --git a/include/sqlpp11/core/basic/table.h b/include/sqlpp11/core/basic/table.h
index ce04615c..02f801a3 100644
--- a/include/sqlpp11/core/basic/table.h
+++ b/include/sqlpp11/core/basic/table.h
@@ -69,7 +69,6 @@ namespace sqlpp
template
auto to_sql_string(Context& context, const table_t& /*unused*/) -> std::string
{
- name_to_sql_string(context, name_tag_of_t::name);
- return context;
+ return name_to_sql_string(context, name_tag_of_t::name);
}
} // namespace sqlpp
diff --git a/include/sqlpp11/core/basic/table_alias.h b/include/sqlpp11/core/basic/table_alias.h
index fc9c0283..93df5653 100644
--- a/include/sqlpp11/core/basic/table_alias.h
+++ b/include/sqlpp11/core/basic/table_alias.h
@@ -58,9 +58,7 @@ namespace sqlpp
template
auto to_sql_string(Context& context, const table_alias_t&) -> std::string
{
- name_to_sql_string(context, name_tag_of_t::name);
- context << " AS ";
+ return name_to_sql_string(context, name_tag_of_t::name) + " AS " +
name_to_sql_string(context, name_tag_of_t::name);
- return context;
}
} // namespace sqlpp
diff --git a/include/sqlpp11/core/basic/verbatim.h b/include/sqlpp11/core/basic/verbatim.h
index 2d8a3384..46712654 100644
--- a/include/sqlpp11/core/basic/verbatim.h
+++ b/include/sqlpp11/core/basic/verbatim.h
@@ -62,10 +62,9 @@ namespace sqlpp
};
template
- auto to_sql_string(Context& context, const verbatim_t& t) -> std::string
+ auto to_sql_string(Context& , const verbatim_t& t) -> std::string
{
- context << t._verbatim;
- return context;
+ return t._verbatim;
}
template
diff --git a/include/sqlpp11/core/basic/verbatim_table.h b/include/sqlpp11/core/basic/verbatim_table.h
index 3b0392a5..22ab097d 100644
--- a/include/sqlpp11/core/basic/verbatim_table.h
+++ b/include/sqlpp11/core/basic/verbatim_table.h
@@ -57,10 +57,7 @@ namespace sqlpp
template
auto to_sql_string(Context& context, const verbatim_table_alias_t& t) -> std::string
{
- context << t._representation;
- context << " AS ";
- name_to_sql_string(context, name_tag_of_t::name);
- return context;
+ return t._representation + " AS " + name_to_sql_string(context, name_tag_of_t::name);
}
struct verbatim_table_t: public enable_join
@@ -90,10 +87,9 @@ namespace sqlpp
};
template
- auto to_sql_string(Context& context, const verbatim_table_t& t) -> std::string
+ auto to_sql_string(Context& , const verbatim_table_t& t) -> std::string
{
- context << t._representation;
- return context;
+ return t._representation;
}
inline verbatim_table_t verbatim_table(std::string name)
diff --git a/include/sqlpp11/core/clause/for_update.h b/include/sqlpp11/core/clause/for_update.h
index d4de4f99..4d3551fe 100644
--- a/include/sqlpp11/core/clause/for_update.h
+++ b/include/sqlpp11/core/clause/for_update.h
@@ -92,10 +92,9 @@ namespace sqlpp
// Interpreters
template
- auto to_sql_string(Context& context, const for_update_data_t&) -> std::string
+ auto to_sql_string(Context& , const for_update_data_t&) -> std::string
{
- context << " FOR UPDATE ";
- return context;
+ return " FOR UPDATE ";
}
inline auto for_update() -> decltype(statement_t().for_update())
diff --git a/include/sqlpp11/core/clause/from.h b/include/sqlpp11/core/clause/from.h
index 97ae8fba..5bdf2490 100644
--- a/include/sqlpp11/core/clause/from.h
+++ b/include/sqlpp11/core/clause/from.h
@@ -143,9 +143,7 @@ namespace sqlpp
template
auto to_sql_string(Context& context, const from_data_t& t) -> std::string
{
- context << " FROM ";
- to_sql_string(context, t._table);
- return context;
+ return " FROM " + to_sql_string(context, t._table);
}
template
diff --git a/include/sqlpp11/core/clause/group_by.h b/include/sqlpp11/core/clause/group_by.h
index c911c4c5..98a42582 100644
--- a/include/sqlpp11/core/clause/group_by.h
+++ b/include/sqlpp11/core/clause/group_by.h
@@ -148,9 +148,7 @@ namespace sqlpp
template
auto to_sql_string(Context& context, const group_by_data_t& t) -> std::string
{
- context << " GROUP BY ";
- interpret_tuple(t._expressions, ',', context);
- return context;
+ return " GROUP BY " + interpret_tuple(t._expressions, ',', context);
}
template
diff --git a/include/sqlpp11/core/clause/having.h b/include/sqlpp11/core/clause/having.h
index f7f16cce..72b4e0f1 100644
--- a/include/sqlpp11/core/clause/having.h
+++ b/include/sqlpp11/core/clause/having.h
@@ -173,9 +173,7 @@ namespace sqlpp
template
auto to_sql_string(Context& context, const having_data_t& t) -> std::string
{
- context << " HAVING ";
- to_sql_string(context, t._expression);
- return context;
+ return " HAVING " + to_sql_string(context, t._expression);
}
template
diff --git a/include/sqlpp11/core/clause/insert.h b/include/sqlpp11/core/clause/insert.h
index a9551290..87866118 100644
--- a/include/sqlpp11/core/clause/insert.h
+++ b/include/sqlpp11/core/clause/insert.h
@@ -87,11 +87,9 @@ namespace sqlpp
};
template
- auto to_sql_string(Context& context, const insert_name_t&) -> std::string
+ auto to_sql_string(Context& , const insert_name_t&) -> std::string
{
- context << "INSERT";
-
- return context;
+ return "INSERT";
}
using blank_insert_t = statement_t;
diff --git a/include/sqlpp11/core/clause/insert_value.h b/include/sqlpp11/core/clause/insert_value.h
index 1d63457d..ac099c72 100644
--- a/include/sqlpp11/core/clause/insert_value.h
+++ b/include/sqlpp11/core/clause/insert_value.h
@@ -83,12 +83,8 @@ namespace sqlpp
{
if (t._is_default)
{
- context << "DEFAULT";
+ return "DEFAULT";
}
- else
- {
- operand_to_sql_string(context, t._value);
- }
- return context;
+ return operand_to_sql_string(context, t._value);
}
} // namespace sqlpp
diff --git a/include/sqlpp11/core/clause/insert_value_list.h b/include/sqlpp11/core/clause/insert_value_list.h
index 62696310..8eb6ebfc 100644
--- a/include/sqlpp11/core/clause/insert_value_list.h
+++ b/include/sqlpp11/core/clause/insert_value_list.h
@@ -395,49 +395,47 @@ namespace sqlpp
// Interpreters
template
- auto to_sql_string(Context& context, const insert_default_values_data_t&) -> std::string
+ auto to_sql_string(Context& , const insert_default_values_data_t&) -> std::string
{
- context << " DEFAULT VALUES";
- return context;
+ return " DEFAULT VALUES";
}
template
auto to_sql_string(Context& context, const column_list_data_t& t) -> std::string
{
- context << " (";
- interpret_tuple(t._columns, ",", context);
- context << ")";
+ auto result = std::string{" ("};
+ result += interpret_tuple(t._columns, ",", context);
+ result += ")";
bool first = true;
for (const auto& row : t._insert_values)
{
if (first)
{
- context << " VALUES ";
+ result += " VALUES ";
first = false;
}
else
{
- context << ',';
+ result += ',';
}
- context << '(';
- interpret_tuple(row, ",", context);
- context << ')';
+ result += '(';
+ result += interpret_tuple(row, ",", context);
+ result += ')';
}
- return context;
+ return result;
}
template
auto to_sql_string(Context& context, const insert_list_data_t& t) -> std::string
{
- context << " (";
- interpret_tuple(t._columns, ",", context);
- context << ")";
- context << " VALUES(";
- interpret_tuple(t._values, ",", context);
- context << ")";
- return context;
+ auto result = std::string{" ("};
+ result += interpret_tuple(t._columns, ",", context);
+ result += ") VALUES(";
+ result += interpret_tuple(t._values, ",", context);
+ result += ")";
+ return result;
}
template
diff --git a/include/sqlpp11/core/clause/into.h b/include/sqlpp11/core/clause/into.h
index 3c1a5bef..6f2c5725 100644
--- a/include/sqlpp11/core/clause/into.h
+++ b/include/sqlpp11/core/clause/into.h
@@ -140,13 +140,10 @@ namespace sqlpp
};
};
- // Interpreters
template
auto to_sql_string(Context& context, const into_data_t& t) -> std::string
{
- context << " INTO ";
- to_sql_string(context, t._table);
- return context;
+ return " INTO " + to_sql_string(context, t._table);
}
template
diff --git a/include/sqlpp11/core/clause/limit.h b/include/sqlpp11/core/clause/limit.h
index de5da714..68675899 100644
--- a/include/sqlpp11/core/clause/limit.h
+++ b/include/sqlpp11/core/clause/limit.h
@@ -130,9 +130,7 @@ namespace sqlpp
template
auto to_sql_string(Context& context, const limit_data_t& t) -> std::string
{
- context << " LIMIT ";
- operand_to_sql_string(context, t._value);
- return context;
+ return " LIMIT " + operand_to_sql_string(context, t._value);
}
template
diff --git a/include/sqlpp11/core/clause/offset.h b/include/sqlpp11/core/clause/offset.h
index 14fa34c2..acd008fb 100644
--- a/include/sqlpp11/core/clause/offset.h
+++ b/include/sqlpp11/core/clause/offset.h
@@ -138,13 +138,10 @@ namespace sqlpp
};
};
- // Interpreters
template
auto to_sql_string(Context& context, const offset_data_t& t) -> std::string
{
- context << " OFFSET ";
- operand_to_sql_string(context, t._value);
- return context;
+ return " OFFSET " + operand_to_sql_string(context, t._value);
}
template
diff --git a/include/sqlpp11/core/clause/order_by.h b/include/sqlpp11/core/clause/order_by.h
index 468e4079..e9653839 100644
--- a/include/sqlpp11/core/clause/order_by.h
+++ b/include/sqlpp11/core/clause/order_by.h
@@ -148,9 +148,7 @@ namespace sqlpp
template
auto to_sql_string(Context& context, const order_by_data_t& t) -> std::string
{
- context << " ORDER BY ";
- interpret_tuple(t._expressions, ',', context);
- return context;
+ return " ORDER BY " + interpret_tuple(t._expressions, ',', context);
}
template
diff --git a/include/sqlpp11/core/clause/remove.h b/include/sqlpp11/core/clause/remove.h
index c0d86061..ee786267 100644
--- a/include/sqlpp11/core/clause/remove.h
+++ b/include/sqlpp11/core/clause/remove.h
@@ -86,11 +86,9 @@ namespace sqlpp
};
template
- auto to_sql_string(Context& context, const remove_name_t&) -> std::string
+ auto to_sql_string(Context& , const remove_name_t&) -> std::string
{
- context << "DELETE";
-
- return context;
+ return "DELETE";
}
using blank_remove_t = statement_t>;
diff --git a/include/sqlpp11/core/clause/select.h b/include/sqlpp11/core/clause/select.h
index bea78a3a..0d3d83c2 100644
--- a/include/sqlpp11/core/clause/select.h
+++ b/include/sqlpp11/core/clause/select.h
@@ -55,7 +55,7 @@ namespace sqlpp
};
template
- auto to_sql_string(Context& context, const select_name_t&) -> std::string
+ auto to_sql_string(Context& , const select_name_t&) -> std::string
{
return "SELECT ";
}
diff --git a/include/sqlpp11/core/clause/select_as.h b/include/sqlpp11/core/clause/select_as.h
index 07090c93..dc53079c 100644
--- a/include/sqlpp11/core/clause/select_as.h
+++ b/include/sqlpp11/core/clause/select_as.h
@@ -54,10 +54,7 @@ namespace sqlpp
{
using T = pseudo_column_t;
- name_to_sql_string(context, name_tag_of_t::name);
- context << '.';
- name_to_sql_string(context, name_tag_of_t::name);
- return context;
+ return name_to_sql_string(context, name_tag_of_t::name) + "."+ name_to_sql_string(context, name_tag_of_t::name);
}
template
@@ -97,9 +94,6 @@ namespace sqlpp
template
auto to_sql_string(Context& context, const select_as_t