mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
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.
This commit is contained in:
@@ -69,8 +69,6 @@ bool DBBrowserDB::open(const QString& db)
|
||||
{
|
||||
if (isOpen()) close();
|
||||
|
||||
lastErrorMessage = tr("no error");
|
||||
|
||||
isEncrypted = false;
|
||||
|
||||
// Get encryption settings for database file
|
||||
@@ -298,8 +296,6 @@ bool DBBrowserDB::create ( const QString & db)
|
||||
|
||||
if (isOpen()) close();
|
||||
|
||||
lastErrorMessage = tr("no error");
|
||||
|
||||
// read encoding from settings and open with sqlite3_open for utf8
|
||||
// and sqlite3_open16 for utf16
|
||||
QSettings settings(QApplication::organizationName(), QApplication::organizationName());
|
||||
@@ -547,19 +543,15 @@ bool DBBrowserDB::dump(const QString& filename,
|
||||
bool DBBrowserDB::executeSQL ( const QString & statement, bool dirtyDB, bool logsql)
|
||||
{
|
||||
char *errmsg;
|
||||
bool ok = false;
|
||||
|
||||
if (!isOpen())
|
||||
return false;
|
||||
|
||||
if (logsql) logSQL(statement, kLogMsg_App);
|
||||
if (dirtyDB) setRestorePoint();
|
||||
if (SQLITE_OK == sqlite3_exec(_db, statement.toUtf8(), NULL, NULL, &errmsg))
|
||||
ok = true;
|
||||
|
||||
if(ok)
|
||||
if (SQLITE_OK == sqlite3_exec(_db, statement.toUtf8(), NULL, NULL, &errmsg))
|
||||
{
|
||||
lastErrorMessage = tr("no error");
|
||||
return true;
|
||||
} else {
|
||||
lastErrorMessage = QString("%1 (%2)").arg(QString::fromUtf8(errmsg)).arg(statement);
|
||||
@@ -783,7 +775,6 @@ bool DBBrowserDB::deleteRecord(const QString& table, const QString& rowid)
|
||||
{
|
||||
if (!isOpen()) return false;
|
||||
bool ok = false;
|
||||
lastErrorMessage = QString("no error");
|
||||
|
||||
QString statement = QString("DELETE FROM `%1` WHERE `%2`='%3';").arg(table).arg(getObjectByName(table).table.rowidColumn()).arg(rowid);
|
||||
if(executeSQL(statement))
|
||||
@@ -798,8 +789,6 @@ bool DBBrowserDB::updateRecord(const QString& table, const QString& column, cons
|
||||
{
|
||||
if (!isOpen()) return false;
|
||||
|
||||
lastErrorMessage = QString("no error");
|
||||
|
||||
QString sql = QString("UPDATE `%1` SET `%2`=? WHERE `%3`='%4';").arg(table).arg(column).arg(getObjectByName(table).table.rowidColumn()).arg(rowid);
|
||||
|
||||
logSQL(sql, kLogMsg_App);
|
||||
@@ -1092,7 +1081,6 @@ void DBBrowserDB::updateSchema( )
|
||||
sqlite3_stmt *vm;
|
||||
const char *tail;
|
||||
int err=0;
|
||||
lastErrorMessage = tr("no error");
|
||||
|
||||
objMap.clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user