@@ -52,7 +52,7 @@ bool DBBrowserDB::open(const QString& db)
52
52
53
53
if (isOpen ()) close ();
54
54
55
- lastErrorMessage = QObject:: tr (" no error" );
55
+ lastErrorMessage = tr (" no error" );
56
56
57
57
isEncrypted = false ;
58
58
@@ -218,7 +218,7 @@ bool DBBrowserDB::create ( const QString & db)
218
218
219
219
if (isOpen ()) close ();
220
220
221
- lastErrorMessage = QObject:: tr (" no error" );
221
+ lastErrorMessage = tr (" no error" );
222
222
223
223
// read encoding from settings and open with sqlite3_open for utf8
224
224
// and sqlite3_open16 for utf16
@@ -272,8 +272,8 @@ bool DBBrowserDB::close()
272
272
{
273
273
QMessageBox::StandardButton reply = QMessageBox::question (0 ,
274
274
QApplication::applicationName (),
275
- QObject:: tr (" Do you want to save the changes "
276
- " made to the database file %1?" ).arg (curDBFilename),
275
+ tr (" Do you want to save the changes "
276
+ " made to the database file %1?" ).arg (curDBFilename),
277
277
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
278
278
279
279
// If the user clicked the cancel button stop here and return false
@@ -324,8 +324,8 @@ bool DBBrowserDB::dump(const QString& filename)
324
324
}
325
325
}
326
326
327
- QProgressDialog progress (QObject:: tr (" Exporting database to SQL file..." ),
328
- QObject:: tr (" Cancel" ), 0 , numRecordsTotal);
327
+ QProgressDialog progress (tr (" Exporting database to SQL file..." ),
328
+ tr (" Cancel" ), 0 , numRecordsTotal);
329
329
progress.setWindowModality (Qt::ApplicationModal);
330
330
progress.show ();
331
331
qApp->processEvents ();
@@ -470,8 +470,8 @@ bool DBBrowserDB::executeMultiSQL(const QString& statement, bool dirty, bool log
470
470
471
471
// Show progress dialog
472
472
int statement_size = statement.size ();
473
- QProgressDialog progress (QObject:: tr (" Executing SQL..." ),
474
- QObject:: tr (" Cancel" ), 0 , statement_size);
473
+ QProgressDialog progress (tr (" Executing SQL..." ),
474
+ tr (" Cancel" ), 0 , statement_size);
475
475
progress.setWindowModality (Qt::ApplicationModal);
476
476
progress.show ();
477
477
@@ -491,7 +491,7 @@ bool DBBrowserDB::executeMultiSQL(const QString& statement, bool dirty, bool log
491
491
qApp->processEvents ();
492
492
if (progress.wasCanceled ())
493
493
{
494
- lastErrorMessage = QObject:: tr (" Action cancelled." );
494
+ lastErrorMessage = tr (" Action cancelled." );
495
495
return false ;
496
496
}
497
497
@@ -502,15 +502,15 @@ bool DBBrowserDB::executeMultiSQL(const QString& statement, bool dirty, bool log
502
502
if (sqlite3_step (vm) == SQLITE_ERROR)
503
503
{
504
504
sqlite3_finalize (vm);
505
- lastErrorMessage = QObject:: tr (" Error in statement #%1: %2.\n "
505
+ lastErrorMessage = tr (" Error in statement #%1: %2.\n "
506
506
" Aborting execution." ).arg (line).arg (sqlite3_errmsg (_db));
507
507
qWarning () << lastErrorMessage;
508
508
return false ;
509
509
} else {
510
510
sqlite3_finalize (vm);
511
511
}
512
512
} else {
513
- lastErrorMessage = QObject:: tr (" Error in statement #%1: %2.\n "
513
+ lastErrorMessage = tr (" Error in statement #%1: %2.\n "
514
514
" Aborting execution." ).arg (line).arg (sqlite3_errmsg (_db));
515
515
qWarning () << lastErrorMessage;
516
516
return false ;
@@ -756,7 +756,7 @@ bool DBBrowserDB::renameColumn(const QString& tablename, const QString& name, sq
756
756
QString tableSql = getObjectByName (tablename).getsql ();
757
757
if (tableSql.isEmpty ())
758
758
{
759
- lastErrorMessage = QObject:: tr (" renameColumn: cannot find table %1." ).arg (tablename);
759
+ lastErrorMessage = tr (" renameColumn: cannot find table %1." ).arg (tablename);
760
760
qWarning () << lastErrorMessage;
761
761
return false ;
762
762
}
@@ -767,15 +767,15 @@ bool DBBrowserDB::renameColumn(const QString& tablename, const QString& name, sq
767
767
// Check if field actually exists
768
768
if (oldSchema.findField (name) == -1 )
769
769
{
770
- lastErrorMessage = QObject:: tr (" renameColumn: cannot find column %1." ).arg (name);
770
+ lastErrorMessage = tr (" renameColumn: cannot find column %1." ).arg (name);
771
771
qWarning () << lastErrorMessage;
772
772
return false ;
773
773
}
774
774
775
775
// Create savepoint to be able to go back to it in case of any error
776
776
if (!executeSQL (" SAVEPOINT sqlitebrowser_rename_column" ))
777
777
{
778
- lastErrorMessage = QObject:: tr (" renameColumn: creating savepoint failed. DB says: %1" ).arg (lastErrorMessage);
778
+ lastErrorMessage = tr (" renameColumn: creating savepoint failed. DB says: %1" ).arg (lastErrorMessage);
779
779
qWarning () << lastErrorMessage;
780
780
return false ;
781
781
}
@@ -815,7 +815,7 @@ bool DBBrowserDB::renameColumn(const QString& tablename, const QString& name, sq
815
815
// Create the new table
816
816
if (!executeSQL (newSchema.sql ()))
817
817
{
818
- lastErrorMessage = QObject:: tr (" renameColumn: creating new table failed. DB says: %1" ).arg (lastErrorMessage);
818
+ lastErrorMessage = tr (" renameColumn: creating new table failed. DB says: %1" ).arg (lastErrorMessage);
819
819
qWarning () << lastErrorMessage;
820
820
executeSQL (" ROLLBACK TO SAVEPOINT sqlitebrowser_rename_column;" );
821
821
return false ;
@@ -824,8 +824,7 @@ bool DBBrowserDB::renameColumn(const QString& tablename, const QString& name, sq
824
824
// Copy the data from the old table to the new one
825
825
if (!executeSQL (QString (" INSERT INTO sqlitebrowser_rename_column_new_table SELECT %1 FROM `%2`;" ).arg (select_cols).arg (tablename)))
826
826
{
827
- lastErrorMessage = QObject::tr (" renameColumn: copying data to new table failed. DB says:\n "
828
- " %1" ).arg (lastErrorMessage);
827
+ lastErrorMessage = tr (" renameColumn: copying data to new table failed. DB says:\n %1" ).arg (lastErrorMessage);
829
828
qWarning () << lastErrorMessage;
830
829
executeSQL (" ROLLBACK TO SAVEPOINT sqlitebrowser_rename_column;" );
831
830
return false ;
@@ -843,7 +842,7 @@ bool DBBrowserDB::renameColumn(const QString& tablename, const QString& name, sq
843
842
// Delete the old table
844
843
if (!executeSQL (QString (" DROP TABLE `%1`;" ).arg (tablename)))
845
844
{
846
- lastErrorMessage = QObject:: tr (" renameColumn: deleting old table failed. DB says: %1" ).arg (lastErrorMessage);
845
+ lastErrorMessage = tr (" renameColumn: deleting old table failed. DB says: %1" ).arg (lastErrorMessage);
847
846
qWarning () << lastErrorMessage;
848
847
executeSQL (" ROLLBACK TO SAVEPOINT sqlitebrowser_rename_column;" );
849
848
return false ;
@@ -859,16 +858,16 @@ bool DBBrowserDB::renameColumn(const QString& tablename, const QString& name, sq
859
858
// Restore the saved triggers, views and indices
860
859
if (!executeMultiSQL (otherObjectsSql, true , true ))
861
860
{
862
- QMessageBox::information (0 , qApp->applicationName (), QObject:: tr (" Restoring some of the objects associated with this table failed. "
863
- " This is most likely because some column names changed. "
864
- " Here's the SQL statement which you might want to fix and execute manually:\n\n " )
861
+ QMessageBox::information (0 , qApp->applicationName (), tr (" Restoring some of the objects associated with this table failed. "
862
+ " This is most likely because some column names changed. "
863
+ " Here's the SQL statement which you might want to fix and execute manually:\n\n " )
865
864
+ otherObjectsSql);
866
865
}
867
866
868
867
// Release the savepoint - everything went fine
869
868
if (!executeSQL (" RELEASE SAVEPOINT sqlitebrowser_rename_column;" ))
870
869
{
871
- lastErrorMessage = QObject:: tr (" renameColumn: releasing savepoint failed. DB says: %1" ).arg (lastErrorMessage);
870
+ lastErrorMessage = tr (" renameColumn: releasing savepoint failed. DB says: %1" ).arg (lastErrorMessage);
872
871
qWarning () << lastErrorMessage;
873
872
return false ;
874
873
}
@@ -883,7 +882,7 @@ bool DBBrowserDB::renameTable(const QString& from_table, const QString& to_table
883
882
QString sql = QString (" ALTER TABLE `%1` RENAME TO `%2`" ).arg (from_table, to_table);
884
883
if (!executeSQL (sql))
885
884
{
886
- QString error = QObject:: tr (" Error renaming table '%1' to '%2'."
885
+ QString error = tr (" Error renaming table '%1' to '%2'."
887
886
" Message from database engine:\n %3" ).arg (from_table).arg (to_table).arg (lastErrorMessage);
888
887
lastErrorMessage = error;
889
888
qWarning () << lastErrorMessage;
@@ -940,7 +939,7 @@ void DBBrowserDB::logSQL(QString statement, int msgtype)
940
939
if (statement.at (i) < 32 && statement.at (i) != ' \n ' )
941
940
{
942
941
statement.truncate (32 );
943
- statement.append (QObject:: tr (" ... <string can not be logged, contains binary data> ..." ));
942
+ statement.append (tr (" ... <string can not be logged, contains binary data> ..." ));
944
943
945
944
// early exit if we detect a binary character,
946
945
// to prevent checking all characters in a potential big string
@@ -956,7 +955,7 @@ void DBBrowserDB::updateSchema( )
956
955
sqlite3_stmt *vm;
957
956
const char *tail;
958
957
int err=0 ;
959
- lastErrorMessage = QObject:: tr (" no error" );
958
+ lastErrorMessage = tr (" no error" );
960
959
961
960
objMap.clear ();
962
961
@@ -981,11 +980,11 @@ void DBBrowserDB::updateSchema( )
981
980
if (val1 == " table" || val1 == " index" || val1 == " view" || val1 == " trigger" )
982
981
objMap.insert (val1, DBBrowserObject (val2, val3, val1, val4));
983
982
else
984
- qWarning () << QObject:: tr (" unknown object type %1" ).arg (val1);
983
+ qWarning () << tr (" unknown object type %1" ).arg (val1);
985
984
}
986
985
sqlite3_finalize (vm);
987
986
}else {
988
- qWarning () << QObject:: tr (" could not get list of db objects: %1, %2" ).arg (err).arg (sqlite3_errmsg (_db));
987
+ qWarning () << tr (" could not get list of db objects: %1, %2" ).arg (err).arg (sqlite3_errmsg (_db));
989
988
}
990
989
991
990
// now get the field list for each table
@@ -1015,7 +1014,7 @@ void DBBrowserDB::updateSchema( )
1015
1014
}
1016
1015
sqlite3_finalize (vm);
1017
1016
} else {
1018
- lastErrorMessage = QObject:: tr (" could not get types" );
1017
+ lastErrorMessage = tr (" could not get types" );
1019
1018
}
1020
1019
}
1021
1020
}
@@ -1038,11 +1037,11 @@ QString DBBrowserDB::getPragma(const QString& pragma)
1038
1037
if (sqlite3_step (vm) == SQLITE_ROW)
1039
1038
retval = QString::fromUtf8 ((const char *) sqlite3_column_text (vm, 0 ));
1040
1039
else
1041
- qWarning () << QObject:: tr (" didn't receive any output from pragma %1" ).arg (pragma);
1040
+ qWarning () << tr (" didn't receive any output from pragma %1" ).arg (pragma);
1042
1041
1043
1042
sqlite3_finalize (vm);
1044
1043
} else {
1045
- qWarning () << QObject:: tr (" could not execute pragma command: %1, %2" ).arg (err).arg (sqlite3_errmsg (_db));
1044
+ qWarning () << tr (" could not execute pragma command: %1, %2" ).arg (err).arg (sqlite3_errmsg (_db));
1046
1045
}
1047
1046
1048
1047
// Return it
@@ -1057,7 +1056,7 @@ bool DBBrowserDB::setPragma(const QString& pragma, const QString& value)
1057
1056
save ();
1058
1057
bool res = executeSQL (sql, false , true ); // PRAGMA statements are usually not transaction bound, so we can't revert
1059
1058
if ( !res )
1060
- qWarning () << QObject:: tr (" Error setting pragma %1 to %2: %3" ).arg (pragma).arg (value).arg (lastErrorMessage);
1059
+ qWarning () << tr (" Error setting pragma %1 to %2: %3" ).arg (pragma).arg (value).arg (lastErrorMessage);
1061
1060
return res;
1062
1061
}
1063
1062
@@ -1096,7 +1095,7 @@ bool DBBrowserDB::loadExtension(const QString& filename)
1096
1095
// Check if file exists
1097
1096
if (!QFile::exists (filename))
1098
1097
{
1099
- lastErrorMessage = QObject:: tr (" File not found." );
1098
+ lastErrorMessage = tr (" File not found." );
1100
1099
return false ;
1101
1100
}
1102
1101
0 commit comments