Skip to content

Commit

Permalink
Support drag and drop on tables with schema != "main"
Browse files Browse the repository at this point in the history
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 fbaf78e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/DbStructureModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fbaf78e

Please sign in to comment.