aboutsummaryrefslogtreecommitdiffstats
path: root/src/sqlite.c
diff options
context:
space:
mode:
authorStefan Kangas2023-02-03 06:30:24 +0100
committerStefan Kangas2023-02-03 06:30:24 +0100
commitac7ec87a7a0db887e4ae7fe9005aea517958b778 (patch)
treec6f9cc435f6389e368fdf2af5c0e7fd9b7c5a729 /src/sqlite.c
parentbfd338aad9d1e6bf898fc19d23e1a5ca4e696316 (diff)
parent96ea27278b43ae5ea72643881015944a819f7974 (diff)
downloademacs-ac7ec87a7a0db887e4ae7fe9005aea517958b778.tar.gz
emacs-ac7ec87a7a0db887e4ae7fe9005aea517958b778.zip
Merge from origin/emacs-29
96ea27278b4 ; Fix c-ts-mode indent test d963a8f1355 Make c-ts-mode indent tests side-effect-free 8a6bdf88b4b Call treesit_record_change in insert_from_gap_1 a2b77c79dcc Use c-ts-common-statement-offset for closing brackets too 74e715cb729 ; Go back to original point when filling comments in c-ts... b8009bbf2d8 ; Fix error where we pass t to treesit-node-type in c-ts-... 88ccf78b206 ; * src/treesit.c (treesit_predicate_match): Simplify las... 20454128b8b Minor improvements in sqlite.c 3b3c47d977b (treesit_predicate_match): Match node text against regexp... e8334781c9f Improve documentation of gdb-mi's dedicated windows c4988840598 Avoid spurious pause in kill-ring-save (Bug#60841) 382ab516cef Change the default of 'treesit-defun-tactic' for 'c-ts-mode' 4d3428e95a9 Fix docstring fontification of CL's 'defstruct' 1c125baa3f0 Teach 'hs-minor-mode' about tree-sitter based modes 2de0ab5cbd3 ; Doc fixes in keymap.el c6660a6d6de Improve documentation of 'repeat-mode' and related variables be304bb3286 ; * etc/NEWS: Mention the 'utf-8-auto' bugfix (bug#60750). # Conflicts: # etc/NEWS
Diffstat (limited to 'src/sqlite.c')
-rw-r--r--src/sqlite.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/sqlite.c b/src/sqlite.c
index c96841e63f9..0361514766a 100644
--- a/src/sqlite.c
+++ b/src/sqlite.c
@@ -399,7 +399,7 @@ row_to_value (sqlite3_stmt *stmt)
399 int len = sqlite3_column_count (stmt); 399 int len = sqlite3_column_count (stmt);
400 Lisp_Object values = Qnil; 400 Lisp_Object values = Qnil;
401 401
402 for (int i = 0; i < len; ++i) 402 for (int i = len - 1; i >= 0; i--)
403 { 403 {
404 Lisp_Object v = Qnil; 404 Lisp_Object v = Qnil;
405 405
@@ -434,7 +434,7 @@ row_to_value (sqlite3_stmt *stmt)
434 values = Fcons (v, values); 434 values = Fcons (v, values);
435 } 435 }
436 436
437 return Fnreverse (values); 437 return values;
438} 438}
439 439
440static Lisp_Object 440static Lisp_Object
@@ -718,11 +718,15 @@ Only modules on Emacs' list of allowed modules can be loaded. */)
718#endif /* HAVE_SQLITE3_LOAD_EXTENSION */ 718#endif /* HAVE_SQLITE3_LOAD_EXTENSION */
719 719
720DEFUN ("sqlite-next", Fsqlite_next, Ssqlite_next, 1, 1, 0, 720DEFUN ("sqlite-next", Fsqlite_next, Ssqlite_next, 1, 1, 0,
721 doc: /* Return the next result set from SET. */) 721 doc: /* Return the next result set from SET.
722Return nil when the statement has finished executing successfully. */)
722 (Lisp_Object set) 723 (Lisp_Object set)
723{ 724{
724 check_sqlite (set, true); 725 check_sqlite (set, true);
725 726
727 if (XSQLITE (set)->eof)
728 return Qnil;
729
726 int ret = sqlite3_step (XSQLITE (set)->stmt); 730 int ret = sqlite3_step (XSQLITE (set)->stmt);
727 if (ret != SQLITE_ROW && ret != SQLITE_OK && ret != SQLITE_DONE) 731 if (ret != SQLITE_ROW && ret != SQLITE_OK && ret != SQLITE_DONE)
728 xsignal1 (Qsqlite_error, build_string (sqlite3_errmsg (XSQLITE (set)->db))); 732 xsignal1 (Qsqlite_error, build_string (sqlite3_errmsg (XSQLITE (set)->db)));