@@ -835,19 +835,7 @@ namespace sqlite3pp
835835 return data;
836836 }
837837
838- static std::wostream& operator <<(std::wostream& os, const sql_base::Character& t)
839- {
840- os << to_wstring (t);
841- return os;
842- }
843-
844- static std::ostream& operator <<(std::ostream& os, const sql_base::Nchar& t)
845- {
846- os << to_string (t);
847- return os;
848- }
849-
850- static std::wostream& operator <<(std::wostream& os, const sqlite3pp::Blob& t)
838+ std::wostream& operator <<(std::wostream& os, const sqlite3pp::Blob& t)
851839 {
852840 std::string data (t->data (), t->data () + t->size ());
853841 std::wstring wdata = to_wstring (data);
@@ -944,6 +932,17 @@ namespace sqlite3pp
944932 }
945933 return os;
946934 }
935+
936+ std::wostream& operator <<(std::wostream& os, const sqlite3pp::TEXT& obj) {
937+ os << sqlite3pp::to_wstring (obj).c_str ();
938+ return os;
939+ }
940+
941+ std::ostream& operator <<(std::ostream& os, const sqlite3pp::TEXT& obj) {
942+ os << sqlite3pp::to_string (obj).c_str ();
943+ return os;
944+ }
945+
947946#endif // !SQLITE3PP_CONVERT_TO_RESULTING_AFFINITY
948947
949948
@@ -1088,9 +1087,9 @@ namespace sqlite3pp
10881087 return " Float" ;
10891088
10901089 // String types
1091- if (strcmp (" TEXT" , str) == 0 )
1090+ if (strcmp (" TEXT" , str) == 0 || str_type. find ( " SUB_TYPE TEXT " ) != std::string::npos )
10921091 return " Text" ;
1093- if (str_type.find (" CHARACTER " ) == 0 )
1092+ if (str_type.find (" CHAR " ) == 0 )
10941093 return " Character" ;
10951094 if (str_type.find (" VARYING CHARACTER" ) == 0
10961095 || str_type.find (" VARCHAR" ) == 0 )
@@ -1100,6 +1099,9 @@ namespace sqlite3pp
11001099 return " Nchar" ;
11011100 if (str_type.find (" NVARCHAR" ) == 0 )
11021101 return " Nvarchar" ;
1102+
1103+ if (strcmp (" TIMESTAMP" , str) == 0 )
1104+ return " Bigint" ;
11031105 }
11041106
11051107 V_COUT (WARN, " Received unknown type ('" << str_org << " ') from DB for column '" << colName << " ' in table/view '" << tblVw << " '." );
@@ -1196,31 +1198,35 @@ namespace sqlite3pp
11961198 if (columns.size () > 0 )
11971199 {
11981200 std::string outType = " std::cout" ;
1199- for (auto & c : columns)
1200- if (c.second == " Text" )
1201- outType = " std::wcout" ;
1201+ std::string ColumnSep = " << \" | \" " ;
1202+ // for (auto& c : columns)
1203+ // if (c.second == "Text")
1204+ // {
1205+ // outType = "std::wcout";
1206+ // ColumnSep = " << L\" | \"";
1207+ // }
12021208 myfile << " \t // Example #4\n\t\t sqlite3pp::setGlobalDB(\" myDatabase.db\" );" << std::endl;
12031209 myfile << " \t\t sqlite3pp::Table<" << ClassName << " > my_tbl;" ;
12041210
12051211 myfile << " \n\t\t // Example#4a -- (C++11) Range-based loop" ;
12061212 myfile << " \n\t\t for(auto row : my_tbl)\n " ;
12071213 myfile << " \t\t\t " << outType;
12081214 for (auto & c : columns)
1209- myfile << " << row.get_" << c.first << " ()" ;
1215+ myfile << " << row.get_" << c.first << " ()" << ColumnSep ;
12101216 myfile << " << std::endl;" << std::endl;
12111217
12121218 myfile << " \n\t\t // Example#4b -- C++ style iteration" ;
12131219 myfile << " \n\t\t for (auto row = my_tbl.begin(); row != my_tbl.end(); ++row) \n " ;
12141220 myfile << " \t\t\t " << outType;
12151221 for (auto & c : columns)
1216- myfile << " << row->get_" << c.first << " ()" ;
1222+ myfile << " << row->get_" << c.first << " ()" << ColumnSep ;
12171223 myfile << " << std::endl;" << std::endl;
12181224
12191225 myfile << " \n\t\t // Example#4c -- C style iteration" ;
12201226 myfile << " \n\t\t for (int row = 0; row < my_tbl.size(); ++row) \n " ;
12211227 myfile << " \t\t\t " << outType;
12221228 for (auto & c : columns)
1223- myfile << " << my_tbl[row].get_" << c.first << " ()" ;
1229+ myfile << " << my_tbl[row].get_" << c.first << " ()" << ColumnSep ;
12241230 myfile << " << std::endl;" << std::endl;
12251231 }
12261232 myfile << TopHeaderCommnetsPrt2 << std::endl;
@@ -1372,7 +1378,7 @@ namespace sqlite3pp
13721378 // The pragma should return columns (cid, name, type, notnull, dflt_value, pk)
13731379 const char * CommentSection = " ////////////////////////////////////////////////////////////////////////////////////////////" ;
13741380 if (QueryStr.empty ())
1375- QueryStr = " SELECT * FROM ' " + TableName + " ' " ;
1381+ QueryStr = " SELECT * FROM \" " + TableName + " \" " ;
13761382 std::shared_ptr < sqlite3pp::query> qry (sql_base::CreateQuery (m_db, QueryStr));
13771383 if (!qry)
13781384 return false ;
@@ -1444,7 +1450,7 @@ namespace sqlite3pp
14441450 // Create getSelectColumnNames member function. Needed for sqlite3pp::Table template class
14451451 myfile << " \t static StrType getSelectColumnNames() { return " << m_options.s .str_pre << " \" " ;
14461452 for (auto & c : columns_with_comma)
1447- myfile << c.second << " ' " << c.first << " ' " ;
1453+ myfile << c.second << " \\\" " << c.first << " \\\" " ;
14481454 myfile << " \" " << m_options.s .str_post << " ; }" << std::endl;
14491455
14501456 // Create GetValues member function. Needed for sqlite3pp::Table template class
0 commit comments