Browse Source

namespace PT renamed to pt

pull/4/head
Tomasz Sowa 1 month ago
parent
commit
34274ca230
  1. 2
      samples/attachment.h
  2. 2
      samples/attachment2.h
  3. 16
      samples/main.cpp
  4. 156
      src/baseexpression.cpp
  5. 162
      src/baseexpression.h
  6. 4
      src/clearer.cpp
  7. 4
      src/clearer.h
  8. 76
      src/dbconnector.cpp
  9. 40
      src/dbconnector.h
  10. 8
      src/dbexpression.cpp
  11. 8
      src/dbexpression.h
  12. 16
      src/finder.h
  13. 4
      src/finderhelper.h
  14. 2
      src/flatconnector.cpp
  15. 2
      src/flatconnector.h
  16. 2
      src/flatexpression.cpp
  17. 2
      src/flatexpression.h
  18. 4
      src/jsonexpression.cpp
  19. 2
      src/jsonexpression.h
  20. 76
      src/model.cpp
  21. 54
      src/model.h
  22. 12
      src/modelconnector.cpp
  23. 14
      src/modelconnector.h
  24. 4
      src/modelenv.h
  25. 46
      src/postgresqlconnector.cpp
  26. 14
      src/postgresqlconnector.h
  27. 6
      src/postgresqlexpression.cpp
  28. 6
      src/postgresqlexpression.h
  29. 14
      src/postgresqlqueryresult.cpp
  30. 2
      src/postgresqlqueryresult.h
  31. 6
      src/queryresult.cpp
  32. 2
      src/queryresult.h

2
samples/attachment.h

@ -71,7 +71,7 @@ public:
std::string content;
std::vector<Type> types;
bool some_flags;
PT::Date created_date;
pt::Date created_date;
Language language;

2
samples/attachment2.h

@ -71,7 +71,7 @@ public:
std::string content;
std::vector<Type> types;
bool some_flags;
PT::Date created_date;
pt::Date created_date;
Language language;

16
samples/main.cpp

