Subject: bug#61151: 30.0.50; sqlite-more-p is confusing

From: Helmut Eller <[email-masked]>
Date: Sun, 29 Jan 2023 17:05:07 +0100

On Sun, Jan 29 2023, Eli Zaretskii wrote:

> I'm not sure I understand why you need sqlite-more-p here.
> sqlite-next returns nil when it hits the end, so it should be enough.
> If we document this fact in the doc string of sqlite-next, would that
> be good enough to satisfy your use cases?

Yes, I guess it would be possible to get rid of sqlite-more-p.

However, sqlite-next seems to return nil once, but then it starts over.
E.g this

  (let* ((db (sqlite-open))
         (stmt (sqlite-select db "values ('a',0), ('b',1)" nil 'set))
         (rows '()))
    (list
     (sqlite-next stmt)
     (sqlite-next stmt)
     (sqlite-next stmt)
     (sqlite-next stmt)))
   
returns: (("a" 0) ("b" 1) nil ("a" 0))

This "wrap around" behavior is strange.

In summary, I think that sqlite-next should signal and error instead of
returning nil.  And sqlite-more-p should be used to detect the end of
the stream.  (Theoretically, sqlite-next could then also return zero
length rows, though that's probably not needed in practice.)

Helmut