Skip to content

Commit e76e5b3

Browse files
committed
Improve error handling when saving
Report any errors that might occur while saving changes to the database to the user. Also warn the user that this means the database wasn't saved entirely. See issue sqlitebrowser#770.
1 parent 2563d67 commit e76e5b3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/MainWindow.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,13 @@ void MainWindow::dbState( bool dirty )
11131113
void MainWindow::fileSave()
11141114
{
11151115
if(db.isOpen())
1116-
db.releaseAllSavepoints();
1116+
{
1117+
if(!db.releaseAllSavepoints())
1118+
{
1119+
QMessageBox::warning(this, QApplication::applicationName(), tr("Error while saving the database file. This means that not all changes to the database were "
1120+
"saved. You need to resolve the following error first.\n\n%1").arg(db.lastErrorMessage));
1121+
}
1122+
}
11171123
}
11181124

11191125
void MainWindow::fileRevert()

src/sqlitedb.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ bool DBBrowserDB::releaseSavepoint(const QString& pointname)
288288
return false;
289289

290290
QString query = QString("RELEASE %1;").arg(pointname);
291-
executeSQL(query, false, false);
291+
if(!executeSQL(query, false, false))
292+
return false;
292293
savepointList.removeAll(pointname);
293294
emit dbChanged(getDirty());
294295

0 commit comments

Comments
 (0)