Skip to content

Commit 1696ad1

Browse files
committed
Remove all the "no error" error messages
They are kind of pointless because, really, they never should be visible to the user. If there is no error we shouldn't show an error message and if there is an error we should show a proper error message. Especially during bunch executions of SQL statements by calling DBBrowserDB::executeSQL() (like when importing a huge CSV file) this avoids a whole bunch of string copy operations and calls to tr() and should therefore increase the performance a bit, too.
1 parent a598e0d commit 1696ad1

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/sqlitedb.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ bool DBBrowserDB::open(const QString& db)
6969
{
7070
if (isOpen()) close();
7171

72-
lastErrorMessage = tr("no error");
73-
7472
isEncrypted = false;
7573

7674
// Get encryption settings for database file
@@ -298,8 +296,6 @@ bool DBBrowserDB::create ( const QString & db)
298296

299297
if (isOpen()) close();
300298

301-
lastErrorMessage = tr("no error");
302-
303299
// read encoding from settings and open with sqlite3_open for utf8
304300
// and sqlite3_open16 for utf16
305301
QSettings settings(QApplication::organizationName(), QApplication::organizationName());
@@ -547,19 +543,15 @@ bool DBBrowserDB::dump(const QString& filename,
547543
bool DBBrowserDB::executeSQL ( const QString & statement, bool dirtyDB, bool logsql)
548544
{
549545
char *errmsg;
550-
bool ok = false;
551546

552547
if (!isOpen())
553548
return false;
554549

555550
if (logsql) logSQL(statement, kLogMsg_App);
556551
if (dirtyDB) setRestorePoint();
557-
if (SQLITE_OK == sqlite3_exec(_db, statement.toUtf8(), NULL, NULL, &errmsg))
558-
ok = true;
559552

560-
if(ok)
553+
if (SQLITE_OK == sqlite3_exec(_db, statement.toUtf8(), NULL, NULL, &errmsg))
561554
{
562-
lastErrorMessage = tr("no error");
563555
return true;
564556
} else {
565557
lastErrorMessage = QString("%1 (%2)").arg(QString::fromUtf8(errmsg)).arg(statement);
@@ -783,7 +775,6 @@ bool DBBrowserDB::deleteRecord(const QString& table, const QString& rowid)
783775
{
784776
if (!isOpen()) return false;
785777
bool ok = false;
786-
lastErrorMessage = QString("no error");
787778

788779
QString statement = QString("DELETE FROM `%1` WHERE `%2`='%3';").arg(table).arg(getObjectByName(table).table.rowidColumn()).arg(rowid);
789780
if(executeSQL(statement))
@@ -798,8 +789,6 @@ bool DBBrowserDB::updateRecord(const QString& table, const QString& column, cons
798789
{
799790
if (!isOpen()) return false;
800791

801-
lastErrorMessage = QString("no error");
802-
803792
QString sql = QString("UPDATE `%1` SET `%2`=? WHERE `%3`='%4';").arg(table).arg(column).arg(getObjectByName(table).table.rowidColumn()).arg(rowid);
804793

805794
logSQL(sql, kLogMsg_App);
@@ -1092,7 +1081,6 @@ void DBBrowserDB::updateSchema( )
10921081
sqlite3_stmt *vm;
10931082
const char *tail;
10941083
int err=0;
1095-
lastErrorMessage = tr("no error");
10961084

10971085
objMap.clear();
10981086

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy