59 Commits

Author SHA1 Message Date
Sébastien Rombauts
dcc623d745 Remove some redundant inline keywords 2020-01-04 20:46:11 +01:00
Sébastien Rombauts
da4d692c13 Start a new 3.x branch requiring C++11 and CMake 3.1
- Remove support for Visual Studio < 2015
- Remove Statement::isOk() deprecated in 2.2.0 and renamed to Statement::hasRow()
2020-01-02 00:04:06 +01:00
Sébastien Rombauts
e6288ee920 Update copyright notice 2020-01-01 08:08:59 +01:00
Sébastien Rombauts
49c1f6c08d Rename Statement::getExpandedSQL() from #201 and fix #203 #205 memory leak 2019-06-24 22:01:54 +02:00
Oleg Smolsky
ce45099695 Add Statement::getExtendedSQL()
- it returns a UTF-8 string containing the SQL text of prepared statement with
   bound parameters expanded
2019-06-15 10:27:30 -07:00
Sébastien Rombauts
f2b1017710 Add a Statement::Ptr move constructor to fix leak because of ref counter incremented on copy 2019-03-05 00:20:06 +01:00
Sébastien Rombauts
f1301a4a11
Merge pull request #192 from jrave/bind_parameter_count
Add wrapper for bind parameter count
2019-03-04 20:18:49 +01:00
Sébastien Rombauts
78915c8f43 Fix #190 Add Statement move constructor 2019-03-04 18:43:59 +01:00
Johannes Rave
1dab172264 Add wrapper for bind parameter count 2019-03-04 18:43:32 +02:00
Sébastien Rombauts
df7d113a3b Add test case to try to repro the reported ambiguous bind() int64_t on LP64 Android 2019-03-02 23:43:03 +01:00
Sébastien Rombauts
2cb3cb2fef Update copyright notice 2019-03-02 15:46:53 +01:00
Sébastien Rombauts
a41629f9ed Fix #155 Statement::bind truncates long integer to 32 bits on x86_64 Linux
Reproduced the problem with a dedicated unit test, then fixed the bug.

Thanks @tszypenbejl for the clear analysis and the fix.
2018-02-23 17:10:53 +01:00
Sébastien Rombauts
d020c5f694 Update copyright notices to 2018 2018-01-24 11:26:38 +01:00
Alexander Guettler
cebea884c3
Add the fix from a3160dcfc2f80f692f3477a67c202ff87f75fa5a also to the bind by name functions 2017-11-09 11:05:01 -08:00
Sébastien Rombauts
a3160dcfc2 Add Statement binding for long int values to Fix #147 2017-11-06 13:02:23 +01:00
Sébastien Rombauts
4f7899c959 Rename Statement::mbIsOk to mbHasRow 2017-08-28 17:17:18 +02:00
Sébastien Rombauts
c14d884ba5 Mutualize code into tryExecuteStep() from PR #142 using SQLITE_MISUSE when statement needs to be reseted 2017-08-28 17:10:38 +02:00
Sébastien Rombauts
94c7897d1b Cleanup on PR #142 : remove whitespaces and mutualize some code 2017-08-28 16:00:50 +02:00
Henrik Jakobsson Majava
8191046ea5 Added tryExecuteStep and tryReset 2017-08-28 11:00:17 +02:00
fekir
ec8253236b Remove virtual destructor since there are no virtual methods or subclasses 2017-08-22 18:32:40 +02:00
fekir
1fd32277c1 Remove unnecessary noexcept identifier from destructors 2017-08-21 22:01:21 +02:00
dunkelfalke
f4a7e7c7ea Update Statement.h
Missing parameter name in the documentation comment
2017-03-21 17:45:39 +01:00
dend
f01a644dc0 Added convenience functions for constructing objects from a row 2017-02-12 22:10:29 -05:00
Sébastien Rombauts
f77b707206 Revert recent switch from uint32_t/int64_t to use int/unsigned/long/long long and fix #93 2016-07-19 10:56:08 +02:00
Sébastien Rombauts
223c14139b Minor comment style cleanups 2016-07-16 17:04:49 +02:00
Sébastien Rombauts
7983b81f75 Mutualize code between getColumn(name) and isColumnNull(name) with a getColumnIndex(name)
- mColumnNames is mutable so that getColumnIndex() and isColumnNull() can be const
2016-07-16 16:33:44 +02:00
Bruno Coelho
f022c6af60 Add option to check if column is null by name 2016-07-15 16:15:34 +01:00
Sébastien Rombauts
401b7361ed Renamed errmsg() and getErrStr() methods to getErrorMsg() and getErrorStr() 2016-07-13 18:37:22 +02:00
Sébastien Rombauts
fd8f50bdd9 Remove last #include <sqlite3.h> from a header : add a few public constants
- Move #include <sqlite3.h> from Exception.h to a new corresponding .cpp
 - Add SQLite::OPEN_READONLY...
