Permalink
Browse files

Support drag and drop on tables with schema != "main"

This improves commit 44eb2d4 so that
drag and drop of data on temporary tables is supported as well.
  • Loading branch information...
MKleusberg committed Sep 3, 2017
1 parent 44eb2d4 commit fbaf78ea65bc8354d053192c90dece17ce7c8b5b
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/DbStructureModel.cpp
@@ -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);

0 comments on commit fbaf78e

Please sign in to comment.