mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 19:11:39 -06:00
Fix logic issues in name composition for drag & drop
Some combinations of options and dropped name weren't working as expected
with f33943f4cf
See related issue #1433
This commit is contained in:
@@ -214,7 +214,9 @@ QMimeData* DbStructureModel::mimeData(const QModelIndexList& indices) const
|
||||
// For names, export a (qualified) (escaped) identifier of the item for statement composition in SQL editor.
|
||||
if(objectType == "field")
|
||||
namesData.append(getNameForDropping(item->text(ColumnSchema), item->parent()->text(ColumnName), item->text(ColumnName)));
|
||||
else if(objectType != "")
|
||||
else if(objectType == "database")
|
||||
namesData.append(getNameForDropping(item->text(ColumnName), "", ""));
|
||||
else if(!objectType.isEmpty())
|
||||
namesData.append(getNameForDropping(item->text(ColumnSchema), item->text(ColumnName), ""));
|
||||
|
||||
if(objectType != "field" && index.column() == ColumnSQL)
|
||||
@@ -380,12 +382,11 @@ QString DbStructureModel::getNameForDropping(const QString& domain, const QStrin
|
||||
// database and a table, and drag and drop them to get "schema1"."table1".) Note that this only makes
|
||||
// sense when the "Drop Qualified Names" option is not set.
|
||||
QString name;
|
||||
if (m_dropQualifiedNames) {
|
||||
if (domain != "main")
|
||||
name = m_dropEnquotedNames ? sqlb::escapeIdentifier(domain) + "." : domain + ".";
|
||||
if ((domain != "main" && m_dropQualifiedNames) || object.isEmpty())
|
||||
name = m_dropEnquotedNames ? sqlb::escapeIdentifier(domain) + "." : domain + ".";
|
||||
|
||||
if (!object.isEmpty() && (m_dropQualifiedNames || field.isEmpty()))
|
||||
name += m_dropEnquotedNames ? sqlb::escapeIdentifier(object) + "." : object + ".";
|
||||
}
|
||||
|
||||
if (!field.isEmpty())
|
||||
name += m_dropEnquotedNames ? sqlb::escapeIdentifier(field) + ", " : field + ", ";
|
||||
|
||||
Reference in New Issue
Block a user