Skip to content

Commit b06cfdc

Browse files
Fixed bug with appending path sep
1 parent b5ca63b commit b06cfdc

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

sqlite3pp_ez.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ namespace sqlite3pp
148148
return to_wstring(sqlite3pp::to_string(src));
149149
}
150150

151+
static std::string str_toupper(std::string s)
152+
{
153+
std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) { return std::toupper(c); });
154+
return s;
155+
}
156+
151157
static bool isValidDate(const Date& t)
152158
{
153159
if (t.t < 1)
@@ -956,10 +962,10 @@ namespace sqlite3pp
956962
////////////////////////////////////////////////////////////////////////////////////////////
957963
// SQLiteClassBuilder Predefines.
958964
// Predefined string options
959-
const StrOptions SQLiteClassBuilder::strOpt_std_string = { "std::string", "sqlite3pp::to_string", "", "", "#include <string>" };
960-
const StrOptions SQLiteClassBuilder::strOpt_std_wstring = { "std::wstring", "sqlite3pp::to_wstring", "L", "", "#include <string>" };
961-
const StrOptions SQLiteClassBuilder::strOpt_sql_tstring = { "sqlite3pp::tstring", "sqlite3pp::to_tstring", "T_(", ")", "#include \"sqlite3pp_ez.h\"" };
962-
const StrOptions SQLiteClassBuilder::strOpt_sql_tstring_T = { "sqlite3pp::tstring", "sqlite3pp::to_tstring", "_T(", ")", "#include \"sqlite3pp_ez.h\"" };
965+
const StrOptions SQLiteClassBuilder::strOpt_std_string = { "std::string", "sqlite3pp::to_string", "", "", "#include <string>" };
966+
const StrOptions SQLiteClassBuilder::strOpt_std_wstring = { "std::wstring", "sqlite3pp::to_wstring", "L", "", "#include <string>" };
967+
const StrOptions SQLiteClassBuilder::strOpt_sql_tstring = { "sqlite3pp::tstring", "sqlite3pp::to_tstring", "T_(", ")", "#include \"sqlite3pp_ez.h\"" };
968+
const StrOptions SQLiteClassBuilder::strOpt_sql_tstring_T = { "sqlite3pp::tstring", "sqlite3pp::to_tstring", "_T(", ")", "#include \"sqlite3pp_ez.h\"" };
963969
// Predefined MiscOptions for common settings
964970
const MiscOptions SQLiteClassBuilder::MiscOpt_max = { ",", false, false, false, false, false, false, false, false, false };
965971
const MiscOptions SQLiteClassBuilder::MiscOpt_min = { ",", true, true, true, true, true, false, false, true, true };
@@ -1100,7 +1106,7 @@ namespace sqlite3pp
11001106
if (m_options.h.dest_folder[m_options.h.dest_folder.size() - 1] == '/')
11011107
m_options.h.dest_folder[m_options.h.dest_folder.size() - 1] = '\\';
11021108
else if (m_options.h.dest_folder[m_options.h.dest_folder.size() - 1] != '\\')
1103-
m_options.h.dest_folder = +"\\";
1109+
m_options.h.dest_folder += "\\";
11041110
V_COUT(DEBUG, "Using destination path '" << m_options.h.dest_folder << "'.");
11051111
}
11061112

@@ -1286,11 +1292,6 @@ namespace sqlite3pp
12861292
}
12871293
return NULL;
12881294
}
1289-
std::string str_toupper(std::string s)
1290-
{
1291-
std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) { return std::toupper(c); });
1292-
return s;
1293-
}
12941295

12951296
std::string SQLiteClassBuilder::InitializeValue(std::string TypeName) const
12961297
{

sqlite3pp_ez.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ namespace sqlite3pp
476476
bool use_basic_types_only = false; // If true, only int, double, std::string, and std::wstring are used
477477
bool exclude_main_hdr_example = false; // If true, excludes example code added to sql_Master_Header.h
478478
bool exclude_comment_out_example = false;// If true, does NOT comment out example code
479-
bool initialize_member_variables = true;// If true, initialize class member varibles in header
479+
bool initialize_member_variables = true;// If true, initialize class member variables in header
480480
}; // Create a custom defined TblClassOptions variable, or used one of the SQLiteClassBuilder predefined types, or use the default type which is automatically set by the SQLiteClassBuilder constructor
481481

