   "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.

         (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*")))
      (prog1 conn
        (emacsql--flush conn)
        (push (cons (copy-sequence conn) (emacsql--ref conn))
              emacsql-connections)))))


(defun emacsql--check-error (conn)
  "Return non-nil or throw an appropriate error."
  (with-current-buffer (emacsql-buffer conn)
    (emacsql--wait conn)
    (setf (point) (point-min))
    (prog1 t
      (when (looking-at "Error:")
