[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 72b1007987: (sqlite-mode--column-names): Suppport nested parens
From: |
Lars Ingebrigtsen |
Subject: |
master 72b1007987: (sqlite-mode--column-names): Suppport nested parens |
Date: |
Wed, 11 May 2022 08:06:41 -0400 (EDT) |
branch: master
commit 72b100798743685e87f336a8dffa97ee149eeefe
Author: Yoav Marco <yoavm448@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
(sqlite-mode--column-names): Suppport nested parens
* lisp/sqlite-mode.el (sqlite-mode--column-names): Make parsing
more resilient (bug#55363).
Copyright-paperwork-exempt: yes
---
lisp/sqlite-mode.el | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el
index ba1b81ef7e..66e2e487d9 100644
--- a/lisp/sqlite-mode.el
+++ b/lisp/sqlite-mode.el
@@ -129,15 +129,23 @@
(insert (format " %s\n" column))))))))
(defun sqlite-mode--column-names (table)
+ "Return a list of the column names for TABLE."
(let ((sql
(caar
(sqlite-select
sqlite--db
"select sql from sqlite_master where tbl_name = ? AND type =
'table'"
(list table)))))
- (mapcar
- #'string-trim
- (split-string (replace-regexp-in-string "^.*(\\|)$" "" sql) ","))))
+ (with-temp-buffer
+ (insert sql)
+ (mapcar #'string-trim
+ (split-string
+ ;; Extract the args to CREATE TABLE. Point is
+ ;; currently at its end.
+ (buffer-substring
+ (1- (point)) ; right before )
+ (1+ (progn (backward-sexp) (point)))) ; right after (
+ ",")))))
(defun sqlite-mode-list-data ()
"List the data from the table under point."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 72b1007987: (sqlite-mode--column-names): Suppport nested parens,
Lars Ingebrigtsen <=