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

                                          (line-end-position)))
               (condition (emacsql-get-condition message)))
          (signal condition (list message)))))))

;;; Escaping:


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