482482
struct TblClassOptions
@@ -509,7 +509,7 @@ namespace sqlite3pp
509509
, const StrOptions &stroptions // StrOptions is used to define the default string type. Can be set to a custom define StrOptions, or to one of the predefined common options (strOpt_std_string, strOpt_std_wstring, strOpt_std_tstring, strOpt_sql_tstring)
510510
, const std::string &AndWhereClause = "" // Used when creating multiple tables. Can specify which tables/views to include via where clause
511511
, const MiscOptions &miscoptions = MiscOpt_max // MiscOptions is used to define miscellaneous options. Can be set to a custom define MiscOptions, or to one of the predefined common options (MiscOpt_max, MiscOpt_min, MiscOpt_var)
512-
, const HeaderOpt &headeropt = HeadersCreatedSqlDir // HeaderOpt is used to define the naming convention to use when creating the header file(s).
512+
, const HeaderOpt &headeropt = HeadersCreatedSqlDir // HeaderOpt is used to define the naming convention to use when creating the header file(s).
513513
, const std::string& TableOrView_name = CreateHeaderForAllTables // If equal to "%_CreateHeaderForAllTables_%", a header for each table and view is created. If equal to table or view name, a single header for associated table or view is created. If empty or equal to "#NILL#", the constructor does not create any headers.
514514
) :m_db(Db_filename.c_str()), m_options( Init(stroptions, miscoptions, headeropt) ), m_options_org(m_options), m_AppendTableToHeader(false){Init(TableOrView_name, AndWhereClause);}
515515

@@ -522,6 +522,14 @@ namespace sqlite3pp
522522
, const HeaderOpt &headeropt = HeadersCreatedSqlDir // HeaderOpt is used to define the naming convention to use when creating the header file(s).
523523
) :m_db(Db_filename.c_str()), m_options( Init(stroptions, miscoptions, headeropt) ), m_options_org(m_options), m_AppendTableToHeader(false){Init(TableOrView_name, AndWhereClause);}
524524

525+
SQLiteClassBuilder(const std::string& Db_filename
526+
, const StrOptions &stroptions // StrOptions is used to define the default string type. Can be set to a custom define StrOptions, or to one of the predefined common options (strOpt_std_string, strOpt_std_wstring, strOpt_std_tstring, strOpt_sql_tstring)
527+
, const HeaderOpt &headeropt // HeaderOpt is used to define the naming convention to use when creating the header file(s).
528+
, const MiscOptions &miscoptions = MiscOpt_max // MiscOptions is used to define miscellaneous options. Can be set to a custom define MiscOptions, or to one of the predefined common options (MiscOpt_max, MiscOpt_min, MiscOpt_var)
529+
, const std::string& TableOrView_name = CreateHeaderForAllTables // If equal to "%_CreateHeaderForAllTables_%", a header for each table and view is created. If equal to table or view name, a single header for associated table or view is created. If empty or equal to "#NILL#", the constructor does not create any headers.
530+
, const std::string &AndWhereClause = "" // Used when creating multiple tables. Can specify which tables/views to include via where clause
531+
) :m_db(Db_filename.c_str()), m_options( Init(stroptions, miscoptions, headeropt) ), m_options_org(m_options), m_AppendTableToHeader(false){Init(TableOrView_name, AndWhereClause);}
532+
525533
~SQLiteClassBuilder();
526534
bool CreateAllHeaders(const std::string &AndWhereClause = "");
527535
bool CreateAllHeaders(const TblClassOptions &strtype, const std::string &AndWhereClause = "");

0 commit comments

Comments
 (0)