Codebase list emacsql-sqlite3 / 1e411fd
New variable to custom sqlite3 executable (#10) (#11) * emacsql-sqlite3.el(emacsql-sqlite3-executable): New Zhu Zihao authored 3 years ago GitHub committed 3 years ago
1 changed file(s) with 18 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
104104 "List of all of SQLite's reserved words.
105105 https://www.sqlite.org/lang_keywords.html")
106106
107 (defgroup emacsql-sqlite3 ()
108 "EmacsSQL, sqlite3 backend."
109 :group 'comm)
110
111 (defcustom emacsql-sqlite3-executable (executable-find "sqlite3")
112 "The path to sqlite3 executable should be used."
113 :group 'emacsql-sqlite3
114 :type 'file)
115
107116 (defclass emacsql-sqlite3-connection (emacsql-connection)
108117 ((file :initarg :file
109118 :type (or null string)
147156 ;; Some class don't call superclass's constructor!
148157 (cl-defmethod initialize-instance :after
149158 ((conn emacsql-sqlite3-connection) _slots)
150 (cl-assert (executable-find "sqlite3") nil
159 (cl-assert emacsql-sqlite3-executable nil
151160 "Cannot find executable \"sqlite3\"!")
152161 (let* ((file (oref conn file))
153162 (fullfile (if file (list (expand-file-name file))))
154163 (proc (make-process
155164 :name "emacsql-sqlite3"
156 :command `("sqlite3" "--batch"
157 ;; Use space as separator,
158 ;; which is convenient for `read'.
159 "--list" "--separator" " "
160 ;; Obviously
161 "--nullvalue" "nil"
162 ,@fullfile)
165 :command `(,emacsql-sqlite3-executable
166 "--batch"
167 ;; Use space as separator,
168 ;; which is convenient for `read'.
169 "--list" "--separator" " "
170 ;; Obviously
171 "--nullvalue" "nil"
172 ,@fullfile)
163173 :buffer (generate-new-buffer " *emacsql sqlite*")
164174 :noquery t
165175 :connection-type 'pipe