mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-21 03:21:43 -06:00
dbbrowserdb: Correctly identify NULL values when returning row
Commit 9e4a6df changed the way fetchData() handles NULL values
so they could be seen by the user. However, the same change wasn't
added to DBBrowserDB::getRow().
Because both are called by the table model and we now add colors
to NULL fields, this caused a visible bug when adding a row with
not null column constraints.
See issue #214.
This commit is contained in:
@@ -586,7 +586,18 @@ bool DBBrowserDB::getRow(const QString& sTableName, int64_t rowid, QList<QByteAr
|
||||
while(sqlite3_step(stmt) == SQLITE_ROW)
|
||||
{
|
||||
for (int i = 0; i < sqlite3_column_count(stmt); ++i)
|
||||
rowdata.append(QByteArray(static_cast<const char*>(sqlite3_column_blob(stmt, i)), sqlite3_column_bytes(stmt, i)));
|
||||
{
|
||||
if(sqlite3_column_type(stmt, i) == SQLITE_NULL)
|
||||
{
|
||||
rowdata.append(QByteArray());
|
||||
} else {
|
||||
int bytes = sqlite3_column_bytes(stmt, i);
|
||||
if(bytes)
|
||||
rowdata.append(QByteArray(static_cast<const char*>(sqlite3_column_blob(stmt, i)), bytes));
|
||||
else
|
||||
rowdata.append(QByteArray(""));
|
||||
}
|
||||
}
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user