fix: correctly escape a pt::Stream in Finder from like() and similar methods
while here: - in Finder: use pt::Stream and pt::TextStreamBase<> instead of pt::TextStream and pt::WTextStream - add Finder::raw(...) methods with short int, int, long long and integer unsigned types
This commit is contained in:
@@ -435,6 +435,15 @@ void BaseExpression::after_field_value(const pt::Space &, const FT & field_type,
|
||||
after_field_value_string(field_type, model_env);
|
||||
}
|
||||
|
||||
void BaseExpression::before_field_value_generic()
|
||||
{
|
||||
}
|
||||
|
||||
void BaseExpression::after_field_value_generic()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BaseExpression::put_name_value_separator()
|
||||
{
|
||||
@@ -692,28 +701,6 @@ void BaseExpression::esc(const pt::Date & date, pt::Stream & stream, const FT &
|
||||
}
|
||||
|
||||
|
||||
void BaseExpression::esc(const pt::TextStream & val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env)
|
||||
{
|
||||
pt::TextStream::const_iterator i = val.begin();
|
||||
|
||||
for(; i != val.end() ; ++i)
|
||||
{
|
||||
esc(*i, stream, field_type, model_env);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BaseExpression::esc(const pt::WTextStream & val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env)
|
||||
{
|
||||
pt::WTextStream::const_iterator i = val.begin();
|
||||
|
||||
for(; i != val.end() ; ++i)
|
||||
{
|
||||
esc(*i, stream, field_type, model_env);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BaseExpression::esc(const pt::Space & space, pt::Stream & stream, const FT & field_type, ModelEnv * model_env)
|
||||
{
|
||||
pt::WTextStream tmp_stream;
|
||||
@@ -728,7 +715,25 @@ void BaseExpression::esc(const pt::Space & space, pt::Stream & stream, const FT
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BaseExpression::esc(const pt::Stream & val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env)
|
||||
{
|
||||
if( val.is_char_stream() )
|
||||
{
|
||||
// from utf8 to utf8 or from utf8 to wide
|
||||
pt::utf8_to_output_function(val, [&](int z) {
|
||||
esc(static_cast<wchar_t>(z), stream, field_type, model_env);
|
||||
});
|
||||
}
|
||||
else
|
||||
if( val.is_wchar_stream() )
|
||||
{
|
||||
// from wide to wide or from wide to utf8
|
||||
for(size_t i=0 ; i < val.size() ; ++i)
|
||||
{
|
||||
esc(val.get_wchar(i), stream, field_type, model_env);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//void BaseExpression::put_type(char val, pt::Stream & stream)
|
||||
@@ -1070,13 +1075,7 @@ void BaseExpression::put_string(const std::wstring & str, const FT & field_type,
|
||||
}
|
||||
|
||||
|
||||
void BaseExpression::put_stream(const pt::TextStream & str, const FT & field_type, bool add_quotes, ModelEnv * model_env)
|
||||
{
|
||||
put_string_generic(str, field_type, add_quotes, model_env);
|
||||
}
|
||||
|
||||
|
||||
void BaseExpression::put_stream(const pt::WTextStream & str, const FT & field_type, bool add_quotes, ModelEnv * model_env)
|
||||
void BaseExpression::put_stream(const pt::Stream & str, const FT & field_type, bool add_quotes, ModelEnv * model_env)
|
||||
{
|
||||
put_string_generic(str, field_type, add_quotes, model_env);
|
||||
}
|
||||
@@ -1212,15 +1211,7 @@ void BaseExpression::string_to_stream(pt::Stream & stream, const std::wstring &
|
||||
}
|
||||
|
||||
|
||||
void BaseExpression::stream_to_stream(pt::Stream & stream_out, const pt::TextStream & stream_in, const FT & field_type, bool add_quotes, ModelEnv * model_env)
|
||||
{
|
||||
this->out_stream = &stream_out;
|
||||
put_stream(stream_in, field_type, add_quotes, model_env);
|
||||
this->out_stream = nullptr;
|
||||
}
|
||||
|
||||
|
||||
void BaseExpression::stream_to_stream(pt::Stream & stream_out, const pt::WTextStream & stream_in, const FT & field_type, bool add_quotes, ModelEnv * model_env)
|
||||
void BaseExpression::stream_to_stream(pt::Stream & stream_out, const pt::Stream & stream_in, const FT & field_type, bool add_quotes, ModelEnv * model_env)
|
||||
{
|
||||
this->out_stream = &stream_out;
|
||||
put_stream(stream_in, field_type, add_quotes, model_env);
|
||||
|
Reference in New Issue
Block a user