Skip to content

Need to understand the behavior, rows.Next_() #134

Answered by sijms
Tracnac asked this question in Q&A
Discussion options

You must be logged in to vote

HI Yvan
getting rows using dataSet.Rows is not correct because dataSet.Rows is an internal buffer act like circular buffer
to explain it more clear
repeat your query as follow:
select rownum as num from all_objects where rownum <= 90
the result of:

for k, v := range rows.Rows {
	fmt.Println(k, v)
}

will be only 50 rows which is actually the value of prefetch rows
but the result of:

count := 0
for rows.Next_() { 
    count += 1
}
fmt.Println("Next count: ", count)

will be 90
thus Next will act like forward-only cursor that retrieve any number of rows and only allocation memory that you defined by "PREFETCH_ROWS" url parameter

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Tracnac
Comment options

Answer selected by Tracnac
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants