File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ namespace sqlite3pp
163163
164164 protected:
165165 explicit statement (database& db, char const * stmt = nullptr );
166- ~statement () noexcept ( false ) ;
166+ ~statement ();
167167
168168 int prepare_impl (char const * stmt);
169169 int finish_impl (sqlite3_stmt* stmt);
@@ -311,7 +311,7 @@ namespace sqlite3pp
311311 {
312312 public:
313313 explicit transaction (database& db, bool fcommit = false , bool freserve = false );
314- ~transaction () noexcept ( false ) ;
314+ ~transaction ();
315315
316316 int commit ();
317317 int rollback ();
Original file line number Diff line number Diff line change @@ -232,11 +232,11 @@ namespace sqlite3pp
232232 }
233233 }
234234
235- inline statement::~statement () noexcept ( false )
235+ inline statement::~statement ()
236236 {
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 ( );
240240 }
241241
242242 inline int statement::prepare (char const * stmt)
@@ -550,12 +550,13 @@ namespace sqlite3pp
550550 throw database_error (*db_);
551551 }
552552
553- inline transaction::~transaction () noexcept ( false )
553+ inline transaction::~transaction ()
554554 {
555555 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" );
559560 }
560561 }
561562
You can’t perform that action at this time.
0 commit comments