File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ namespace sqlite3pp
163
163
164
164
protected:
165
165
explicit statement (database& db, char const * stmt = nullptr );
166
- ~statement () noexcept ( false ) ;
166
+ ~statement ();
167
167
168
168
int prepare_impl (char const * stmt);
169
169
int finish_impl (sqlite3_stmt* stmt);
@@ -311,7 +311,7 @@ namespace sqlite3pp
311
311
{
312
312
public:
313
313
explicit transaction (database& db, bool fcommit = false , bool freserve = false );
314
- ~transaction () noexcept ( false ) ;
314
+ ~transaction ();
315
315
316
316
int commit ();
317
317
int rollback ();
Original file line number Diff line number Diff line change @@ -232,11 +232,11 @@ namespace sqlite3pp
232
232
}
233
233
}
234
234
235
- inline statement::~statement () noexcept ( false )
235
+ inline statement::~statement ()
236
236
{
237
- auto rc = finish ();
238
- if (rc != SQLITE_OK)
239
- throw database_error (db_ );
237
+ // finish() can return error. If you want to check the error, call
238
+ // finish() explicitly before this object is destructed.
239
+ finish ( );
240
240
}
241
241
242
242
inline int statement::prepare (char const * stmt)
@@ -550,12 +550,13 @@ namespace sqlite3pp
550
550
throw database_error (*db_);
551
551
}
552
552
553
- inline transaction::~transaction () noexcept ( false )
553
+ inline transaction::~transaction ()
554
554
{
555
555
if (db_) {
556
- auto rc = db_->execute (fcommit_ ? " COMMIT" : " ROLLBACK" );
557
- if (rc != SQLITE_OK)
558
- throw database_error (*db_);
556
+ // execute() can return error. If you want to check the error,
557
+ // call commit() or rollback() explicitly before this object is
558
+ // destructed.
559
+ db_->execute (fcommit_ ? " COMMIT" : " ROLLBACK" );
559
560
}
560
561
}
561
562
You can’t perform that action at this time.
0 commit comments