GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — show real insert data after insert a new row · feng2010java/sqlitebrowser@6705e8c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • sqlitetablemodel.cpp
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/sqlitetablemodel.cpp‎

Copy file name to clipboardExpand all lines: src/sqlitetablemodel.cpp
+18-5Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,27 @@ bool SqliteTableModel::insertRows(int row, int count, const QModelIndex& parent)
302302
for(int i=0; i < m_headers.size(); ++i)
303303
blank_data.push_back("");
304304

305-
for(int i=0; i < count; ++i)
305+
for(int i=row; i < row + count; ++i)
306306
{
307-
m_data.insert(row, blank_data);
308-
m_data[row].replace(0, QByteArray::number(m_db->addRecord(m_sTable)));
307+
int rowid = m_db->addRecord(m_sTable);
308+
if(rowid < 0)
309+
{
310+
endInsertRows();
311+
return false;
312+
}
313+
m_rowCount++;
314+
m_data.insert(i, blank_data);
315+
m_data[i].replace(0, QByteArray::number(rowid));
316+
317+
// update column with default values
318+
QByteArrayList rowdata;
319+
m_db->getRow(m_sTable, rowid, rowdata);
320+
for(int j=1; j < m_headers.size(); ++j)
321+
{
322+
m_data[i].replace(j, rowdata[j - 1]);
323+
}
309324
}
310325

311-
m_rowCount += count;
312-
313326
endInsertRows();
314327
return true;
315328
}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.