Permalink
Browse files

Put full cell data into INSERT statements when dragging tables

In the Structure tab you can drag & drop entire tables. This copies the
CREATE statement of the table along with the INSERT statements for the
table data. However, for the table data we would use the data as shown
in the table view cells, i.e. 'NULL' for NULL values or truncated data
for very long strings. This is at least partly improved by this commit.
It doesn't treat NULL or BLOB values 100% correctly but fixes the
truncation problem and at least makes the issues in the other cases a
bit more obvious.
  • Loading branch information...
MKleusberg committed Jan 1, 2018
1 parent 106e57e commit 117af5aeeb146860f080584c82876f71ac227ff1
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/DbStructureModel.cpp
@@ -222,7 +222,7 @@ QMimeData* DbStructureModel::mimeData(const QModelIndexList& indices) const
{
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 += QString("'%1',").arg(tableModel.data(tableModel.index(i, j), Qt::EditRole).toString());
insertStatement.chop(1);
insertStatement += ");\n";
sqlData.append(insertStatement);

0 comments on commit 117af5a

Please sign in to comment.