@ -61,17 +61,17 @@ void print_syntax()
int main(int argc, const char ** argv)
{
PT::Space args;
PT::Space & args_options = args.FindAddSpace(L"options");
pt::Space args;
pt::Space & args_options = args.FindAddSpace(L"options");
args_options.Add(L"c", 1); // one argument - config file
args_options.Add(L"config", 1);
PT::MainSpaceParser main_parser;
pt::MainSpaceParser main_parser;
main_parser.UTF8(true);
main_parser.SetSpace(args);
PT::MainSpaceParser::Status args_status = main_parser.Parse(argc, argv);
pt::MainSpaceParser::Status args_status = main_parser.Parse(argc, argv);
if( args_status != PT::MainSpaceParser::status_ok )
if( args_status != pt::MainSpaceParser::status_ok )
{
std::cout << "Syntax error in arguments" << std::endl;
return 1;
@ -101,9 +101,9 @@ args_options.Add(L"config", 1);
* create database morm_test owner morm_test;
*
*/
PT::Log log;
PT::FileLog file_log;
PT::WTextStream log_buffer;
pt::Log log;
pt::FileLog file_log;
pt::WTextStream log_buffer;
file_log.init(L"log.txt", true, 4, true);
log.SetLogBuffer(&log_buffer);

156
src/baseexpression.cpp

@ -74,12 +74,12 @@ int BaseExpression::get_work_mode()
PT::TextStream * BaseExpression::get_text_stream()
pt::TextStream * BaseExpression::get_text_stream()
{
return out_stream;
}
void BaseExpression::set_text_stream(PT::TextStream * out_stream)
void BaseExpression::set_text_stream(pt::TextStream * out_stream)
{
this->out_stream = out_stream;
}
@ -88,7 +88,7 @@ void BaseExpression::set_text_stream(PT::TextStream * out_stream)
PT::TextStream * BaseExpression::get_current_stream()
pt::TextStream * BaseExpression::get_current_stream()
{
return out_stream;
}
@ -107,7 +107,7 @@ bool BaseExpression::get_allow_to_use_prefix()
void BaseExpression::generate_from_model(PT::TextStream & stream, Model & model)
void BaseExpression::generate_from_model(pt::TextStream & stream, Model & model)
{
this->out_stream = &stream;
generate_from_model(model);
@ -208,8 +208,8 @@ void BaseExpression::put_field_name(const wchar_t * field_name, const FT & field
void BaseExpression::save_foreign_key(const wchar_t * field_name, const FT & field_type, ModelEnv * model_env)
{
PT::TextStream str;
PT::TextStream * old_out_stream = out_stream;
pt::TextStream str;
pt::TextStream * old_out_stream = out_stream;
out_stream = &str;
put_field_name(field_name, field_type, model_env);
@ -337,22 +337,22 @@ void BaseExpression::after_field_value(char, const FT & field_type)
after_field_value_string(field_type);
}
void BaseExpression::before_field_value(const PT::Date &, const FT & field_type)
void BaseExpression::before_field_value(const pt::Date &, const FT & field_type)
{
before_field_value_string(field_type);
}
void BaseExpression::after_field_value(const PT::Date &, const FT & field_type)
void BaseExpression::after_field_value(const pt::Date &, const FT & field_type)
{
after_field_value_string(field_type);
}
void BaseExpression::before_field_value(const PT::Space &, const FT & field_type)
void BaseExpression::before_field_value(const pt::Space &, const FT & field_type)
{
before_field_value_string(field_type);
}
void BaseExpression::after_field_value(const PT::Space &, const FT & field_type)
void BaseExpression::after_field_value(const pt::Space &, const FT & field_type)
{
after_field_value_string(field_type);
}
@ -373,7 +373,7 @@ char BaseExpression::char_to_hex_part(char c)
}
void BaseExpression::char_to_hex(char c, PT::TextStream & stream)
void BaseExpression::char_to_hex(char c, pt::TextStream & stream)
{
stream << char_to_hex_part(((unsigned char)c) >> 4);
stream << char_to_hex_part(((unsigned char)c) & 0x0f);
@ -382,7 +382,7 @@ void BaseExpression::char_to_hex(char c, PT::TextStream & stream)
void BaseExpression::esc(char val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(char val, pt::TextStream & stream, const FT & field_type)
{
if( field_type.is_binary() || field_type.is_hexadecimal() )
{
@ -395,19 +395,19 @@ void BaseExpression::esc(char val, PT::TextStream & stream, const FT & field_typ
}
void BaseExpression::esc(unsigned char val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(unsigned char val, pt::TextStream & stream, const FT & field_type)
{
esc(static_cast<char>(val), stream, field_type);
}
void BaseExpression::esc(wchar_t val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(wchar_t val, pt::TextStream & stream, const FT & field_type)
{
if( field_type.use_utf8() )
{
char utf8_buf[10];
size_t utf8_len = PT::IntToUTF8((int)val, utf8_buf, sizeof(utf8_buf));
size_t utf8_len = pt::IntToUTF8((int)val, utf8_buf, sizeof(utf8_buf));
for(size_t a = 0 ; a < utf8_len ; ++a)
{
@ -421,7 +421,7 @@ void BaseExpression::esc(wchar_t val, PT::TextStream & stream, const FT & field_
}
void BaseExpression::esc(const wchar_t * val, bool has_known_length, size_t len, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(const wchar_t * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type)
{
if( field_type.use_utf8() )
{
@ -429,7 +429,7 @@ void BaseExpression::esc(const wchar_t * val, bool has_known_length, size_t len,
for(size_t i = 0 ; has_known_length ? (i < len) : val[i] != 0 ; ++i)
{
size_t utf8_len = PT::IntToUTF8((int)val[i], utf8_buf, sizeof(utf8_buf));
size_t utf8_len = pt::IntToUTF8((int)val[i], utf8_buf, sizeof(utf8_buf));
for(size_t a = 0 ; a < utf8_len ; ++a)
{
@ -447,19 +447,19 @@ void BaseExpression::esc(const wchar_t * val, bool has_known_length, size_t len,
}
void BaseExpression::esc(const std::wstring & val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(const std::wstring & val, pt::TextStream & stream, const FT & field_type)
{
esc(val.c_str(), true, val.size(), stream, field_type);
}
void BaseExpression::esc(const wchar_t * val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(const wchar_t * val, pt::TextStream & stream, const FT & field_type)
{
esc(val, false, 0, stream, field_type);
}
void BaseExpression::esc(const std::string & val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(const std::string & val, pt::TextStream & stream, const FT & field_type)
{
for(size_t i = 0 ; i < val.size() ; ++i)
{
@ -468,7 +468,7 @@ void BaseExpression::esc(const std::string & val, PT::TextStream & stream, const
}
void BaseExpression::esc(const char * val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(const char * val, pt::TextStream & stream, const FT & field_type)
{
for(size_t i = 0 ; val[i] != 0 ; ++i)
{
@ -477,7 +477,7 @@ void BaseExpression::esc(const char * val, PT::TextStream & stream, const FT & f
}
void BaseExpression::esc(bool val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(bool val, pt::TextStream & stream, const FT & field_type)
{
if( val )
stream << "true";
@ -486,82 +486,82 @@ void BaseExpression::esc(bool val, PT::TextStream & stream, const FT & field_typ
}
void BaseExpression::esc(short val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(short val, pt::TextStream & stream, const FT & field_type)
{
stream << val;
}
void BaseExpression::esc(unsigned short val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(unsigned short val, pt::TextStream & stream, const FT & field_type)
{
stream << val;
}
void BaseExpression::esc(int val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(int val, pt::TextStream & stream, const FT & field_type)
{
stream << val;
}
void BaseExpression::esc(unsigned int val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(unsigned int val, pt::TextStream & stream, const FT & field_type)
{
stream << val;
}
void BaseExpression::esc(long val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(long val, pt::TextStream & stream, const FT & field_type)
{
stream << val;
}
void BaseExpression::esc(unsigned long val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(unsigned long val, pt::TextStream & stream, const FT & field_type)
{
stream << val;
}
void BaseExpression::esc(long long val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(long long val, pt::TextStream & stream, const FT & field_type)
{
// not implemented in PT::TextStream yet
// not implemented in pt::TextStream yet
//stream << val;
}
void BaseExpression::esc(unsigned long long val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(unsigned long long val, pt::TextStream & stream, const FT & field_type)
{
//stream << val;
}
void BaseExpression::esc(float val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(float val, pt::TextStream & stream, const FT & field_type)
{
stream << val;
}
void BaseExpression::esc(double val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(double val, pt::TextStream & stream, const FT & field_type)
{
stream << val;
}
void BaseExpression::esc(long double val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(long double val, pt::TextStream & stream, const FT & field_type)
{
// IMPLEMENT ME in PT::TextStream
// IMPLEMENT ME in pt::TextStream
//stream << val;
}
void BaseExpression::esc(const PT::Date & date, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(const pt::Date & date, pt::TextStream & stream, const FT & field_type)
{
stream << date;
}
void BaseExpression::esc(const PT::TextStream & val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(const pt::TextStream & val, pt::TextStream & stream, const FT & field_type)
{
PT::TextStream::const_iterator i = val.begin();
pt::TextStream::const_iterator i = val.begin();
for(; i != val.end() ; ++i)
{
@ -569,9 +569,9 @@ void BaseExpression::esc(const PT::TextStream & val, PT::TextStream & stream, co
}
}
void BaseExpression::esc(const PT::WTextStream & val, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(const pt::WTextStream & val, pt::TextStream & stream, const FT & field_type)
{
PT::WTextStream::const_iterator i = val.begin();
pt::WTextStream::const_iterator i = val.begin();
for(; i != val.end() ; ++i)
{
@ -579,119 +579,119 @@ void BaseExpression::esc(const PT::WTextStream & val, PT::TextStream & stream, c
}
}
void BaseExpression::esc(const PT::Space & space, PT::TextStream & stream, const FT & field_type)
void BaseExpression::esc(const pt::Space & space, pt::TextStream & stream, const FT & field_type)
{
PT::WTextStream tmp_stream;
pt::WTextStream tmp_stream;
space.serialize_to_space_stream(tmp_stream, true);
esc(tmp_stream, stream, field_type);
}
//void BaseExpression::put_type(char val, PT::TextStream & stream)
//void BaseExpression::put_type(char val, pt::TextStream & stream)
//{
// stream << "char";
//}
//
//void BaseExpression::put_type(unsigned char val, PT::TextStream & stream)
//void BaseExpression::put_type(unsigned char val, pt::TextStream & stream)
//{
// stream << "unsigned char";
//}
//
//
//void BaseExpression::put_type(const std::wstring & val, PT::TextStream & stream)
//void BaseExpression::put_type(const std::wstring & val, pt::TextStream & stream)
//{
// stream << "text";
//}
//
//void BaseExpression::put_type(const wchar_t * val, PT::TextStream & stream)
//void BaseExpression::put_type(const wchar_t * val, pt::TextStream & stream)
//{
// stream << "text";
//}
//
//
//void BaseExpression::put_type(const std::string & val, PT::TextStream & stream)
//void BaseExpression::put_type(const std::string & val, pt::TextStream & stream)
//{
// stream << "text";
//}
//
//void BaseExpression::put_type(const char * val, PT::TextStream & stream)
//void BaseExpression::put_type(const char * val, pt::TextStream & stream)
//{
// stream << "text";
//}
//
//
//void BaseExpression::put_type(bool val, PT::TextStream & stream)
//void BaseExpression::put_type(bool val, pt::TextStream & stream)
//{
// stream << "boolean";
//}
//
//void BaseExpression::put_type(short val, PT::TextStream & stream)
//void BaseExpression::put_type(short val, pt::TextStream & stream)
//{
// stream << "short integer";
//}
//
//void BaseExpression::put_type(unsigned short val, PT::TextStream & stream)
//void BaseExpression::put_type(unsigned short val, pt::TextStream & stream)
//{
// stream << "unsigned short integer";
//}
//
//void BaseExpression::put_type(int val, PT::TextStream & stream)
//void BaseExpression::put_type(int val, pt::TextStream & stream)
//{
// stream << "integer";
//}
//
//void BaseExpression::put_type(unsigned int val, PT::TextStream & stream)
//void BaseExpression::put_type(unsigned int val, pt::TextStream & stream)
//{
// stream << "unsigned integer";
//}
//
//void BaseExpression::put_type(long val, PT::TextStream & stream)
//void BaseExpression::put_type(long val, pt::TextStream & stream)
//{
// stream << "long integer";
//}
//
//void BaseExpression::put_type(unsigned long val, PT::TextStream & stream)
//void BaseExpression::put_type(unsigned long val, pt::TextStream & stream)
//{
// stream << "unsigned long integer";
//}
//
//void BaseExpression::put_type(long long val, PT::TextStream & stream)
//void BaseExpression::put_type(long long val, pt::TextStream & stream)
//{
// stream << "very long integer";
//}
//
//void BaseExpression::put_type(unsigned long long val, PT::TextStream & stream)
//void BaseExpression::put_type(unsigned long long val, pt::TextStream & stream)
//{
// stream << "unsigned very long integer";
//}
//
//void BaseExpression::put_type(float val, PT::TextStream & stream)
//void BaseExpression::put_type(float val, pt::TextStream & stream)
//{
// stream << "float";
//}
//
//void BaseExpression::put_type(double val, PT::TextStream & stream)
//void BaseExpression::put_type(double val, pt::TextStream & stream)
//{
// stream << "double";
//}
//
//void BaseExpression::put_type(long double val, PT::TextStream & stream)
//void BaseExpression::put_type(long double val, pt::TextStream & stream)
//{
// stream << "long double";
//}
//
////void BaseExpression::put_type(void* val, PT::TextStream & stream)
////void BaseExpression::put_type(void* val, pt::TextStream & stream)
////{
////}
//
//
//void BaseExpression::put_type(const PT::Date & date, PT::TextStream & stream)
//void BaseExpression::put_type(const pt::Date & date, pt::TextStream & stream)
//{
// stream << "date";
//}
//
//void BaseExpression::put_type(const Model & model, PT::TextStream & stream)
//void BaseExpression::put_type(const Model & model, pt::TextStream & stream)
//{
// stream << "object";
//}
@ -740,7 +740,7 @@ void BaseExpression::put_schema_table(const wchar_t * schema_name, const wchar_t
/*
* schema_name can be empty - in such a case we do not put the schema name
*/
void BaseExpression::put_schema_table(const PT::WTextStream & schema_name, const PT::WTextStream & table_name)
void BaseExpression::put_schema_table(const pt::WTextStream & schema_name, const pt::WTextStream & table_name)
{
if( out_stream )
{
@ -778,7 +778,7 @@ void BaseExpression::put_table(const wchar_t * table_name)
}
void BaseExpression::put_table(const PT::WTextStream & table_name)
void BaseExpression::put_table(const pt::WTextStream & table_name)
{
if( out_stream )
{
@ -806,7 +806,7 @@ void BaseExpression::put_table_with_index(const wchar_t * table_name, int index)
}
void BaseExpression::put_table_with_index(const PT::WTextStream & table_name, int index)
void BaseExpression::put_table_with_index(const pt::WTextStream & table_name, int index)
{
if( out_stream )
{
@ -833,7 +833,7 @@ void BaseExpression::put_table_with_index_and_field(const wchar_t * table_name,
}
}
void BaseExpression::put_table_with_index_and_field(const PT::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type)
void BaseExpression::put_table_with_index_and_field(const pt::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type)
{
if( out_stream )
{
@ -854,7 +854,7 @@ void BaseExpression::put_table_and_field(const wchar_t * table_name, const wchar
}
}
void BaseExpression::put_table_and_field(const PT::WTextStream & table_name, const wchar_t * field_name, const FT & field_type)
void BaseExpression::put_table_and_field(const pt::WTextStream & table_name, const wchar_t * field_name, const FT & field_type)
{
if( out_stream )
{
@ -866,7 +866,7 @@ void BaseExpression::put_table_and_field(const PT::WTextStream & table_name, con
void BaseExpression::schema_table_to_stream(PT::TextStream & stream, const wchar_t * schema_name, const wchar_t * table_name)
void BaseExpression::schema_table_to_stream(pt::TextStream & stream, const wchar_t * schema_name, const wchar_t * table_name)
{
this->out_stream = &stream;
put_schema_table(schema_name, table_name);
@ -874,7 +874,7 @@ void BaseExpression::schema_table_to_stream(PT::TextStream & stream, const wchar
}
void BaseExpression::schema_table_to_stream(PT::TextStream & stream, const PT::WTextStream & schema_name, const PT::WTextStream & table_name)
void BaseExpression::schema_table_to_stream(pt::TextStream & stream, const pt::WTextStream & schema_name, const pt::WTextStream & table_name)
{
this->out_stream = &stream;
put_schema_table(schema_name, table_name);
@ -882,7 +882,7 @@ void BaseExpression::schema_table_to_stream(PT::TextStream & stream, const PT::W
}
void BaseExpression::table_to_stream(PT::TextStream & stream, const wchar_t * table_name)
void BaseExpression::table_to_stream(pt::TextStream & stream, const wchar_t * table_name)
{
this->out_stream = &stream;
put_table(table_name);
@ -890,7 +890,7 @@ void BaseExpression::table_to_stream(PT::TextStream & stream, const wchar_t * ta
}
void BaseExpression::table_to_stream(PT::TextStream & stream, const PT::WTextStream & table_name)
void BaseExpression::table_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name)
{
this->out_stream = &stream;
put_table(table_name);
@ -898,7 +898,7 @@ void BaseExpression::table_to_stream(PT::TextStream & stream, const PT::WTextStr
}
void BaseExpression::table_with_index_to_stream(PT::TextStream & stream, const wchar_t * table_name, int index)
void BaseExpression::table_with_index_to_stream(pt::TextStream & stream, const wchar_t * table_name, int index)
{
this->out_stream = &stream;
put_table_with_index(table_name, index);
@ -906,7 +906,7 @@ void BaseExpression::table_with_index_to_stream(PT::TextStream & stream, const w
}
void BaseExpression::table_with_index_to_stream(PT::TextStream & stream, const PT::WTextStream & table_name, int index)
void BaseExpression::table_with_index_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name, int index)
{
this->out_stream = &stream;
put_table_with_index(table_name, index);
@ -914,7 +914,7 @@ void BaseExpression::table_with_index_to_stream(PT::TextStream & stream, const P
}
void BaseExpression::table_with_index_and_field_to_stream(PT::TextStream & stream, const wchar_t * table_name, int index, const wchar_t * field_name, const FT & field_type)
void BaseExpression::table_with_index_and_field_to_stream(pt::TextStream & stream, const wchar_t * table_name, int index, const wchar_t * field_name, const FT & field_type)
{
this->out_stream = &stream;
put_table_with_index_and_field(table_name, index, field_name, field_type);
@ -922,7 +922,7 @@ void BaseExpression::table_with_index_and_field_to_stream(PT::TextStream & strea
}
void BaseExpression::table_with_index_and_field_to_stream(PT::TextStream & stream, const PT::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type)
void BaseExpression::table_with_index_and_field_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type)
{
this->out_stream = &stream;
put_table_with_index_and_field(table_name, index, field_name, field_type);
@ -930,7 +930,7 @@ void BaseExpression::table_with_index_and_field_to_stream(PT::TextStream & strea
}
void BaseExpression::table_and_field_to_stream(PT::TextStream & stream, const wchar_t * table_name, const wchar_t * field_name, const FT & field_type)
void BaseExpression::table_and_field_to_stream(pt::TextStream & stream, const wchar_t * table_name, const wchar_t * field_name, const FT & field_type)
{
this->out_stream = &stream;
put_table_and_field(table_name, field_name, field_type);
@ -938,7 +938,7 @@ void BaseExpression::table_and_field_to_stream(PT::TextStream & stream, const wc
}
void BaseExpression::table_and_field_to_stream(PT::TextStream & stream, const PT::WTextStream & table_name, const wchar_t * field_name, const FT & field_type)
void BaseExpression::table_and_field_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name, const wchar_t * field_name, const FT & field_type)
{
this->out_stream = &stream;
put_table_and_field(table_name, field_name, field_type);

162
src/baseexpression.h

@ -60,14 +60,14 @@ public:
virtual void set_work_mode(int work_mode);
virtual int get_work_mode();
virtual PT::TextStream * get_text_stream();
virtual void set_text_stream(PT::TextStream * out_stream);
virtual pt::TextStream * get_text_stream();
virtual void set_text_stream(pt::TextStream * out_stream);
virtual void clear();
virtual void generate_from_model(PT::TextStream & stream, Model & model);
virtual void generate_from_model(pt::TextStream & stream, Model & model);
virtual PT::TextStream * get_current_stream();
virtual pt::TextStream * get_current_stream();
// rename me
virtual void allow_to_use_prefix(bool use_prefix);
@ -143,21 +143,21 @@ public:
}
template<typename FieldValue>
void field_in(PT::TextStream & stream, const wchar_t * field_name, const std::set<FieldValue> & container, ModelEnv * model_env)
void field_in(pt::TextStream & stream, const wchar_t * field_name, const std::set<FieldValue> & container, ModelEnv * model_env)
{
field_in_generic<FieldValue, std::set<FieldValue>>(stream, field_name, container, model_env);
}
template<typename FieldValue>
void field_in(PT::TextStream & stream, const wchar_t * field_name, const std::list<FieldValue> & container, ModelEnv * model_env)
void field_in(pt::TextStream & stream, const wchar_t * field_name, const std::list<FieldValue> & container, ModelEnv * model_env)
{
field_in_generic<FieldValue, std::list<FieldValue>>(stream, field_name, container, model_env);
}
template<typename FieldValue>
void field_in(PT::TextStream & stream, const wchar_t * field_name, const std::vector<FieldValue> & container, ModelEnv * model_env)
void field_in(pt::TextStream & stream, const wchar_t * field_name, const std::vector<FieldValue> & container, ModelEnv * model_env)
{
field_in_generic<FieldValue, std::vector<FieldValue>>(stream, field_name, container, model_env);
}
@ -215,7 +215,7 @@ public:
}
template<typename FieldValue>
void field_to_stream(PT::TextStream & stream, const wchar_t * field_name, const FieldValue & field_value, const FT & field_type, ModelEnv * model_env)
void field_to_stream(pt::TextStream & stream, const wchar_t * field_name, const FieldValue & field_value, const FT & field_type, ModelEnv * model_env)
{
this->out_stream = &stream;
field(field_name, field_value, field_type, model_env);
@ -224,26 +224,26 @@ public:
virtual void put_schema_table(const wchar_t * schema_name, const wchar_t * table_name);
virtual void put_schema_table(const PT::WTextStream & schema_name, const PT::WTextStream & table_name);
virtual void put_schema_table(const pt::WTextStream & schema_name, const pt::WTextStream & table_name);
virtual void put_table(const wchar_t * table_name);
virtual void put_table(const PT::WTextStream & table_name);
virtual void put_table(const pt::WTextStream & table_name);
virtual void put_table_with_index(const wchar_t * table_name, int index);
virtual void put_table_with_index(const PT::WTextStream & table_name, int index);
virtual void put_table_with_index(const pt::WTextStream & table_name, int index);
virtual void put_table_with_index_and_field(const wchar_t * table_name, int index, const wchar_t * field_name, const FT & field_type);
virtual void put_table_with_index_and_field(const PT::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type);
virtual void put_table_with_index_and_field(const pt::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type);
virtual void put_table_and_field(const wchar_t * table_name, const wchar_t * field_name, const FT & field_type);
virtual void put_table_and_field(const PT::WTextStream & table_name, const wchar_t * field_name, const FT & field_type);
virtual void put_table_and_field(const pt::WTextStream & table_name, const wchar_t * field_name, const FT & field_type);
virtual void schema_table_to_stream(PT::TextStream & stream, const wchar_t * schema_name, const wchar_t * table_name);
virtual void schema_table_to_stream(PT::TextStream & stream, const PT::WTextStream & schema_name, const PT::WTextStream & table_name);
virtual void table_to_stream(PT::TextStream & stream, const wchar_t * table_name);
virtual void table_to_stream(PT::TextStream & stream, const PT::WTextStream & table_name);
virtual void table_with_index_to_stream(PT::TextStream & stream, const wchar_t * table_name, int index);
virtual void table_with_index_to_stream(PT::TextStream & stream, const PT::WTextStream & table_name, int index);
virtual void table_with_index_and_field_to_stream(PT::TextStream & stream, const wchar_t * table_name, int index, const wchar_t * field_name, const FT & field_type);
virtual void table_with_index_and_field_to_stream(PT::TextStream & stream, const PT::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type);
virtual void table_and_field_to_stream(PT::TextStream & stream, const wchar_t * table_name, const wchar_t * field_name, const FT & field_type);
virtual void table_and_field_to_stream(PT::TextStream & stream, const PT::WTextStream & table_name, const wchar_t * field_name, const FT & field_type);
virtual void schema_table_to_stream(pt::TextStream & stream, const wchar_t * schema_name, const wchar_t * table_name);
virtual void schema_table_to_stream(pt::TextStream & stream, const pt::WTextStream & schema_name, const pt::WTextStream & table_name);
virtual void table_to_stream(pt::TextStream & stream, const wchar_t * table_name);
virtual void table_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name);
virtual void table_with_index_to_stream(pt::TextStream & stream, const wchar_t * table_name, int index);
virtual void table_with_index_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name, int index);
virtual void table_with_index_and_field_to_stream(pt::TextStream & stream, const wchar_t * table_name, int index, const wchar_t * field_name, const FT & field_type);
virtual void table_with_index_and_field_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type);
virtual void table_and_field_to_stream(pt::TextStream & stream, const wchar_t * table_name, const wchar_t * field_name, const FT & field_type);
virtual void table_and_field_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name, const wchar_t * field_name, const FT & field_type);
/*
@ -251,35 +251,35 @@ public:
* esc for: signed char, wchar_t, char16_t, char32_t
*
*/
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(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(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);
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);
virtual void esc(const wchar_t * 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);
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);
virtual void esc(const char * 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);
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(void* val, PT::TextStream & stream);
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(void* val, pt::TextStream & stream);
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);
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);
@ -288,7 +288,7 @@ protected:
int work_mode; /* what to do: generating fields list, values list or fields-values list */
bool is_first_field;
PT::TextStream * out_stream;
pt::TextStream * out_stream;
bool use_prefix;
@ -485,7 +485,7 @@ protected:
put_field_value_list_non_model(field_value, model_connector);
}
void put_field_value_list(std::vector<PT::Date> & field_value, ModelConnector * model_connector, ModelEnv *)
void put_field_value_list(std::vector<pt::Date> & field_value, ModelConnector * model_connector, ModelEnv *)
{
put_field_value_list_non_model(field_value, model_connector);
}
@ -574,7 +574,7 @@ protected:
put_field_value_list_non_model(field_value, model_connector);
}
void put_field_value_list(std::list<PT::Date> & field_value, ModelConnector * model_connector, ModelEnv *)
void put_field_value_list(std::list<pt::Date> & field_value, ModelConnector * model_connector, ModelEnv *)
{
put_field_value_list_non_model(field_value, model_connector);
}
@ -583,7 +583,7 @@ protected:
// used in 'in()' statements, may should be renamed?
template<typename FieldValue, typename Container>
void field_in_generic(PT::TextStream & stream, const wchar_t * field_name, const Container & container, ModelEnv * model_env)
void field_in_generic(pt::TextStream & stream, const wchar_t * field_name, const Container & container, ModelEnv * model_env)
{
// IMPROVE ME
// what about if container is empty?
@ -645,11 +645,11 @@ protected:
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(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);
virtual void after_field_value(const pt::Date &, const FT & field_type);
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);
virtual void after_field_value(const pt::Space &, const FT & field_type);
template<typename FieldValue>
void before_field_value(const FieldValue &, const FT & field_type)
@ -669,40 +669,40 @@ protected:
* put_type for: signed char, wchar_t, char16_t, char32_t
*
*/
// virtual void put_type(char val, PT::TextStream & stream);
// virtual void put_type(unsigned char val, PT::TextStream & stream);
// virtual void put_type(char val, pt::TextStream & stream);
// virtual void put_type(unsigned char val, pt::TextStream & stream);
//
// virtual void put_type(const std::wstring & val, PT::TextStream & stream);
// virtual void put_type(const wchar_t * val, PT::TextStream & stream);
// virtual void put_type(const std::wstring & val, pt::TextStream & stream);
// virtual void put_type(const wchar_t * val, pt::TextStream & stream);
//
// virtual void put_type(const std::string & val, PT::TextStream & stream);
// virtual void put_type(const char * val, PT::TextStream & stream);
// virtual void put_type(const std::string & val, pt::TextStream & stream);
// virtual void put_type(const char * val, pt::TextStream & stream);
//
// virtual void put_type(bool val, PT::TextStream & stream);
// virtual void put_type(short val, PT::TextStream & stream);
// virtual void put_type(unsigned short val, PT::TextStream & stream);
// virtual void put_type(int val, PT::TextStream & stream);
// virtual void put_type(unsigned int val, PT::TextStream & stream);
// virtual void put_type(long val, PT::TextStream & stream);
// virtual void put_type(unsigned long val, PT::TextStream & stream);
// virtual void put_type(long long val, PT::TextStream & stream);
// virtual void put_type(unsigned long long val, PT::TextStream & stream);
// virtual void put_type(float val, PT::TextStream & stream);
// virtual void put_type(double val, PT::TextStream & stream);
// virtual void put_type(long double val, PT::TextStream & stream);
//virtual void put_type(void* val, PT::TextStream & stream);
// virtual void put_type(const PT::Date & date, PT::TextStream & stream);
// virtual void put_type(const Model & model, PT::TextStream & stream);
// virtual void put_type(bool val, pt::TextStream & stream);
// virtual void put_type(short val, pt::TextStream & stream);
// virtual void put_type(unsigned short val, pt::TextStream & stream);
// virtual void put_type(int val, pt::TextStream & stream);
// virtual void put_type(unsigned int val, pt::TextStream & stream);
// virtual void put_type(long val, pt::TextStream & stream);
// virtual void put_type(unsigned long val, pt::TextStream & stream);
// virtual void put_type(long long val, pt::TextStream & stream);
// virtual void put_type(unsigned long long val, pt::TextStream & stream);
// virtual void put_type(float val, pt::TextStream & stream);
// virtual void put_type(double val, pt::TextStream & stream);
// virtual void put_type(long double val, pt::TextStream & stream);
//virtual void put_type(void* val, pt::TextStream & stream);
// virtual void put_type(const pt::Date & date, pt::TextStream & stream);
// virtual void put_type(const Model & model, pt::TextStream & stream);
//
// template<typename ListType>
// void put_type(const std::list<ListType> & model, PT::TextStream & stream)
// void put_type(const std::list<ListType> & model, pt::TextStream & stream)
// {
// stream << "table"; // may just use std::list?
// }
//
// template<typename ListType>
// void put_type(const std::vector<ListType> & model, PT::TextStream & stream)
// void put_type(const std::vector<ListType> & model, pt::TextStream & stream)
// {
// stream << "table"; // may just just std::vector?
// }
@ -713,9 +713,9 @@ protected:
virtual void after_field_value_string(const FT & field_type);
char char_to_hex_part(char c);
void char_to_hex(char c, PT::TextStream & stream);
void char_to_hex(char c, pt::TextStream & stream);
void esc(const wchar_t * val, bool has_known_length, size_t len, PT::TextStream & stream, const FT & field_type = FT::default_type);
void esc(const wchar_t * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type = FT::default_type);
bool is_empty_field(const wchar_t * value);
};

4
src/clearer.cpp

@ -138,12 +138,12 @@ void Clearer::clear_value(long double & field_value)
field_value = 0.0;
}
void Clearer::clear_value(PT::Date & field_value)
void Clearer::clear_value(pt::Date & field_value)
{
field_value.Clear();
}
void Clearer::clear_value(PT::Space & field_value)
void Clearer::clear_value(pt::Space & field_value)
{
field_value.clear();
}

4
src/clearer.h

@ -69,8 +69,8 @@ public:
virtual void clear_value(float & field_value);
virtual void clear_value(double & field_value);
virtual void clear_value(long double & field_value);
virtual void clear_value(PT::Date & field_value);
virtual void clear_value(PT::Space & field_value);
virtual void clear_value(pt::Date & field_value);
virtual void clear_value(pt::Space & field_value);
virtual void clear_model(Model & field_value);

76
src/dbconnector.cpp

@ -67,13 +67,13 @@ DbConnector::~DbConnector()
}
void DbConnector::set_logger(PT::Log * log)
void DbConnector::set_logger(pt::Log * log)
{
this->log = log;
}
void DbConnector::set_logger(PT::Log & log)
void DbConnector::set_logger(pt::Log & log)
{
this->log = &log;
}
@ -85,7 +85,7 @@ void DbConnector::set_log_queries(bool log_queries)
}
bool DbConnector::query(const PT::TextStream & stream)
bool DbConnector::query(const pt::TextStream & stream)
{
std::unique_ptr<QueryResult> query_result_ptr(create_query_result());
return query(stream, *query_result_ptr);
@ -107,7 +107,7 @@ bool DbConnector::query(const char * query_str)
bool DbConnector::query(const PT::TextStream & stream, QueryResult & query_result)
bool DbConnector::query(const pt::TextStream & stream, QueryResult & query_result)
{
std::string query_str;
stream.to_string(query_str);
@ -152,22 +152,22 @@ bool DbConnector::query_remove(const char * query_str, QueryResult & query_resul
bool DbConnector::query_select(const PT::TextStream & stream, QueryResult & query_result)
bool DbConnector::query_select(const pt::TextStream & stream, QueryResult & query_result)
{
return query(stream, query_result);
}
bool DbConnector::query_update(const PT::TextStream & stream, QueryResult & query_result)
bool DbConnector::query_update(const pt::TextStream & stream, QueryResult & query_result)
{
return query(stream, query_result);
}
bool DbConnector::query_insert(const PT::TextStream & stream, QueryResult & query_result)
bool DbConnector::query_insert(const pt::TextStream & stream, QueryResult & query_result)
{
return query(stream, query_result);
}
bool DbConnector::query_remove(const PT::TextStream & stream, QueryResult & query_result)
bool DbConnector::query_remove(const pt::TextStream & stream, QueryResult & query_result)
{
return query(stream, query_result);
}
@ -181,7 +181,7 @@ DbExpression * DbConnector::get_expression()
}
void DbConnector::generate_select_columns(PT::TextStream & stream, Model & model)
void DbConnector::generate_select_columns(pt::TextStream & stream, Model & model)
{
allocate_default_expression_if_needed();
@ -196,7 +196,7 @@ void DbConnector::generate_select_columns(PT::TextStream & stream, Model & model
}
void DbConnector::generate_insert_query(PT::TextStream & stream, Model & model)
void DbConnector::generate_insert_query(pt::TextStream & stream, Model & model)
{
allocate_default_expression_if_needed();
@ -221,7 +221,7 @@ void DbConnector::generate_insert_query(PT::TextStream & stream, Model & model)
}
void DbConnector::generate_update_query(PT::TextStream & stream, Model & model)
void DbConnector::generate_update_query(pt::TextStream & stream, Model & model)
{
allocate_default_expression_if_needed();
@ -246,7 +246,7 @@ void DbConnector::generate_update_query(PT::TextStream & stream, Model & model)
}
void DbConnector::generate_remove_query(PT::TextStream & stream, Model & model)
void DbConnector::generate_remove_query(pt::TextStream & stream, Model & model)
{
allocate_default_expression_if_needed();
@ -265,7 +265,7 @@ void DbConnector::generate_remove_query(PT::TextStream & stream, Model & model)
}
}
bool DbConnector::insert(PT::TextStream & stream, Model & model)
bool DbConnector::insert(pt::TextStream & stream, Model & model)
{
std::unique_ptr<QueryResult> query_result_ptr(create_query_result());
@ -274,7 +274,7 @@ bool DbConnector::insert(PT::TextStream & stream, Model & model)
}
bool DbConnector::update(PT::TextStream & stream, Model & model)
bool DbConnector::update(pt::TextStream & stream, Model & model)
{
std::unique_ptr<QueryResult> query_result_ptr(create_query_result());
@ -283,7 +283,7 @@ bool DbConnector::update(PT::TextStream & stream, Model & model)
}
bool DbConnector::remove(PT::TextStream & stream, Model & model)
bool DbConnector::remove(pt::TextStream & stream, Model & model)
{
std::unique_ptr<QueryResult> query_result_ptr(create_query_result());
@ -333,14 +333,14 @@ char DbConnector::unescape_hex_char_part(char hex)
{
if( log )
{
(*log) << PT::Log::log2 << "Morm: incorrect character when reading a hex string, char code: " << (int)(unsigned char)hex;
(*log) << pt::Log::log2 << "Morm: incorrect character when reading a hex string, char code: " << (int)(unsigned char)hex;
if( hex >= 32 )
{
(*log) << " '" << hex << "'";
}
(*log) << PT::Log::logend;
(*log) << pt::Log::logend;
}
}
@ -443,7 +443,7 @@ size_t DbConnector::unescape_hex_char(const char * value_str, wchar_t & field_va
int value_int;
bool is_correct;
len = PT::UTF8ToInt(utf8_str, utf8_str_len, value_int, is_correct);
len = pt::UTF8ToInt(utf8_str, utf8_str_len, value_int, is_correct);
len = len * 2;
if( is_correct )
@ -454,7 +454,7 @@ size_t DbConnector::unescape_hex_char(const char * value_str, wchar_t & field_va
{
if( log )
{
(*log) << PT::Log::log2 << "Morm: incorrect utf-8 sequence (ignoring)" << PT::Log::logend;
(*log) << pt::Log::log2 << "Morm: incorrect utf-8 sequence (ignoring)" << pt::Log::logend;
}
}
}
@ -469,7 +469,7 @@ size_t DbConnector::unescape_hex_char(const char * value_str, wchar_t & field_va
{
if( log )
{
(*log) << PT::Log::log2 << "Morm: unexpected end of string (ignoring)" << PT::Log::logend;
(*log) << pt::Log::log2 << "Morm: unexpected end of string (ignoring)" << pt::Log::logend;
}
}
}
@ -503,8 +503,8 @@ void DbConnector::get_value(const char * value_str, char & field_value, const FT
{
if( log )
{
(*log) << PT::Log::log2 << "Morm: a character greater than 127 cannot be stored in char type, code point: "
<< (int)c << " '" << c << "'" << PT::Log::logend;
(*log) << pt::Log::log2 << "Morm: a character greater than 127 cannot be stored in char type, code point: "
<< (int)c << " '" << c << "'" << pt::Log::logend;
}
}
}
@ -548,7 +548,7 @@ void DbConnector::get_value(const char * value_str, wchar_t & field_value, const
int value_int;
bool is_correct;
PT::UTF8ToInt(value_str, value_int, is_correct);
pt::UTF8ToInt(value_str, value_int, is_correct);
if( is_correct )
{
@ -584,7 +584,7 @@ void DbConnector::get_value(const char * value_str, std::wstring & field_value,
{
if( field_type.use_utf8() )
{
PT::UTF8ToWide(value_str, field_value);
pt::UTF8ToWide(value_str, field_value);
}
else
{
@ -627,56 +627,56 @@ void DbConnector::get_value(const char * value_str, bool & field_value, const FT
void DbConnector::get_value(const char * value_str, short & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = (short)PT::Toi(value_str, 10);
field_value = (short)pt::Toi(value_str, 10);
}
void DbConnector::get_value(const char * value_str, unsigned short & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = (unsigned short)PT::Toui(value_str, 10);
field_value = (unsigned short)pt::Toui(value_str, 10);
}
void DbConnector::get_value(const char * value_str, int & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = PT::Toi(value_str, 10);
field_value = pt::Toi(value_str, 10);
}
void DbConnector::get_value(const char * value_str, unsigned int & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = PT::Toui(value_str, 10);
field_value = pt::Toui(value_str, 10);
}
void DbConnector::get_value(const char * value_str, long & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = PT::Tol(value_str, 10);
field_value = pt::Tol(value_str, 10);
}
void DbConnector::get_value(const char * value_str, unsigned long & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = PT::Toul(value_str, 10);
field_value = pt::Toul(value_str, 10);
}
void DbConnector::get_value(const char * value_str, long long & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = PT::Toll(value_str, 10);
field_value = pt::Toll(value_str, 10);
}
void DbConnector::get_value(const char * value_str, unsigned long long & field_value, const FT & field_type)
{
// IMPROVE ME give some overflow checking
field_value = PT::Toull(value_str, 10);
field_value = pt::Toull(value_str, 10);
}
@ -701,30 +701,30 @@ void DbConnector::get_value(const char * value_str, long double & field_value, c
}
void DbConnector::get_value(const char * value_str, PT::Date & field_value, const FT & field_type)
void DbConnector::get_value(const char * value_str, pt::Date & field_value, const FT & field_type)
{
// IMPROVE ME give some log if parsing failed
field_value.Parse(value_str);
}
void DbConnector::get_value(const char * value_str, PT::Space & field_value, const FT & field_type)
void DbConnector::get_value(const char * value_str, pt::Space & field_value, const FT & field_type)
{
field_value.clear();
if( *value_str != '\0' )
{
PT::SpaceParser space_parser;
pt::SpaceParser space_parser;
space_parser.SetSpace(field_value);
if( space_parser.ParseSpace(value_str) != PT::SpaceParser::ok )
if( space_parser.ParseSpace(value_str) != pt::SpaceParser::ok )
{
field_value.clear();
if( log )
{
(*log) << PT::Log::log2 << "Morm: I cannot correctly parse the Space struct from the datebase"
<< ", the raw string is: " << value_str << PT::Log::logend;
(*log) << pt::Log::log2 << "Morm: I cannot correctly parse the Space struct from the datebase"
<< ", the raw string is: " << value_str << pt::Log::logend;
}
}
}