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