mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 09:46:02 -04:00
This commit is contained in:
parent
a68397c7ac
commit
49c1f6c08d
@ -136,3 +136,4 @@ Version ?
|
||||
- #192 Add wrapper for bind parameter count
|
||||
- #197 Add tuple_bind and execute_many
|
||||
- #199 Fix #156 misleading error message in exception from Statement::exec
|
||||
- #201 Add Statement::getExpandedSQL() to get the SQL text of prepared statement with bound parameters expanded
|
@ -610,7 +610,7 @@ public:
|
||||
}
|
||||
|
||||
// Return a UTF-8 string containing the SQL text of prepared statement with bound parameters expanded.
|
||||
std::string getExtendedSQL();
|
||||
std::string getExpandedSQL();
|
||||
|
||||
/// Return the number of columns in the result set returned by the prepared statement
|
||||
inline int getColumnCount() const
|
||||
|
@ -426,8 +426,11 @@ const char* Statement::getErrorMsg() const noexcept // nothrow
|
||||
}
|
||||
|
||||
// Return a UTF-8 string containing the SQL text of prepared statement with bound parameters expanded.
|
||||
std::string Statement::getExtendedSQL() {
|
||||
return sqlite3_expanded_sql(mStmtPtr);
|
||||
std::string Statement::getExpandedSQL() {
|
||||
char* expanded = sqlite3_expanded_sql(mStmtPtr);
|
||||
std::string expandedString(expanded);
|
||||
sqlite3_free(expanded);
|
||||
return expandedString;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -257,7 +257,7 @@ TEST(Statement, bindings)
|
||||
insert.bind(1, text);
|
||||
insert.bind(2, integer);
|
||||
insert.bind(3, dbl);
|
||||
EXPECT_EQ(insert.getExtendedSQL(), "INSERT INTO test VALUES (NULL, 'first', -123, 0.123)");
|
||||
EXPECT_EQ(insert.getExpandedSQL(), "INSERT INTO test VALUES (NULL, 'first', -123, 0.123)");
|
||||
EXPECT_EQ(1, insert.exec());
|
||||
EXPECT_EQ(SQLITE_DONE, db.getErrorCode());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user