@@ -214,7 +214,9 @@ QMimeData* DbStructureModel::mimeData(const QModelIndexList& indices) const
214214 // For names, export a (qualified) (escaped) identifier of the item for statement composition in SQL editor.
215215 if (objectType == " field" )
216216 namesData.append (getNameForDropping (item->text (ColumnSchema), item->parent ()->text (ColumnName), item->text (ColumnName)));
217- else if (objectType != " " )
217+ else if (objectType == " database" )
218+ namesData.append (getNameForDropping (item->text (ColumnName), " " , " " ));
219+ else if (!objectType.isEmpty ())
218220 namesData.append (getNameForDropping (item->text (ColumnSchema), item->text (ColumnName), " " ));
219221
220222 if (objectType != " field" && index.column () == ColumnSQL)
@@ -380,12 +382,11 @@ QString DbStructureModel::getNameForDropping(const QString& domain, const QStrin
380382 // database and a table, and drag and drop them to get "schema1"."table1".) Note that this only makes
381383 // sense when the "Drop Qualified Names" option is not set.
382384 QString name;
383- if (m_dropQualifiedNames) {
384- if (domain != " main" )
385- name = m_dropEnquotedNames ? sqlb::escapeIdentifier (domain) + " ." : domain + " ." ;
385+ if ((domain != " main" && m_dropQualifiedNames) || object.isEmpty ())
386+ name = m_dropEnquotedNames ? sqlb::escapeIdentifier (domain) + " ." : domain + " ." ;
386387
388+ if (!object.isEmpty () && (m_dropQualifiedNames || field.isEmpty ()))
387389 name += m_dropEnquotedNames ? sqlb::escapeIdentifier (object) + " ." : object + " ." ;
388- }
389390
390391 if (!field.isEmpty ())
391392 name += m_dropEnquotedNames ? sqlb::escapeIdentifier (field) + " , " : field + " , " ;
0 commit comments