GNU bug report logs - #61151
30.0.50; sqlite-more-p is confusing

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Sun, 29 Jan 2023 14:53:02 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 61151 <at> debbugs.gnu.org (full text, mbox):

From: Helmut Eller <eller.helmut <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 61151 <at> debbugs.gnu.org
Subject: Re: bug#61151: 30.0.50; sqlite-more-p is confusing
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




This bug report was last modified 2 years and 112 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.