Skip to content

Commit 117af5a

Browse files
committed
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.
1 parent 106e57e commit 117af5a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/DbStructureModel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ QMimeData* DbStructureModel::mimeData(const QModelIndexList& indices) const
222222
{
223223
QString insertStatement = "INSERT INTO " + objid.toString() + " VALUES(";
224224
for(int j=1; j < tableModel.columnCount(); ++j)
225-
insertStatement += QString("'%1',").arg(tableModel.data(tableModel.index(i, j)).toString());
225+
insertStatement += QString("'%1',").arg(tableModel.data(tableModel.index(i, j), Qt::EditRole).toString());
226226
insertStatement.chop(1);
227227
insertStatement += ");\n";
228228
sqlData.append(insertStatement);

0 commit comments

Comments
 (0)