mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
Check for pseudo-PKs when determining whether the model is editable
This commit is contained in:
@@ -948,6 +948,8 @@ QString DBBrowserDB::addRecord(const sqlb::ObjectIdentifier& tablename)
|
||||
if (!isOpen()) return QString();
|
||||
|
||||
sqlb::TablePtr table = getObjectByName(tablename).dynamicCast<sqlb::Table>();
|
||||
if(!table)
|
||||
return QString();
|
||||
|
||||
// For tables without rowid we have to set the primary key by ourselves. We do so by querying for the largest value in the PK column
|
||||
// and adding one to it.
|
||||
|
||||
@@ -938,7 +938,7 @@ void SqliteTableModel::setPseudoPk(const QString& pseudoPk)
|
||||
|
||||
bool SqliteTableModel::isEditable() const
|
||||
{
|
||||
return !m_sTable.isEmpty() && m_db.getObjectByName(m_sTable)->type() == sqlb::Object::Types::Table;
|
||||
return !m_sTable.isEmpty() && (m_db.getObjectByName(m_sTable)->type() == sqlb::Object::Types::Table || !m_pseudoPk.isEmpty());
|
||||
}
|
||||
|
||||
void SqliteTableModel::waitForFetchingFinished()
|
||||
|
||||
Reference in New Issue
Block a user