 
 (defvar emacsql-sqlite3-executable "sqlite3"
   "Path to the sqlite3 executable.")
-
-(cl-defstruct (emacsql (:constructor emacsql--create))
-  "A connection to a SQLite database."
-  process file log)
-
-(defvar emacsql-connections ()
-  "Collection of all known emacsql connections.
-This collection exists for cleanup purposes.")
-
-(defvar emacsql-reap-timer nil
-  "Timer used to check for dead emacsql connections.")
-
-(defun emacsql--ref (thing)
-  "Create a weak reference to THING."
-  (let ((ref (make-hash-table :test 'eq :size 1 :weakness 'value)))
-    (prog1 ref
-      (setf (gethash t ref) thing))))
-
-(defun emacsql--deref (ref)
-  "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))
 
 (defun emacsql-sqlite3-unavailable-p ()
   "Return a reason if the sqlite3 executable is not available.

               else
               collect (append (list 'emacsql 'emacsql--conn) statement))))

(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 (conn-copy . ref) in emacsql-connections

        (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))))
