mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 19:11:39 -06:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user