add Finder::like(...) and ilike(...) methods
This commit is contained in:
@@ -157,13 +157,13 @@ public:
|
||||
if( field_type.is_primary_key() )
|
||||
{
|
||||
if( model_env && model_env->has_primary_key_set )
|
||||
put_field_value(field_value, field_type);
|
||||
put_field_value(field_value, field_type, model_env);
|
||||
else
|
||||
put_null_value();
|
||||
}
|
||||
else
|
||||
{
|
||||
put_field_value(field_value, field_type);
|
||||
put_field_value(field_value, field_type, model_env);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -290,39 +290,39 @@ public:
|
||||
|
||||
|
||||
template<typename StringType>
|
||||
void put_string_generic(const StringType * str, const FT & field_type, bool add_quotes)
|
||||
void put_string_generic(const StringType * str, const FT & field_type, bool add_quotes, ModelEnv * model_env = nullptr)
|
||||
{
|
||||
if( out_stream )
|
||||
{
|
||||
if( add_quotes )
|
||||
{
|
||||
before_field_value_string(field_type);
|
||||
before_field_value_string(field_type, model_env);
|
||||
}
|
||||
|
||||
esc(str, *out_stream, field_type);
|
||||
esc(str, *out_stream, field_type, model_env);
|
||||
|
||||
if( add_quotes )
|
||||
{
|
||||
after_field_value_string(field_type);
|
||||
after_field_value_string(field_type, model_env);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename StringOrStreamType>
|
||||
void put_string_generic(const StringOrStreamType & str, const FT & field_type, bool add_quotes)
|
||||
void put_string_generic(const StringOrStreamType & str, const FT & field_type, bool add_quotes, ModelEnv * model_env = nullptr)
|
||||
{
|
||||
if( out_stream )
|
||||
{
|
||||
if( add_quotes )
|
||||
{
|
||||
before_field_value_string(field_type);
|
||||
before_field_value_string(field_type, model_env);
|
||||
}
|
||||
|
||||
esc(str, *out_stream, field_type);
|
||||
esc(str, *out_stream, field_type, model_env);
|
||||
|
||||
if( add_quotes )
|
||||
{
|
||||
after_field_value_string(field_type);
|
||||
after_field_value_string(field_type, model_env);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -332,36 +332,36 @@ public:
|
||||
* esc for: signed char, wchar_t, char16_t, char32_t
|
||||
*
|
||||
*/
|
||||
virtual bool esc_char(char val, pt::TextStream & stream);
|
||||
virtual bool esc_char(wchar_t val, pt::TextStream & stream);
|
||||
virtual bool esc_char(char val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual bool esc_char(wchar_t val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
|
||||
virtual void esc(char val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(unsigned char val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(wchar_t val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(char val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(unsigned char val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(wchar_t val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
|
||||
virtual void esc(const std::wstring & val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(const wchar_t * val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(const std::wstring & val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(const wchar_t * val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
|
||||
virtual void esc(const std::string & val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(const char * val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(const std::string & val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(const char * val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
|
||||
virtual void esc(bool val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(short val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(unsigned short val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(int val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(unsigned int val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(long val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(unsigned long val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(long long val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(unsigned long long val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(float val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(double val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(long double val, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(bool val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(short val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(unsigned short val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(int val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(unsigned int val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(long val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(unsigned long val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(long long val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(unsigned long long val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(float val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(double val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(long double val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
|
||||
virtual void esc(const pt::Date & date, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(const pt::TextStream & val,pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(const pt::WTextStream & val,pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(const pt::Space & space, pt::TextStream & stream, const FT & field_type = FT::default_type);
|
||||
virtual void esc(const pt::Date & date, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(const pt::TextStream & val,pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(const pt::WTextStream & val,pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
virtual void esc(const pt::Space & space, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr);
|
||||
|
||||
|
||||
|
||||
@@ -390,31 +390,31 @@ protected:
|
||||
virtual void add_additional_columns(Model & model);
|
||||
|
||||
template<typename FieldValue>
|
||||
void put_field_value(const FieldValue & field_value, const FT & field_type)
|
||||
void put_field_value(const FieldValue & field_value, const FT & field_type, ModelEnv * model_env = nullptr)
|
||||
{
|
||||
if( out_stream )
|
||||
{
|
||||
before_field_value(field_value, field_type);
|
||||
esc(field_value, *out_stream, field_type);
|
||||
after_field_value(field_value, field_type);
|
||||
before_field_value(field_value, field_type, model_env);
|
||||
esc(field_value, *out_stream, field_type, model_env);
|
||||
after_field_value(field_value, field_type, model_env);
|
||||
}
|
||||
}
|
||||
|
||||
void put_field_value(void (Model::*getter_method)(pt::Stream &), const FT & field_type, ModelEnv * model_env)
|
||||
void put_field_value(void (Model::*getter_method)(pt::Stream &), const FT & field_type, ModelEnv * model_env = nullptr)
|
||||
{
|
||||
if( out_stream && model_env && model_env->model && getter_method )
|
||||
{
|
||||
before_field_value_string(field_type);
|
||||
before_field_value_string(field_type, model_env);
|
||||
|
||||
if( scratch_buffer )
|
||||
{
|
||||
scratch_buffer->clear();
|
||||
(model_env->model->*getter_method)(*scratch_buffer);
|
||||
esc(*scratch_buffer, *out_stream, field_type);
|
||||
esc(*scratch_buffer, *out_stream, field_type, model_env);
|
||||
scratch_buffer->clear();
|
||||
}
|
||||
|
||||
after_field_value_string(field_type);
|
||||
after_field_value_string(field_type, model_env);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,7 +585,7 @@ protected:
|
||||
field_value_list_separator();
|
||||
}
|
||||
|
||||
put_field_value(v, FT::default_type);
|
||||
put_field_value(v, FT::default_type, model_env);
|
||||
is_first = false;
|
||||
}
|
||||
|
||||
@@ -608,37 +608,37 @@ protected:
|
||||
virtual void after_field_name();
|
||||
|
||||
|
||||
virtual void before_field_value(const std::wstring &, const FT & field_type);
|
||||
virtual void after_field_value(const std::wstring &, const FT & field_type);
|
||||
virtual void before_field_value(const std::wstring &, const FT & field_type, ModelEnv * model_env);
|
||||
virtual void after_field_value(const std::wstring &, const FT & field_type, ModelEnv * model_env);
|
||||
|
||||
virtual void before_field_value(const std::string &, const FT & field_type);
|
||||
virtual void after_field_value(const std::string &, const FT & field_type);
|
||||
virtual void before_field_value(const std::string &, const FT & field_type, ModelEnv * model_env);
|
||||
virtual void after_field_value(const std::string &, const FT & field_type, ModelEnv * model_env);
|
||||
|
||||
virtual void before_field_value(const wchar_t *, const FT & field_type);
|
||||
virtual void after_field_value(const wchar_t *, const FT & field_type);
|
||||
virtual void before_field_value(const wchar_t *, const FT & field_type, ModelEnv * model_env);
|
||||
virtual void after_field_value(const wchar_t *, const FT & field_type, ModelEnv * model_env);
|
||||
|
||||
virtual void before_field_value(const char *, const FT & field_type);
|
||||
virtual void after_field_value(const char *, const FT & field_type);
|
||||
virtual void before_field_value(const char *, const FT & field_type, ModelEnv * model_env);
|
||||
virtual void after_field_value(const char *, const FT & field_type, ModelEnv * model_env);
|
||||
|
||||
virtual void before_field_value(wchar_t, const FT & field_type);
|
||||
virtual void after_field_value(wchar_t, const FT & field_type);
|
||||
virtual void before_field_value(wchar_t, const FT & field_type, ModelEnv * model_env);
|
||||
virtual void after_field_value(wchar_t, const FT & field_type, ModelEnv * model_env);
|
||||
|
||||
virtual void before_field_value(char, const FT & field_type);
|
||||
virtual void after_field_value(char, const FT & field_type);
|
||||
virtual void before_field_value(char, const FT & field_type, ModelEnv * model_env);
|
||||
virtual void after_field_value(char, const FT & field_type, ModelEnv * model_env);
|
||||
|
||||
virtual void before_field_value(const pt::Date &, const FT & field_type);
|
||||
virtual void after_field_value(const pt::Date &, const FT & field_type);
|
||||
virtual void before_field_value(const pt::Date &, const FT & field_type, ModelEnv * model_env);
|
||||
virtual void after_field_value(const pt::Date &, const FT & field_type, ModelEnv * model_env);
|
||||
|
||||
virtual void before_field_value(const pt::Space &, const FT & field_type);
|
||||
virtual void after_field_value(const pt::Space &, const FT & field_type);
|
||||
virtual void before_field_value(const pt::Space &, const FT & field_type, ModelEnv * model_env);
|
||||
virtual void after_field_value(const pt::Space &, const FT & field_type, ModelEnv * model_env);
|
||||
|
||||
template<typename FieldValue>
|
||||
void before_field_value(const FieldValue &, const FT & field_type)
|
||||
void before_field_value(const FieldValue &, const FT & field_type, ModelEnv * model_env)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename FieldValue>
|
||||
void after_field_value(const FieldValue &, const FT & field_type)
|
||||
void after_field_value(const FieldValue &, const FT & field_type, ModelEnv * model_env)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -690,32 +690,32 @@ protected:
|
||||
|
||||
|
||||
|
||||
virtual void before_field_value_string(const FT & field_type);
|
||||
virtual void after_field_value_string(const FT & field_type);
|
||||
virtual void before_field_value_string(const FT & field_type, ModelEnv * model_env);
|
||||
virtual void after_field_value_string(const FT & field_type, ModelEnv * model_env);
|
||||
|
||||
char char_to_hex_part(char c);
|
||||
void char_to_hex(char c, pt::TextStream & stream);
|
||||
void char_to_hex(wchar_t c, pt::TextStream & stream);
|
||||
|
||||
void esc(const wchar_t * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type);
|
||||
void esc(const char * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type);
|
||||
void esc(const wchar_t * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env);
|
||||
void esc(const char * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env);
|
||||
|
||||
bool is_empty_field(const wchar_t * value);
|
||||
|
||||
|
||||
|
||||
template<typename CharType>
|
||||
void esc_normal_string(CharType * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type)
|
||||
void esc_normal_string(CharType * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env)
|
||||
{
|
||||
for(size_t i = 0 ; has_known_length ? (i < len) : val[i] != 0 ; ++i)
|
||||
{
|
||||
esc(val[i], stream, field_type);
|
||||
esc(val[i], stream, field_type, model_env);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename CharType>
|
||||
void esc_numeric_string(CharType * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type)
|
||||
void esc_numeric_string(CharType * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env)
|
||||
{
|
||||
bool was_comma = false;
|
||||
bool was_something_printed = false;
|
||||
@@ -729,7 +729,7 @@ protected:
|
||||
|
||||
if( (c=='.' && !was_comma) || (c>='0' && c<='9') )
|
||||
{
|
||||
esc(c, stream, field_type);
|
||||
esc(c, stream, field_type, model_env);
|
||||
was_something_printed = true;
|
||||
|
||||
if( c == '.' )
|
||||
@@ -739,7 +739,7 @@ protected:
|
||||
|
||||
if( !was_something_printed )
|
||||
{
|
||||
esc(static_cast<CharType>('0'), stream, field_type);
|
||||
esc(static_cast<CharType>('0'), stream, field_type, model_env);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user