mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Support drag and drop on tables with schema != "main"
This improves commit 44eb2d4f99 so that
drag and drop of data on temporary tables is supported as well.
This commit is contained in:
@@ -183,11 +183,12 @@ QMimeData* DbStructureModel::mimeData(const QModelIndexList& indices) const
|
||||
if(data(index.sibling(index.row(), ColumnObjectType), Qt::DisplayRole).toString() == "table")
|
||||
{
|
||||
SqliteTableModel tableModel(m_db);
|
||||
tableModel.setTable(sqlb::ObjectIdentifier(data(index.sibling(index.row(), ColumnSchema), Qt::DisplayRole).toString(),
|
||||
data(index.sibling(index.row(), ColumnName), Qt::DisplayRole).toString()));
|
||||
sqlb::ObjectIdentifier objid(data(index.sibling(index.row(), ColumnSchema), Qt::DisplayRole).toString(),
|
||||
data(index.sibling(index.row(), ColumnName), Qt::DisplayRole).toString());
|
||||
tableModel.setTable(objid);
|
||||
for(int i=0; i < tableModel.rowCount(); ++i)
|
||||
{
|
||||
QString insertStatement = "INSERT INTO " + sqlb::escapeIdentifier(data(index.sibling(index.row(), ColumnName), Qt::DisplayRole).toString()) + " VALUES(";
|
||||
QString insertStatement = "INSERT INTO " + objid.toString() + " VALUES(";
|
||||
for(int j=1; j < tableModel.columnCount(); ++j)
|
||||
insertStatement += QString("'%1',").arg(tableModel.data(tableModel.index(i, j)).toString());
|
||||
insertStatement.chop(1);
|
||||
|
||||
Reference in New Issue
Block a user