@@ -1935,8 +1935,10 @@ namespace sqlite_orm {
19351935 namespace internal {
19361936#ifdef SQLITE_ORM_STRING_VIEW_SUPPORTED
19371937 using serialize_result_type = std::string_view;
1938+ using serialize_arg_type = std::string_view;
19381939#else
19391940 using serialize_result_type = std::string;
1941+ using serialize_arg_type = const std::string&;
19401942#endif
19411943 }
19421944}
@@ -10202,8 +10204,8 @@ namespace sqlite_orm {
1020210204
1020310205 namespace internal {
1020410206
10205- template<class T, class I >
10206- std::string serialize(const T& t , const serializer_context<I>& context );
10207+ template<class T, class DBOs >
10208+ std::string serialize(const T&, const serializer_context<DBOs>& );
1020710209
1020810210 /**
1020910211 * Serialize default value of a column's default valu
@@ -13206,10 +13208,6 @@ namespace sqlite_orm {
1320613208#include <string>
1320713209#include <ostream>
1320813210#include <utility> // std::exchange, std::tuple_size
13209- #if defined(SQLITE_ORM_CONCEPTS_SUPPORTED) && !defined(SQLITE_ORM_BROKEN_NONTEMPLATE_CONCEPTS)
13210- #include <string_view>
13211- #include <algorithm> // std::find
13212- #endif
1321313211
1321413212// #include "functional/cxx_universal.h"
1321513213// ::size_t
@@ -13221,57 +13219,39 @@ namespace sqlite_orm {
1322113219
1322213220// #include "serializer_context.h"
1322313221
13222+ // #include "serialize_result_type.h"
13223+
1322413224// #include "util.h"
1322513225
1322613226namespace sqlite_orm {
1322713227 namespace internal {
1322813228 template<class O>
1322913229 struct order_by_t;
1323013230
13231- template<class T, class I >
13232- std::string serialize(const T& t , const serializer_context<I>& context );
13231+ template<class T, class DBOs >
13232+ std::string serialize(const T&, const serializer_context<DBOs>& );
1323313233
1323413234 template<class T, class Ctx>
13235- std::string serialize_order_by(const T& t, const Ctx& context);
13236-
13237- #if defined(SQLITE_ORM_CONCEPTS_SUPPORTED) && !defined(SQLITE_ORM_BROKEN_NONTEMPLATE_CONCEPTS)
13238- // optimized version when string_view's iterator range constructor is available
13239- template<class SFINAE = void>
13240- void stream_sql_escaped(std::ostream& os, const std::string& str, char char2Escape)
13241- requires requires {
13242- std::string_view{str.cbegin(), str.cend()};
13243- }
13244- {
13245- for(std::string::const_iterator it = str.cbegin(), next; true; it = next + 1) {
13246- next = std::find(it, str.cend(), char2Escape);
13247- os << std::string_view{it, next};
13248-
13249- if(next == str.cend()) [[likely]] {
13235+ std::string serialize_order_by(const T&, const Ctx&);
13236+
13237+ inline void stream_sql_escaped(std::ostream& os, serialize_arg_type str, char char2Escape) {
13238+ for(size_t offset = 0, next; true; offset = next + 1) {
13239+ next = str.find(char2Escape, offset);
13240+
13241+ if(next == str.npos) {
13242+ os.write(str.data() + offset, str.size() - offset);
1325013243 break;
1325113244 }
13252- os << std::string(2, char2Escape);
13253- }
13254- }
1325513245
13256- template<class SFINAE = void>
13257- #endif
13258- inline void stream_sql_escaped(std::ostream& os, const std::string& str, char char2Escape) {
13259- if(str.find(char2Escape) == str.npos) {
13260- os << str;
13261- } else {
13262- for(char c: str) {
13263- if(c == char2Escape) {
13264- os << char2Escape;
13265- }
13266- os << c;
13267- }
13246+ os.write(str.data() + offset, next - offset + 1);
13247+ os.write(&char2Escape, 1);
1326813248 }
1326913249 }
1327013250
1327113251 inline void stream_identifier(std::ostream& ss,
13272- const std::string& qualifier,
13273- const std::string& identifier,
13274- const std::string& alias) {
13252+ serialize_arg_type qualifier,
13253+ serialize_arg_type identifier,
13254+ serialize_arg_type alias) {
1327513255 constexpr char quoteChar = '"';
1327613256 constexpr char qualified[] = {quoteChar, '.', '\0'};
1327713257 constexpr char aliased[] = {' ', quoteChar, '\0'};
@@ -13297,11 +13277,11 @@ namespace sqlite_orm {
1329713277 }
1329813278
1329913279 inline void stream_identifier(std::ostream& ss, const std::string& identifier, const std::string& alias) {
13300- return stream_identifier(ss, std::string{} , identifier, alias);
13280+ return stream_identifier(ss, "" , identifier, alias);
1330113281 }
1330213282
1330313283 inline void stream_identifier(std::ostream& ss, const std::string& identifier) {
13304- return stream_identifier(ss, std::string{} , identifier, std::string{} );
13284+ return stream_identifier(ss, "" , identifier, "" );
1330513285 }
1330613286
1330713287 template<typename Tpl, size_t... Is>
@@ -15334,8 +15314,8 @@ namespace sqlite_orm {
1533415314
1533515315 namespace internal {
1533615316
15337- template<class T, class I >
15338- std::string serialize(const T& t , const serializer_context<I>& context );
15317+ template<class T, class DBOs >
15318+ std::string serialize(const T&, const serializer_context<DBOs>& );
1533915319
1534015320 template<class T, class Ctx>
1534115321 std::vector<std::string>& collect_table_column_names(std::vector<std::string>& collectedExpressions,
@@ -15530,8 +15510,8 @@ namespace sqlite_orm {
1553015510 template<class T, class SFINAE = void>
1553115511 struct statement_serializer;
1553215512
15533- template<class T, class I >
15534- std::string serialize(const T& t, const serializer_context<I >& context) {
15513+ template<class T, class DBOs >
15514+ std::string serialize(const T& t, const serializer_context<DBOs >& context) {
1553515515 statement_serializer<T> serializer;
1553615516 return serializer(t, context);
1553715517 }
0 commit comments