From 0866e5edacb2355f5cf6d83f106961a870080fa6 Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 30 Jun 2024 12:51:05 +1200 Subject: [PATCH] sqliteclidriver: clear content from ret if sentinel was found --- sqliteclidriver/sqliteclidriver.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sqliteclidriver/sqliteclidriver.go b/sqliteclidriver/sqliteclidriver.go index 3adf550..1664a56 100644 --- a/sqliteclidriver/sqliteclidriver.go +++ b/sqliteclidriver/sqliteclidriver.go @@ -286,7 +286,13 @@ func (s *SCStmt) Query(args []driver.Value) (driver.Rows, error) { } } - if !wasSentinel { + if wasSentinel { + // There was no data. + // Wipe out `ret` + ret = nil + + } else { + // There was data. // Need to decode again (from the same decoder reader) until we find the sentinel surplus := []map[string]any{} err = decoder.Decode(&surplus)