Skip to content

Commit eb32a73

Browse files
committed
downgrade range iterators usage
1 parent 2ee81ab commit eb32a73

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

tests/integration/basic_example_query_test.go

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ package integration
55

66
import (
77
"context"
8+
"errors"
9+
"io"
810
"net/http"
911
"os"
1012
"path"
@@ -312,20 +314,20 @@ func TestBasicExampleQuery(sourceTest *testing.T) { //nolint:gocyclo
312314
t.Run("lookup", func(t *testing.T) {
313315
t.Run("views", func(t *testing.T) {
314316
row, err := db.Query().QueryRow(ctx, `
315-
PRAGMA TablePathPrefix("`+path.Join(db.Name(), folder)+`");
317+
PRAGMA TablePathPrefix("`+path.Join(db.Name(), folder)+`");
316318
317-
DECLARE $seriesID AS Uint64;
318-
DECLARE $seasonID AS Uint64;
319-
DECLARE $episodeID AS Uint64;
319+
DECLARE $seriesID AS Uint64;
320+
DECLARE $seasonID AS Uint64;
321+
DECLARE $episodeID AS Uint64;
320322
321-
SELECT
322-
views
323-
FROM
324-
episodes
325-
WHERE
326-
series_id = $seriesID AND
327-
season_id = $seasonID AND
328-
episode_id = $episodeID;`,
323+
SELECT
324+
views
325+
FROM
326+
episodes
327+
WHERE
328+
series_id = $seriesID AND
329+
season_id = $seasonID AND
330+
episode_id = $episodeID;`,
329331
query.WithParameters(ydb.ParamsBuilder().
330332
Param("$seriesID").Uint64(1).
331333
Param("$seasonID").Uint64(1).
@@ -409,12 +411,22 @@ func TestBasicExampleQuery(sourceTest *testing.T) { //nolint:gocyclo
409411
_ = res.Close(ctx)
410412
}()
411413
t.Logf("> scan_query_select:\n")
412-
for rs, err := range res.ResultSets(ctx) {
414+
for {
415+
rs, err := res.NextResultSet(ctx)
413416
if err != nil {
417+
if errors.Is(err, io.EOF) {
418+
break
419+
}
420+
414421
return err
415422
}
416-
for row, err := range rs.Rows(ctx) {
423+
for {
424+
row, err := rs.NextRow(ctx)
417425
if err != nil {
426+
if errors.Is(err, io.EOF) {
427+
break
428+
}
429+
418430
return err
419431
}
420432
var v struct {

0 commit comments

Comments
 (0)