[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql bb221f6134 161/427: Drop .print command flushing.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql bb221f6134 161/427: Drop .print command flushing. |
Date: |
Tue, 13 Dec 2022 02:59:38 -0500 (EST) |
branch: elpa/emacsql
commit bb221f61341cd67f011319471a25f690efe9b728
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Drop .print command flushing.
---
emacsql.el | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)
diff --git a/emacsql.el b/emacsql.el
index 1fd1ec00d1..f89546ee36 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -180,14 +180,6 @@ This collection exists for cleanup purposes.")
"Retrieve value from REF."
(gethash t ref))
-(defun emacsql--flush (conn)
- "Flush (and toss) any waiting output from CONN."
- (emacsql--send conn ";\n.print EMACSQL")
- (with-current-buffer (emacsql-buffer conn)
- (cl-loop until (string-match-p "EMACSQL\n]" (buffer-string))
- do (accept-process-output)))
- (emacsql--clear conn))
-
(cl-defun emacsql-connect (file &key debug)
"Open a connected to database stored in FILE.
If FILE is nil use an in-memory database.
@@ -200,15 +192,17 @@ buffer. This is for debugging purposes."
(process (start-process "emacsql" buffer emacsql-sqlite3-executable
"-interactive" fullfile)))
(setf (process-sentinel process) (lambda (_proc _) (kill-buffer buffer)))
- (process-send-string process ".prompt ]\n")
(process-send-string process ".mode list\n")
(process-send-string process ".separator ' '\n")
(process-send-string process ".nullvalue nil\n")
- (let ((conn (emacsql--create :process process :file (when file fullfile))))
- (when debug
- (setf (emacsql-log conn) (generate-new-buffer "*emacsql-log*")))
+ (process-send-string process ".prompt ]\n")
+ (process-send-string process "EMACSQL;\n") ;; force error message
+ (let ((conn (emacsql--create
+ :process process
+ :file (when file fullfile)
+ :log (when debug (generate-new-buffer "*emacsql-log*")))))
(prog1 conn
- (emacsql--flush conn)
+ (emacsql--wait conn)
(push (cons (copy-sequence conn) (emacsql--ref conn))
emacsql-connections)))))
@@ -311,7 +305,7 @@ A statement can be a list, containing a statement with its
arguments."
(defun emacsql--check-error (conn)
"Return non-nil or throw an appropriate error."
(with-current-buffer (emacsql-buffer conn)
- (emacsql-wait conn)
+ (emacsql--wait conn)
(setf (point) (point-min))
(prog1 t
(when (looking-at "Error:")
@@ -320,6 +314,13 @@ A statement can be a list, containing a statement with its
arguments."
(condition (emacsql-get-condition message)))
(signal condition (list message)))))))
+(defun emacsql--wait (conn &optional timeout)
+ "Block Emacs until CONN has finished sending output."
+ (let ((end (when timeout (+ (float-time) timeout))))
+ (while (and (or (null timeout) (< (float-time) end))
+ (not (emacsql--complete-p conn)))
+ (accept-process-output (emacsql-process conn) timeout))))
+
;;; Escaping:
(defun emacsql-quote (string)
@@ -340,13 +341,6 @@ A statement can be a list, containing a statement with its
arguments."
(replace-regexp-in-string ":" "." string)
string)))
-(defun emacsql-wait (conn &optional timeout)
- "Block Emacs until CONN has finished sending output."
- (let ((end (when timeout (+ (float-time) timeout))))
- (while (and (or (null timeout) (< (float-time) end))
- (not (emacsql--complete-p conn)))
- (accept-process-output (emacsql-process conn) timeout))))
-
(defun emacsql-escape-value (value)
"Escape VALUE for sending to SQLite."
(let ((print-escape-newlines t))
- [nongnu] elpa/emacsql add06c47b9 117/427: Bring back :into for :replace (oops!)., (continued)
- [nongnu] elpa/emacsql add06c47b9 117/427: Bring back :into for :replace (oops!)., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql d7a05db54e 080/427: Add :replace expander., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 0f0840ffbf 128/427: Add :default column constraint., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql bbe3031a50 130/427: Add table constraints., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 53b2e98515 131/427: Fill out README for new schema table constraints., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 364c3cacb6 133/427: More advanced :from sources, again., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 99a8069389 135/427: Add support for foreign keys., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql e6ab07e16b 140/427: Switch to a friendlier name., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql bec6af6940 148/427: Add VACUUM., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 03aebdecd1 160/427: Rename :log option to :debug., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql bb221f6134 161/427: Drop .print command flushing.,
ELPA Syncer <=
- [nongnu] elpa/emacsql 72b34f6522 173/427: Add some more autoloading., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3229cd41af 180/427: Change the requirements for front-end implementations., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 431a3b325f 200/427: Toss "reap" and switch to new finalize with Cask., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ed86b098ce 197/427: Add prefix arg to emacsql-show-last-sql., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 027c5df94e 209/427: Organize all the keywords in the README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1ebbc22411 212/427: Disable undo in process buffers., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 5bef799b6b 220/427: Make some tweaks to accommodate Windows., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 0cb9e47d24 227/427: Test all available backends., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 730e4d882a 235/427: Fix up the README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4b45472ffa 240/427: Don't copy the binary every time., ELPA Syncer, 2022/12/13