Skip to content

Commit

Permalink
refactor: check for inserted rows logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgerojas26 committed Jan 22, 2025
1 parent b19278b commit f63c5f8
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions components/results_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -1375,20 +1375,21 @@ func (table *ResultsTable) UpdateSidebar() {

func (table *ResultsTable) isAnInsertedRow(rowIndex int) (isAnInsertedRow bool, DBChangeIndex int) {
for i, dmlChange := range *table.state.listOfDBChanges {
values := dmlChange.Values

for _, value := range values {
if value.TableRowIndex == rowIndex {
cellReference := table.GetCell(rowIndex, 0).GetReference()

isAnInsertedRow := cellReference != nil && cellReference.(string) != "NULL&" && cellReference.(string) != "EMPTY&" && cellReference.(string) != "DEFAULT&"

if isAnInsertedRow {
return true, i
}
for _, value := range dmlChange.Values {
if value.TableRowIndex != rowIndex {
continue
}
cellReference := table.GetCell(rowIndex, 0).GetReference()
if cellReference == nil {
break
}
switch cellReference.(string) {
case "NULL&", "EMPTY&", "DEFAULT&":
default:
return true, i
}
break
}

}
return false, -1
}
Expand Down

0 comments on commit f63c5f8

Please sign in to comment.