2222// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323// THE SOFTWARE.
2424
25- // David Maisonave -- Nov-2021 Added UNICODE API's
26-
25+ // ////////////////////////////////////////////////////////////////////////////////////////
26+ // Mod Author: David Maisonave - Sep-2025
27+ // This a modified version of [Wongoo Lee] original sqlite3pp.
28+ // - Source comes from the following link: https://github.com/iwongu/sqlite3pp
29+ // This version was originally modified by David Maisonave Nov-2021,
30+ // and then additional modifications made in Sep-2025.
31+ //
32+ // Most of the 2025 changes are associated with compiling with manage C++ code,
33+ // using SQLiteDLLConnect.h which has a manage class SQLiteDLLConnect,
34+ // and allows run time linking to SQLite3.dll with manage C++ code.
35+ //
36+ // Changes:
37+ // - Added UNICODE API's.
38+ // - Change some names to avoid spell checker errors.
39+ // - Changed local include to use "" instead of <>, to avoid compiler error on some systems.
40+ // - Added functions that take std::string
41+ // - Added enhance logic to connect to SQLite3.db at runtime.
42+ // - Other miscellaneous changes where I added comments [David Maisonave changes]
43+ //
44+ // For example usage see [Wongoo Lee] github link: https://github.com/iwongu/sqlite3pp
2745
2846#ifndef SQLITE3PP_H
2947#define SQLITE3PP_H
3048
31- #define SQLITE3PP_VERSION " 1.0.8"
32- #define SQLITE3PP_VERSION_MAJOR 1
33- #define SQLITE3PP_VERSION_MINOR 0
34- #define SQLITE3PP_VERSION_PATCH 8
49+ // [David Maisonave changes] -- commented out the following defines which where not being used, but was producing compiler warnings.
50+ // #define SQLITE3PP_VERSION "1.0.8"
51+ // #define SQLITE3PP_VERSION_MAJOR 1
52+ // #define SQLITE3PP_VERSION_MINOR 0
53+ // #define SQLITE3PP_VERSION_PATCH 8
3554
3655#include < functional>
3756#include < iterator>
3857#include < stdexcept>
3958#include < string>
4059#include < tuple>
41- #include < vector>
42- #include < ctime >
43- #include < memory >
60+ #include < vector> // [David Maisonave changes] -- Required for Blob & Clob types
61+ #include < memory > // [David Maisonave changes] -- Required for Blob & Clob types
62+ #include < ctime > // [David Maisonave changes] -- Required for Date & Datetime types
4463
64+ #ifdef SQLITE3PP_LOADABLE_EXTENSION
65+ #include " sqlite3ext.h"
66+ SQLITE_EXTENSION_INIT1
67+ #else
4568#include " sqlite3.h"
69+ #endif
70+ #include " SQLiteDLLConnect.h" // [David Maisonave changes] -- Used for run time level connection to SQLite3.dll
4671
4772namespace sqlite3pp
4873{
74+ class database ;
75+ namespace ext
76+ {
77+ class function ;
78+ class aggregate ;
79+ database borrow (sqlite3* pdb);
80+ }
81+
4982#if defined(SQLITE3PP_NO_UNICODE) || !defined(_UNICODE)
5083 using tstring = std::string;
5184#else
@@ -60,16 +93,6 @@ namespace sqlite3pp
6093 struct Datetime {std::tm tm_struct;};
6194 using TEXT = tstring;
6295#endif // !SQLITE3PP_CONVERT_TO_RESULTING_AFFINITY
63-
64- class database ;
65-
66- namespace ext
67- {
68- class function ;
69- class aggregate ;
70- database borrow (sqlite3* pdb);
71- }
72-
7396 template <class T >
7497 struct convert {
7598 using to_int = int ;
@@ -91,15 +114,9 @@ namespace sqlite3pp
91114 NonCopyable& operator =(NonCopyable const &) = delete ;
92115 };
93116
94- // struct sqlite3_api_routines;
95- class db_api_root
96- {
97- public:
98- db_api_root ();
99- };
100-
101- class database : public db_api_root , private NonCopyable
117+ class database : NonCopyable
102118 {
119+ SQLite_DLL::RunTimeConnect* runTimeConnect = NULL ;// [David Maisonave changes] -- Used for run time level connection to SQLite3.dll
103120 friend class statement ;
104121 friend class database_error ;
105122 friend class ext ::function;
@@ -115,18 +132,17 @@ namespace sqlite3pp
115132 using backup_handler = std::function<void (int , int , int )>;
116133
117134 explicit database ( char const * dbname = nullptr , int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, const char * vfs = nullptr );
118-
119135 database (database&& db);
120136 database& operator =(database&& db);
121-
137+ database (const std::string dbname, int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, const char * vfs = nullptr );// [David Maisonave changes] -- Add std::string support
138+ database (sqlite3* pdb); // [David Maisonave changes] -- Not sure why this was made private, but this constructor can be usefull when mixing classes of similar type.
122139 ~database ();
123140
124141#ifndef SQLITE3PP_NO_UNICODE
125142 // Unicode support
126143 explicit database ( const wchar_t * dbname, int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, const wchar_t * vfs = nullptr );
127144 int connect ( const wchar_t * dbname, int flags, const wchar_t * vfs = nullptr );
128145 int execute ( const std::wstring& sql );
129- int execute ( const std::string& sql );
130146 int attach (const wchar_t * dbname, const wchar_t * name);
131147 int detach (const wchar_t * name);
132148 int backup (const wchar_t * dbname, database& destdb, const wchar_t * destdbname, backup_handler h, int step_page = 5 );
@@ -154,8 +170,8 @@ namespace sqlite3pp
154170 char const * error_msg () const ;
155171
156172 int execute ( char const * sql );
157- int executef (char const * sql, ...);
158-
173+ // int executef(char const* sql, ...);// [David Maisonave changes] -- Removed this variadic function of executef because could not compile it in manage C++ code.
174+ int execute ( const std::string& sql); // [David Maisonave changes] -- Adding std::string capabilities
159175 int set_busy_timeout (int ms);
160176
161177 void set_busy_handler (busy_handler h);
@@ -165,8 +181,8 @@ namespace sqlite3pp
165181 void set_authorize_handler (authorize_handler h);
166182
167183 private:
168- database (sqlite3* pdb);
169-
184+ int executef ( char const * sql, const char * dbname, const char * name); // [David Maisonave changes] -- Added this to replace associated variadic function which doesn't compile in manage C++ code.
185+ int executef ( char const * sql, const char * name); // [David Maisonave changes] -- Added this to replace associated variadic function which doesn't compile in manage C++ code.
170186 private:
171187 sqlite3* db_;
172188 bool borrowing_;
@@ -182,13 +198,12 @@ namespace sqlite3pp
182198 {
183199 public:
184200 explicit database_error (char const * msg);
185- explicit database_error (const std::string& msg);
201+ explicit database_error (const std::string& msg);// [David Maisonave changes] -- Adding std::string capabilities
186202 explicit database_error (database& db);
187203 };
188204
189205 enum copy_semantic { copy, nocopy };
190-
191- class statement : public db_api_root , private NonCopyable
206+ class statement : NonCopyable
192207 {
193208 public:
194209 int prepare (char const * stmt);
@@ -354,9 +369,8 @@ namespace sqlite3pp
354369 private:
355370 sqlite3_stmt* stmt_;
356371 };
357-
358- class query_iterator
359- : public std::iterator<std::input_iterator_tag, rows>
372+ #pragma warning (disable : 4996) // [David Maisonave changes] -- Remove compiler warning for deprecated iterator.
373+ class query_iterator : public std ::iterator<std::input_iterator_tag, rows>
360374 {
361375 public:
362376 query_iterator ();
@@ -366,8 +380,7 @@ namespace sqlite3pp
366380 bool operator !=(query_iterator const &) const ;
367381
368382 query_iterator& operator ++();
369- query::rows operator *() const ;
370-
383+ value_type operator *() const ;
371384 private:
372385 query* cmd_;
373386 int rc_;
@@ -388,7 +401,7 @@ namespace sqlite3pp
388401 iterator end ();
389402 };
390403
391- class transaction : public db_api_root , private NonCopyable
404+ class transaction : NonCopyable
392405 {
393406 public:
394407 explicit transaction (database& db, bool fcommit = false , bool freserve = false );
0 commit comments