mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
Fix issue with inserting rows into single-column PK tables
After inserting an empty row into a table using the Browse Data tab, we
read the row back from the database to find out whether any (and which)
default values were inserted by SQLite. For tables with a single primary
key column the SQL statement for doing so was broken and failed every
time. So these values were only shown when refreshing the view.
This problem was introduced in a615c7b5a0.
See issue #1870.
This commit is contained in:
@@ -1201,7 +1201,7 @@ bool DBBrowserDB::getRow(const sqlb::ObjectIdentifier& table, const QString& row
|
||||
sqlb::StringVector pks = getObjectByName<sqlb::Table>(table)->rowidColumns();
|
||||
if(pks.size() == 1)
|
||||
{
|
||||
sQuery += QString("%1='%2;").arg(QString::fromStdString(sqlb::escapeIdentifier(pks.front()))).arg(rowid);
|
||||
sQuery += QString("%1='%2';").arg(QString::fromStdString(sqlb::escapeIdentifier(pks.front()))).arg(rowid);
|
||||
} else {
|
||||
sQuery += QString("sqlb_make_single_value(%1)='%2';")
|
||||
.arg(QString::fromStdString(sqlb::joinStringVector(sqlb::escapeIdentifier(pks), ",")))
|
||||
|
||||
Reference in New Issue
Block a user