mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-21 03:21:43 -06:00
show real insert data after insert a new row
After the insert statement the inserted row will be fetched and shown in the browse table.
This commit is contained in:
@@ -302,13 +302,26 @@ bool SqliteTableModel::insertRows(int row, int count, const QModelIndex& parent)
|
||||
for(int i=0; i < m_headers.size(); ++i)
|
||||
blank_data.push_back("");
|
||||
|
||||
for(int i=0; i < count; ++i)
|
||||
for(int i=row; i < row + count; ++i)
|
||||
{
|
||||
m_data.insert(row, blank_data);
|
||||
m_data[row].replace(0, QByteArray::number(m_db->addRecord(m_sTable)));
|
||||
}
|
||||
int rowid = m_db->addRecord(m_sTable);
|
||||
if(rowid < 0)
|
||||
{
|
||||
endInsertRows();
|
||||
return false;
|
||||
}
|
||||
m_rowCount++;
|
||||
m_data.insert(i, blank_data);
|
||||
m_data[i].replace(0, QByteArray::number(rowid));
|
||||
|
||||
m_rowCount += count;
|
||||
// update column with default values
|
||||
QByteArrayList rowdata;
|
||||
m_db->getRow(m_sTable, rowid, rowdata);
|
||||
for(int j=1; j < m_headers.size(); ++j)
|
||||
{
|
||||
m_data[i].replace(j, rowdata[j - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
endInsertRows();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user