[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql c7a8ef0908 015/427: Rename every emacsql argument
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql c7a8ef0908 015/427: Rename every emacsql argument to conn. |
Date: |
Tue, 13 Dec 2022 02:59:23 -0500 (EST) |
branch: elpa/emacsql
commit c7a8ef0908bd0a304f19231ff1f36651e4ed3d58
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Rename every emacsql argument to conn.
---
emacsql.el | 106 ++++++++++++++++++++++++++++++-------------------------------
1 file changed, 53 insertions(+), 53 deletions(-)
diff --git a/emacsql.el b/emacsql.el
index b9778ea84f..ac200b7e08 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -88,30 +88,30 @@ buffer. This is for debugging purposes."
(setf (process-sentinel process) (lambda (_proc _) (kill-buffer buffer)))
(process-send-string process ".prompt #\n")
(process-send-string process ".mode line\n")
- (let ((emacsql (emacsql--create :process process :file file)))
+ (let ((conn (emacsql--create :process process :file file)))
(when log
- (setf (emacsql-log emacsql) (generate-new-buffer "*emacsql-log*")))
- (prog1 emacsql
- (push (cons (copy-seq emacsql) (emacsql--ref emacsql))
+ (setf (emacsql-log conn) (generate-new-buffer "*emacsql-log*")))
+ (prog1 conn
+ (push (cons (copy-seq conn) (emacsql--ref conn))
emacsql-connections)))))
-(defun emacsql-close (emacsql)
- "Close connection to EMACSQL database."
- (let ((process (emacsql-process emacsql)))
+(defun emacsql-close (conn)
+ "Close connection to CONN database."
+ (let ((process (emacsql-process conn)))
(when (and process (process-live-p process))
(process-send-string process ".exit\n"))))
-(defun emacsql-buffer (emacsql)
- "Get proccess buffer for EMACSQL."
- (process-buffer (emacsql-process emacsql)))
+(defun emacsql-buffer (conn)
+ "Get proccess buffer for CONN."
+ (process-buffer (emacsql-process conn)))
(defun emacsql-reap ()
"Clean up after lost connections."
- (cl-loop for (emacsql-copy . ref) in emacsql-connections
+ (cl-loop for (conn-copy . ref) in emacsql-connections
when (null (emacsql--deref ref))
count (prog1 t (ignore-errors (emacsql-close emacsql-copy)))
into total
- else collect (cons emacsql-copy ref) into connections
+ else collect (cons conn-copy ref) into connections
finally (progn
(setf emacsql-connections connections)
(return total))))
@@ -127,37 +127,37 @@ buffer. This is for debugging purposes."
(cancel-timer emacsql-reap-timer)
(setf emacsql-reap-timer nil)))
-(defun emacsql--log (emacsql &rest messages)
- (let ((log (emacsql-log emacsql)))
+(defun emacsql--log (conn &rest messages)
+ (let ((log (emacsql-log conn)))
(when log
(with-current-buffer log
(setf (point) (point-max))
(mapc (lambda (s) (princ s log)) messages)))))
-(defun emacsql--send (emacsql string)
- "Send STRING to EMACSQL, automatically appending newline."
- (let ((process (emacsql-process emacsql)))
- (emacsql--log emacsql string "\n")
+(defun emacsql--send (conn string)
+ "Send STRING to CONN, automatically appending newline."
+ (let ((process (emacsql-process conn)))
+ (emacsql--log conn string "\n")
(process-send-string process string)
(process-send-string process "\n")))
-(defun emacsql--clear (emacsql)
- "Clear the process buffer for EMACSQL."
- (with-current-buffer (emacsql-buffer emacsql)
+(defun emacsql--clear (conn)
+ "Clear the process buffer for CONN."
+ (with-current-buffer (emacsql-buffer conn)
(erase-buffer)))
-(defun emacsql--complete-p (emacsql)
+(defun emacsql--complete-p (conn)
"Return non-nil if receive buffer has finished filling."
- (with-current-buffer (emacsql-buffer emacsql)
+ (with-current-buffer (emacsql-buffer conn)
(cond ((= (buffer-size) 1) (string= "#" (buffer-string)))
((> (buffer-size) 1) (string= "\n#"
(buffer-substring
(- (point-max) 2) (point-max)))))))
-(defun emacsql--parse (emacsql &rest named)
+(defun emacsql--parse (conn &rest named)
"Parse a query result into an s-expression.
If NAMED is non-nil, don't include column names."
- (with-current-buffer (emacsql-buffer emacsql)
+ (with-current-buffer (emacsql-buffer conn)
(let ((standard-input (current-buffer)))
(setf (point) (point-min))
(cl-loop until (looking-at "#")
@@ -185,48 +185,48 @@ If NAMED is non-nil, don't include column names."
(format "'%s'" (replace-regexp-in-string "'" "''" string))
string)))
-(defun emacsql--check-error (emacsql)
+(defun emacsql--check-error (conn)
"Return non-nil or throw an appropriate error."
- (with-current-buffer (emacsql-buffer emacsql)
- (emacsql-wait emacsql)
+ (with-current-buffer (emacsql-buffer conn)
+ (emacsql-wait conn)
(setf (point) (point-min))
(prog1 t
(when (looking-at "Error:")
(error (buffer-substring (line-beginning-position)
(line-end-position)))))))
-(defun emacsql-wait (emacsql &optional timeout)
- "Block Emacs until EMACSQL has finished sending output."
- (while (not (emacsql--complete-p emacsql))
- (accept-process-output (emacsql-process emacsql))))
+(defun emacsql-wait (conn &optional timeout)
+ "Block Emacs until CONN has finished sending output."
+ (while (not (emacsql--complete-p conn))
+ (accept-process-output (emacsql-process conn))))
-(defmacro emacsql-with-errors (emacsql &rest body)
+(defmacro emacsql-with-errors (conn &rest body)
"Run BODY checking for errors from SQLite after completion."
(declare (indent 1))
`(progn
- (emacsql--clear ,emacsql)
+ (emacsql--clear ,conn)
,@body
- (emacsql--check-error ,emacsql)))
+ (emacsql--check-error ,conn)))
-(defun emacsql-create (emacsql table spec &optional if-not-exists)
- "Create TABLE in EMACSQL with SPEC."
- (emacsql-with-errors emacsql
+(defun emacsql-create (conn table spec &optional if-not-exists)
+ "Create TABLE in CONN with SPEC."
+ (emacsql-with-errors conn
(cl-loop for column in spec
when (consp column)
collect (mapconcat #'emacsql-escape column " ")
into parts
else collect (format "%s" column) into parts
finally (emacsql--send
- emacsql
+ conn
(format "CREATE TABLE %s%s(%s);"
(if if-not-exists "IF NOT EXISTS " "")
(emacsql-escape table)
(mapconcat #'identity parts ", "))))))
-(defun emacsql-drop (emacsql table)
- "Drop TABLE from EMACSQL."
- (emacsql-with-errors emacsql
- (emacsql--send emacsql (format "DROP TABLE %s;" (emacsql-escape table)))))
+(defun emacsql-drop (conn table)
+ "Drop TABLE from CONN."
+ (emacsql-with-errors conn
+ (emacsql--send conn (format "DROP TABLE %s;" (emacsql-escape table)))))
(defun emacsql-escape-value (value)
"Escape VALUE for sending to SQLite."
@@ -235,26 +235,26 @@ If NAMED is non-nil, don't include column names."
(prin1-to-string value)
(emacsql-escape (prin1-to-string value) t))))
-(defun emacsql-insert (emacsql table &rest rows)
+(defun emacsql-insert (conn table &rest rows)
"Insert ROWS into TABLE.
Each row must be a sequence of values to store into TABLE.
(emacsql-insert db :table '(\"Chris\" 0) [\"Jeff\" 1])"
- (emacsql-with-errors emacsql
+ (emacsql-with-errors conn
(emacsql--send
- emacsql
+ conn
(format "INSERT INTO %s VALUES (%s);" (emacsql-escape table)
(mapconcat (lambda (row)
(mapconcat #'emacsql-escape-value row ", "))
rows "), (")))))
-(defun emacsql-select-raw (emacsql query)
- "Send a raw QUERY string to EMACSQL."
- (emacsql--clear emacsql)
- (emacsql--send emacsql query)
- (emacsql-wait emacsql)
- (emacsql--check-error emacsql)
- (emacsql--parse emacsql))
+(defun emacsql-select-raw (conn query)
+ "Send a raw QUERY string to CONN."
+ (emacsql--clear conn)
+ (emacsql--send conn query)
+ (emacsql-wait conn)
+ (emacsql--check-error conn)
+ (emacsql--parse conn))
(provide 'emacsql)
- [nongnu] elpa/emacsql f8d9511d1d 025/427: Tweak README limitations paragraph., (continued)
- [nongnu] elpa/emacsql f8d9511d1d 025/427: Tweak README limitations paragraph., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 2f0a9457a4 029/427: Drop non-idiomatic :else., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4f6b524b9f 026/427: Rename spec to schema., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 208885e264 031/427: Add testing to schema handling., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql abe43b3381 043/427: Add :where test., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4a89bfaf44 044/427: Use a macro to greatly simplify expanders., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql eb10ddcdba 004/427: Error-free reaping since it's automatic., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a6dbb52a3c 009/427: Add flatten option., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 2053a15b21 010/427: Add Emacs requirement note., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 961c689269 011/427: Rename information to constraints., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c7a8ef0908 015/427: Rename every emacsql argument to conn.,
ELPA Syncer <=
- [nongnu] elpa/emacsql d083cbb70e 017/427: Add in-memory database support., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 9091fe8df5 019/427: Rename sqlite-program-name into namespace., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 9c3293c57e 020/427: Add a docstring to emacsql struct., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 178a31d5ca 024/427: Lock in the coding system., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 85076dfe0f 027/427: Flesh out example more., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql c9854331c0 028/427: Add (un)license header., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 896bb7ce52 035/427: Start adding SQL expanders., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 9272d13ace 036/427: Add some tests for the expanders., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3511a0df1d 037/427: Add a top-level query function, emacsql., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 7e18a43da1 039/427: Add a template example., ELPA Syncer, 2022/12/13