2016-07-13 17:16:41 +02:00
Sébastien Rombauts
57d991b85e Complete unit tests for Database::errmsg() 2016-07-08 17:41:35 +02:00
Sébastien Rombauts
fb5508921a Move #include <sqlite3.h> from Database.h to the .cpp 2016-07-08 17:07:59 +02:00
Sébastien Rombauts
ed052a36bd Add unit test for bindNoCopy() 2016-07-07 21:53:45 +02:00
Sébastien Rombauts
8275c7fb29 Move #include <sqlite3.h> from Statement.h to the .cpp 2016-07-07 08:43:32 +02:00
Sébastien Rombauts
646d25ca95 Switch from sqlite3_int64 to int64_t 2016-07-05 11:05:16 +02:00
Sébastien Rombauts
9c03f4e86b Add bindNoCopy() for C-style null-terminated text strings 2016-07-03 16:55:27 +02:00
Sébastien Rombauts
e7384b30a8 Remove unfinished Statement move constructor from PR #86
- see comments in code: needs a move constructor on Statement::Ptr
2016-07-02 14:14:08 +02:00
Sébastien Rombauts
bcdbea2cf8 Style cleanup on top of PR #86 2016-07-02 14:11:02 +02:00
Douglas Heriot
9a07f3918d Fix build on Linux, including cpplint warnings. 2016-07-02 14:05:14 +02:00
Douglas Heriot
a84c04aada Add bindNoCopy methods to allow binding std::string with SQLITE_STATIC.
Should be safe, as long as you can guarantee the std::string exists while executing the query.

Added an accessor to Column that returns a std::string, that can handle BLOB or TEXT values that contain null-bytes.

Also more binding & Column cast support for uint32_t - fixes ambiguous overload errors when using unsigned-integer types.
Note that I didn't use uint64_t, because unsigned 64-bit integers doesn't fit into SQLite (except for using int64_t and dealing with overflow with custom functions).

Added a C++11 move constructor to Statement, to allow storing it inside STL containers (eg. vector).
2016-07-02 14:05:14 +02:00
Douglas Heriot
832e89440f Better exception messages when statements fail
Added new constructor to Exception that takes sqlite3* pointer, allowing for getting more information out. Makes it much easier to debug syntax errors in prepared statements, for example.
2016-05-26 00:34:34 +10:00
Sébastien Rombauts
c53d885393 Update copyright notice to 2016 2016-02-10 10:27:47 +01:00
Sébastien Rombauts
b7b440de5d Fix #73 Wrong exception thrown by Database constructor
- switched from sqlite3_errmsg() to sqlite3_errstr() where applicable
2015-11-10 18:32:24 +01:00
Sébastien Rombauts
d36c39ccf3 Fix CppDepends most useful warnings:
- Convert last old-style cast to reinterpret_cast<>
 - Statement::Ptr is now private, with a friend declaration for Column
 - noexcept should not be defined as the depreacted throw()
2015-06-01 22:05:24 +02:00
Sébastien Rombauts
3c39f1ff1c Fix 3 new cpplint warnings about max line size 2015-05-03 23:32:40 +02:00
Sébastien Rombauts
f5e0cafa72 Minor fixes to comments and fix the build 2015-05-03 23:32:24 +02:00
Sébastien Rombauts
8797f16d12 Add Statement::getColumnName(aIndex)
- enable getting names befor gettings rows of result
2015-05-03 23:32:05 +02:00
Sébastien Rombauts
7fbfc29677 Fix #23 optimized Statement::getColumn() by name
- fix Statement::getColumn(apName) provided by #45 but was not working
  instead of using #46 that conflicts with current master
- rework it by using a map of columns name as
  a cache populated the first time the method is called
- add corresponding Unit Test
2015-05-03 23:28:41 +02:00
Jack.Yuan
b6fdf50669 Fix issue: Column by name #23
add method `Column getColumn(const char* aName);` in Statement.h
2015-04-17 15:59:58 +08:00
Sébastien Rombauts
b84721aed3 Update copyright date in recently modified files 2015-03-08 22:53:33 +01:00
Sébastien Rombauts
f31a459cd8 Revert #31 Statement now stores the status of the last operation.
- the check in the destructor was not a good idea finaly,
   and I added instead a getErrorCode() method
2015-03-08 15:12:26 +01:00