From 6e8521f8cedfb022b5d0ece0e5e18702a9e080f5 Mon Sep 17 00:00:00 2001 From: David Maisonave <47364845+David-Maisonave@users.noreply.github.com> Date: Tue, 30 Nov 2021 21:35:22 -0500 Subject: [PATCH] Moved Table Arg types out side of the class --- sqlite3pp.cpp | 2 +- sqlite3pp.h | 2 +- sqlite3pp_ez.cpp | 58 +++++++++++++++++++++++--------------- sqlite3pp_ez.h | 72 +++++++++++++++++++++++++----------------------- 4 files changed, 75 insertions(+), 59 deletions(-) diff --git a/sqlite3pp.cpp b/sqlite3pp.cpp index 3c23452..dff253e 100644 --- a/sqlite3pp.cpp +++ b/sqlite3pp.cpp @@ -546,7 +546,7 @@ namespace sqlite3pp return *this; } - query::query_iterator::value_type query::query_iterator::operator*() const + query::rows query::query_iterator::operator*() const { return rows(cmd_->stmt_); } diff --git a/sqlite3pp.h b/sqlite3pp.h index d2838bd..1be59ec 100644 --- a/sqlite3pp.h +++ b/sqlite3pp.h @@ -363,7 +363,7 @@ namespace sqlite3pp query_iterator& operator++(); //#pragma warning(disable : 4996) - sqlite3pp::query::rows operator*() const; + query::rows operator*() const; private: query* cmd_; diff --git a/sqlite3pp_ez.cpp b/sqlite3pp_ez.cpp index 019a6ba..5948302 100644 --- a/sqlite3pp_ez.cpp +++ b/sqlite3pp_ez.cpp @@ -141,7 +141,6 @@ namespace sqlite3pp bool sql_base::bIsGlblDbOpen = false; const char sql_base::TableArg_PreExecuteArg[] = "PreExecuteArg"; const char sql_base::TableArg_WhereClauseArg[] = "WhereClauseArg"; - const char sql_base::TableArg_InsertArg[] = "InsertArg"; const char sql_base::TableArg_DbFileNameArg[] = "DbFileNameArg"; const char sql_base::TableArg_ValueArg[] = "ValueArg"; @@ -353,7 +352,7 @@ namespace sqlite3pp { if (strcmp("INTEGER", str) == 0 || strcmp("INT", str) == 0 || strcmp("TINYINT", str) == 0 || strcmp("SMALLINT", str) == 0 || strcmp("MEDIUMINTSMALLINT", str) == 0 || strcmp("BIGINT", str) == 0 || strcmp("UNSIGNED BIG INT", str) == 0 || strcmp("INT2", str) == 0 || strcmp("INT8", str) == 0) return "int"; - if (strcmp("REAL", str) == 0 || strcmp("DOUBLE", str) == 0 || strcmp("DOUBLE PRECISION", str) == 0 || strcmp("FLOAT", str) == 0 || strncmp("DECIMAL", str, 7) == 0 || strcmp("BOOLEAN", str) == 0 || strcmp("DATE", str) == 0 || strcmp("DATETIME", str) == 0 || strcmp("NUMERIC", str) == 0) + if (strcmp("REAL", str) == 0 || strcmp("DOUBLE", str) == 0 || strcmp("DOUBLE PRECISION", str) == 0 || strcmp("FLOAT", str) == 0 || strncmp("DECIMAL", str, 7) == 0 || strcmp("BOOLEANL", str) == 0 || strcmp("BOOLEAN", str) == 0 || strcmp("DATE", str) == 0 || strcmp("DATETIME", str) == 0 || strcmp("NUMERIC", str) == 0) return "double"; if (m_options.m.use_basic_types_only) @@ -381,7 +380,7 @@ namespace sqlite3pp return "Smallint"; if (strcmp("MEDIUMINTSMALLINT", str) == 0) return "Mediumint"; - if (strcmp("BOOLEAN", str) == 0) + if (strcmp("BOOLEAN", str) == 0 || strcmp("BOOLEANL", str) == 0) return "Boolean"; if (strcmp("BIGINT", str) == 0) return "Bigint"; @@ -436,10 +435,10 @@ namespace sqlite3pp return option; } - void SQLiteClassBuilder::Init(const std::string & TableOrView_name, const std::string & WhereClause) + void SQLiteClassBuilder::Init(const std::string & TableOrView_name, const std::string & AndWhereClause) { if (TableOrView_name == CreateHeaderForAllTables) - CreateAllHeaders(m_options, WhereClause); + CreateAllHeaders(m_options, AndWhereClause); else if (!TableOrView_name.empty() && TableOrView_name != Nill) CreateHeader(TableOrView_name); } @@ -449,9 +448,9 @@ namespace sqlite3pp m_db.disconnect(); } - bool SQLiteClassBuilder::CreateAllHeaders(const std::string &WhereClause) + bool SQLiteClassBuilder::CreateAllHeaders(const std::string &AndWhereClause) { - return CreateAllHeaders(m_options, WhereClause); + return CreateAllHeaders(m_options, AndWhereClause); } static const char TopHeaderCommnetsPrt1[] = "/* This file was automatically generated using [Sqlite3pp_EZ].\nSqlite3pp_EZ Copyright (C) 2021 David Maisonave (http::\\www.axter.com)"; static const char TopHeaderCommnetsPrt2[] = "For more details see https://github.com/David-Maisonave/sqlite3pp_EZ\n*/"; @@ -494,14 +493,14 @@ namespace sqlite3pp return true; } - bool SQLiteClassBuilder::CreateAllHeaders(const TblClassOptions &strtype, const std::string &WhereClause) + bool SQLiteClassBuilder::CreateAllHeaders(const TblClassOptions &strtype, const std::string &AndWhereClause) { m_HeadersCreated.clear(); m_ClassNames.clear(); m_options = strtype; const std::string OrgPrefix = m_options.h.header_prefix; using SQLiteMaster = Table; - SQLiteMaster tbl(m_db, SQLiteMaster::WhereClauseArg("where (type = 'table' or type = 'view') " + WhereClause)); + SQLiteMaster tbl(m_db, WhereClauseArg(T_("where (type = 'table' or type = 'view') ") + sql_base::to_tstring(AndWhereClause)) ); for (auto t : tbl) { m_options.h.header_prefix = OrgPrefix + t.type + "_"; @@ -741,26 +740,41 @@ namespace sqlite3pp std::wstring query::rows::get(int idx, const std::wstring&) const { +#ifdef SQLITE3PP_ALLOW_NULL_STRING_RETURN + bool AllowNullStringReturn = true; +#else + bool AllowNullStringReturn = false; +#endif // !SQLITE3PP_ALLOW_NULL_STRING_RETURN std::wstring value; const char * strtype = sqlite3_column_decltype(stmt_, idx); - wchar_t const* Val = get(idx, (wchar_t const*)0); -#ifndef SQLITE3PP_ALLOW_NULL_STRING_RETURN - if (!Val) - return value; -#endif // !SQLITE3PP_ALLOW_NULL_STRING_RETURN + bool GetUnicodeString = false; + if (!strtype || strcmp(strtype, "TEXT") == 0 || strncmp("CHARACTER", strtype, 9) == 0 || strncmp("VARYING CHARACTER", strtype, 17) == 0 || strncmp("VARCHAR", strtype, 7) == 0) + GetUnicodeString = false; + else if ( strncmp("NCHAR", strtype, 5) == 0 || strncmp("NVARCHAR", strtype, 8) == 0 || strncmp("NATIVE CHARACTER", strtype, 16) == 0) + GetUnicodeString = true; + else + { + assert(0);// Code should NOT get here. If it does something went wrong. + GetUnicodeString = false; + } - if (!strtype) + union + { // This union is here for debugging purposes. + wchar_t const* Val_w; + char const* Val_a; + const void* Val; + }; + if (GetUnicodeString) { - value = sql_base::to_wstring((char*)(Val)); + Val_w = get(idx, (wchar_t const*)0); + if (Val_w || AllowNullStringReturn) + value = Val_w; } - else if (strcmp(strtype, "TEXT") == 0 || strncmp("CHARACTER", strtype, 9) == 0 || strncmp("VARYING CHARACTER", strtype, 17) == 0 || strncmp("VARCHAR", strtype, 7) == 0) - value = sql_base::to_wstring((char*)(Val)); - else if ( strncmp("NCHAR", strtype, 5) == 0 || strncmp("NVARCHAR", strtype, 8) == 0 || strncmp("NATIVE CHARACTER", strtype, 16) == 0) - value = Val; else { - assert(0);// Code should NOT get here. If it does something went wrong. - value = sql_base::to_wstring((char*)(Val)); // Handle it gracefully in release mode. + Val_a = get(idx, (char const*)0); + if (Val_a || AllowNullStringReturn) + value = sql_base::to_wstring(Val_a); } return value; diff --git a/sqlite3pp_ez.h b/sqlite3pp_ez.h index b352739..883b3f3 100644 --- a/sqlite3pp_ez.h +++ b/sqlite3pp_ez.h @@ -91,19 +91,18 @@ namespace sqlite3pp friend int GetDbErrNo(); friend int GetDbExtErrNo(); static sqlite3pp::query* CreateQuery(database& db, const std::string& QueryStr); + static const char TableArg_PreExecuteArg[]; + static const char TableArg_WhereClauseArg[]; + static const char TableArg_DbFileNameArg[]; protected: static sqlite3pp::database global_db; // To be used as global DB static bool bIsGlblDbOpen; // To be used as global DB - static const char TableArg_PreExecuteArg[]; - static const char TableArg_WhereClauseArg[]; - static const char TableArg_InsertArg[]; - static const char TableArg_DbFileNameArg[]; static const char TableArg_ValueArg[]; }; - template + template class TableArg { const T_STR m_Str; @@ -112,6 +111,10 @@ namespace sqlite3pp const T_STR& get_Str() { return m_Str; } char const * get_TypeName() { return TypeName; } }; + // Constructor aruments + using PreExecuteArg = TableArg; // Use this argument to perform a SQL Execute before querying the table/view + using WhereClauseArg = TableArg; // Use this argument to add a where clause when querying the table/view + using DbFileNameArg = TableArg; // Use this argument to open the specified database file class TableBase : public sql_base { @@ -131,32 +134,33 @@ namespace sqlite3pp using T_STR = typename T::StrType; // Allows Table class to work with different string types (std::string, std::wstring, sqlite3pp::tstring) using DataType = PARENT_TYPE; using VectType = std::vector; - using PreExecuteArg = TableArg; - using WhereClauseArg = TableArg; - using InsertArg = TableArg; - using DbFileNameArg = TableArg; - using ValueArg = TableArg; + using ValueArg = TableArg; + private: // All member variables VectType m_VectType; + const PreExecuteArg m_PreExecute; // Mainly here for debugging purposes + const WhereClauseArg m_WhereClause; // Mainly here for debugging purposes + const DbFileNameArg m_DbFileName; // Mainly here for debugging purposes sqlite3pp::database &m_db; - const T_STR m_TableName; // Mainly here for debugging purposes - const T_STR m_ColumnNames; // Mainly here for debugging purposes - const int m_ColumnCount; // Mainly here for debugging purposes + const T_STR m_InitQuery; // Mainly here for debugging purposes + const T_STR m_TableName; // Mainly here for debugging purposes + const T_STR m_ColumnNames; // Mainly here for debugging purposes + const int m_ColumnCount; // Mainly here for debugging purposes public: // There are 2 constructor sets with each having 4 types of constructs. There are 4 types purely for the sake of convenience. Determine which constructors to use by which arguments are needed. // Set of constructors needing a sqlite3pp::database instance in constructor argument. These constructors automatically populate the object using data from the database db instance. - Table(sqlite3pp::database &db, WhereClauseArg whereclausearg = WhereClauseArg(), PreExecuteArg preexecutearg = PreExecuteArg(), InsertArg insertarg = InsertArg(), DbFileNameArg dbfilenamearg = DbFileNameArg()) :m_db( db ), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, CreateSelectQueryStr(whereclausearg, T_STR()), preexecutearg, insertarg, dbfilenamearg); } - Table(sqlite3pp::database &db, PreExecuteArg preexecutearg, WhereClauseArg whereclausearg = WhereClauseArg()) :m_db(db), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, CreateSelectQueryStr(whereclausearg, T_STR()), preexecutearg, InsertArg(), DbFileNameArg()); } - Table(sqlite3pp::database &db, InsertArg insertarg, WhereClauseArg whereclausearg = WhereClauseArg()) :m_db(db), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, CreateSelectQueryStr(whereclausearg, T_STR()), PreExecuteArg(), insertarg, DbFileNameArg()); } - Table(sqlite3pp::database &db, DbFileNameArg dbfilenamearg, WhereClauseArg whereclausearg = WhereClauseArg()) :m_db(db), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, CreateSelectQueryStr(whereclausearg, T_STR()), PreExecuteArg(), InsertArg(), dbfilenamearg); } - + Table(sqlite3pp::database &db, WhereClauseArg whereclausearg = WhereClauseArg(), PreExecuteArg preexecutearg = PreExecuteArg(), DbFileNameArg dbfilenamearg = DbFileNameArg()) :m_PreExecute(preexecutearg), m_WhereClause(whereclausearg), m_DbFileName(dbfilenamearg), m_db( db ), m_InitQuery(CreateSelectQueryStr(whereclausearg, T_STR())), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, m_InitQuery, preexecutearg, dbfilenamearg); } + Table(sqlite3pp::database &db, PreExecuteArg preexecutearg, WhereClauseArg whereclausearg = WhereClauseArg(), DbFileNameArg dbfilenamearg = DbFileNameArg()) :m_PreExecute(preexecutearg), m_WhereClause(whereclausearg), m_DbFileName(dbfilenamearg), m_db(db), m_InitQuery(CreateSelectQueryStr(whereclausearg, T_STR())), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, m_InitQuery, preexecutearg, dbfilenamearg); } + Table(sqlite3pp::database &db, DbFileNameArg dbfilenamearg, WhereClauseArg whereclausearg = WhereClauseArg(), PreExecuteArg preexecutearg = PreExecuteArg()) :m_PreExecute(preexecutearg), m_WhereClause(whereclausearg), m_DbFileName(dbfilenamearg), m_db(db), m_InitQuery(CreateSelectQueryStr(whereclausearg, T_STR())), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery(m_db, m_InitQuery, preexecutearg, dbfilenamearg); } + Table(sqlite3pp::database &db, DbFileNameArg dbfilenamearg, PreExecuteArg preexecutearg = PreExecuteArg(), WhereClauseArg whereclausearg = WhereClauseArg()) :m_PreExecute(preexecutearg), m_WhereClause(whereclausearg), m_DbFileName(dbfilenamearg), m_db(db), m_InitQuery(CreateSelectQueryStr(whereclausearg, T_STR())), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery(m_db, m_InitQuery, preexecutearg, dbfilenamearg); } + // Same as above set, but this set uses the single global database instance, and so db does not need to be pass to the constructor. These constructors automatically populate the object using data from the global database instance. - Table(WhereClauseArg whereclausearg = WhereClauseArg(), PreExecuteArg preexecutearg = PreExecuteArg(), InsertArg insertarg = InsertArg(), DbFileNameArg dbfilenamearg = DbFileNameArg()):m_db( global_db ), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, CreateSelectQueryStr(whereclausearg, T_STR()), preexecutearg, insertarg, dbfilenamearg); } - Table(PreExecuteArg preexecutearg, WhereClauseArg whereclausearg = WhereClauseArg()) :m_db(global_db), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, CreateSelectQueryStr(whereclausearg, T_STR()), preexecutearg, InsertArg(), DbFileNameArg()); } - Table(InsertArg insertarg, WhereClauseArg whereclausearg = WhereClauseArg()) :m_db(global_db), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, CreateSelectQueryStr(whereclausearg, T_STR()), PreExecuteArg(), insertarg, DbFileNameArg()); } - Table(DbFileNameArg dbfilenamearg, WhereClauseArg whereclausearg = WhereClauseArg()) :m_db(global_db), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, CreateSelectQueryStr(whereclausearg, T_STR()), PreExecuteArg(), InsertArg(), dbfilenamearg); } + Table(WhereClauseArg whereclausearg = WhereClauseArg() , PreExecuteArg preexecutearg = PreExecuteArg(), DbFileNameArg dbfilenamearg = DbFileNameArg()):m_PreExecute(preexecutearg), m_WhereClause(whereclausearg), m_DbFileName(dbfilenamearg), m_db( global_db ), m_InitQuery(CreateSelectQueryStr(whereclausearg, T_STR())), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, m_InitQuery, preexecutearg, dbfilenamearg); } + Table(PreExecuteArg preexecutearg , WhereClauseArg whereclausearg = WhereClauseArg(), DbFileNameArg dbfilenamearg = DbFileNameArg()) :m_PreExecute(preexecutearg), m_WhereClause(whereclausearg), m_DbFileName(dbfilenamearg), m_db(global_db), m_InitQuery(CreateSelectQueryStr(whereclausearg, T_STR())), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, m_InitQuery, preexecutearg, dbfilenamearg); } + Table(DbFileNameArg dbfilenamearg , WhereClauseArg whereclausearg = WhereClauseArg(), PreExecuteArg preexecutearg = PreExecuteArg()) :m_PreExecute(preexecutearg), m_WhereClause(whereclausearg), m_DbFileName(dbfilenamearg), m_db(global_db), m_InitQuery(CreateSelectQueryStr(whereclausearg, T_STR())), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, m_InitQuery, preexecutearg, dbfilenamearg); } + Table(DbFileNameArg dbfilenamearg , PreExecuteArg preexecutearg = PreExecuteArg(), WhereClauseArg whereclausearg = WhereClauseArg()) :m_PreExecute(preexecutearg), m_WhereClause(whereclausearg), m_DbFileName(dbfilenamearg), m_db(global_db), m_InitQuery(CreateSelectQueryStr(whereclausearg, T_STR())), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { PrepareQuery( m_db, m_InitQuery, preexecutearg, dbfilenamearg); } // Set of constructors which do NOT populate itself using the database. Instead the constructors takes an argument which is used to automatically populate itself Table(sqlite3pp::database &db, const VectType &VectTypes ) :m_db( db ), m_TableName(T::getTableName()), m_ColumnNames(T::getColumnNames()), m_ColumnCount(T::getColumnCount()) { for ( auto v : VectTypes ) m_VectType.push_back( v ); } @@ -188,8 +192,8 @@ namespace sqlite3pp const DataType& operator[]( int i ) { return m_VectType[i]; } void push_back( const DataType &datatype ) { return m_VectType.push_back( datatype ); } void append( const VectType &vecttype ) { return m_VectType.push_back( vecttype ); } - std::string CreateSelectQueryStr(WhereClauseArg whereclausearg, std::string) { return "SELECT " + T::getSelecColumnNames() + " FROM \"" + T::getTableName() + "\" " + whereclausearg.get_Str(); } - std::wstring CreateSelectQueryStr(WhereClauseArg whereclausearg, std::wstring) { return L"SELECT " + T::getSelecColumnNames() + L" FROM \"" + T::getTableName() + L"\" " + whereclausearg.get_Str(); } + std::string CreateSelectQueryStr(WhereClauseArg whereclausearg, std::string) { return "SELECT " + T::getSelecColumnNames() + " FROM \"" + T::getTableName() + "\" " + to_string(whereclausearg.get_Str().c_str()); } + std::wstring CreateSelectQueryStr(WhereClauseArg whereclausearg, std::wstring) { return L"SELECT " + T::getSelecColumnNames() + L" FROM \"" + T::getTableName() + L"\" " + to_wstring(whereclausearg.get_Str().c_str()); } // Use this set of functions with a table instance virtual sqlite3pp::tstring GetTableName() const { return to_tstring(m_TableName); } @@ -233,14 +237,12 @@ namespace sqlite3pp m_VectType.push_back( temp_var ); } } - void PrepareQuery(sqlite3pp::database &db, const T_STR& strQuery, PreExecuteArg preexecutearg = PreExecuteArg(), InsertArg insertarg = InsertArg(), DbFileNameArg dbfilenamearg = DbFileNameArg()) + void PrepareQuery(sqlite3pp::database &db, const T_STR& strQuery, PreExecuteArg preexecutearg = PreExecuteArg(), DbFileNameArg dbfilenamearg = DbFileNameArg()) { if (!dbfilenamearg.get_Str().empty()) db = database(dbfilenamearg.get_Str().c_str()); if (!preexecutearg.get_Str().empty()) - Execute(preexecutearg.get_Str()); - if (!insertarg.get_Str().empty()) - Execute(insertarg.get_Str()); + m_db.execute(to_string(preexecutearg.get_Str())); sqlite3pp::query qry(db, strQuery.c_str() ); PopulateVect(db, qry ); } @@ -345,7 +347,7 @@ namespace sqlite3pp TblClassOptions Init(const StrOptions & stroptions, const MiscOptions & miscoptions, const HeaderOpt & headeropt); void Init( const std::string& TableOrView_name - , const std::string &WhereClause + , const std::string &AndWhereClause ); bool ProcessClassCreation(const std::string& ClassName, std::string QueryStr = ""); bool CreateHeaderPrefix(const std::string& TableName, std::ofstream &myfile, std::string& ClassName, std::string& HeaderUpper, std::string FirstColumnName = "", std::string LastColumnName = "", bool AppendToVect = true); @@ -353,24 +355,24 @@ namespace sqlite3pp // This constructor is best to use when creating a header for all tables in the constructor. (Headers can also be created by calling CreateHeader or CreateAllHeaders) SQLiteClassBuilder(const std::string& Db_filename , 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) - , const std::string &WhereClause = "" // Used when creating multiple tables. Can specify which tables/views to include via where clause + , const std::string &AndWhereClause = "" // Used when creating multiple tables. Can specify which tables/views to include via where clause , 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) , const HeaderOpt &headeropt = HeaderDefaultOpt // HeaderOpt is used to define the naming convention to use when creating the header file(s). , 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. - ) :m_db(Db_filename.c_str()), m_options( Init(stroptions, miscoptions, headeropt) ), m_options_org(m_options), m_AppendTableToHeader(false){Init(TableOrView_name, WhereClause);} + ) :m_db(Db_filename.c_str()), m_options( Init(stroptions, miscoptions, headeropt) ), m_options_org(m_options), m_AppendTableToHeader(false){Init(TableOrView_name, AndWhereClause);} // This constructor is best when crating a single header or no headers at all in the contructor. (Headers can also be created by calling CreateHeader or CreateAllHeaders) SQLiteClassBuilder(const std::string& Db_filename // Only Required Field , const std::string& TableOrView_name = "" // 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. - , const std::string &WhereClause = "" // Used when creating multiple tables. Can specify which tables/views to include via where clause + , const std::string &AndWhereClause = "" // Used when creating multiple tables. Can specify which tables/views to include via where clause , const StrOptions &stroptions = strOpt_std_string // 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) , 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) , const HeaderOpt &headeropt = HeaderDefaultOpt // HeaderOpt is used to define the naming convention to use when creating the header file(s). - ) :m_db(Db_filename.c_str()), m_options( Init(stroptions, miscoptions, headeropt) ), m_options_org(m_options), m_AppendTableToHeader(false){Init(TableOrView_name, WhereClause);} + ) :m_db(Db_filename.c_str()), m_options( Init(stroptions, miscoptions, headeropt) ), m_options_org(m_options), m_AppendTableToHeader(false){Init(TableOrView_name, AndWhereClause);} ~SQLiteClassBuilder(); - bool CreateAllHeaders(const std::string &WhereClause = ""); - bool CreateAllHeaders(const TblClassOptions &strtype, const std::string &WhereClause = ""); + bool CreateAllHeaders(const std::string &AndWhereClause = ""); + bool CreateAllHeaders(const TblClassOptions &strtype, const std::string &AndWhereClause = ""); bool CreateHeader(const std::string& TableName, const TblClassOptions *strtype = NULL, std::string QueryStr = ""); // Predefined string options