mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-02-10 05:38:32 -06:00
Some more optimisations in SqliteTableModel
This improves the performance of a couple of often called functions in SqliteTableModel some more.
This commit is contained in:
@@ -213,7 +213,7 @@ void AddRecordDialog::populateFields()
|
||||
|
||||
tbitem->setText(kName, QString::fromStdString(f.name()));
|
||||
tbitem->setText(kType, QString::fromStdString(f.type()));
|
||||
tbitem->setData(kType, Qt::UserRole, QString::fromStdString(f.affinity()));
|
||||
tbitem->setData(kType, Qt::UserRole, f.affinity());
|
||||
|
||||
// NOT NULL fields are indicated in bold.
|
||||
if (f.notnull()) {
|
||||
@@ -303,7 +303,7 @@ void AddRecordDialog::updateSqlText()
|
||||
fields << sqlb::escapeIdentifier(item->text(kName));
|
||||
value.toDouble(&isNumeric);
|
||||
// If it has a numeric format and has no text affinity, do not quote it.
|
||||
if (isNumeric && item->data(kType, Qt::UserRole).toString() != "TEXT")
|
||||
if (isNumeric && item->data(kType, Qt::UserRole).toInt() != sqlb::Field::TextAffinity)
|
||||
vals << value.toString();
|
||||
else
|
||||
vals << QString("'%1'").arg(value.toString().replace("'", "''"));
|
||||
|
||||
Reference in New Issue
Block a user