]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix 'sqlite-mode-delete' with NULL field values
authorYue Yi <include_yy@qq.com>
Mon, 14 Jul 2025 05:57:19 +0000 (13:57 +0800)
committerEshel Yaron <me@eshelyaron.com>
Sat, 26 Jul 2025 15:23:18 +0000 (17:23 +0200)
* lisp/sqlite-mode.el (sqlite-mode-delete): Support NULL field
values (bug#79011).

(cherry picked from commit 9153f1f3bb5c86878bedc0be6f5a1cd60a0e88f4)

lisp/sqlite-mode.el

index a4b96b02b488a1c00ee1de2c6f2c20a8672cd487..82d5cc80a2cfe7a3cde6e282fe46faed3083da3d 100644 (file)
      (format "delete from \"%s\" where %s"
              (cdr table)
              (string-join
-              (mapcar (lambda (column)
-                        (format "\"%s\" = ?" (car (split-string column " "))))
-                      (cons "rowid" (sqlite-mode--column-names (cdr table))))
+              (cl-mapcar (lambda (column value)
+                           (format "\"%s\" %s ?"
+                                   (car (split-string column " "))
+                                   (if value "=" "is")))
+                         (cons "rowid" (sqlite-mode--column-names (cdr table)))
+                         row)
               " and "))
      row)
     (delete-region (line-beginning-position) (progn (forward-line 1) (point)))))