Function: emacsql-sqlite-restore-database
emacsql-sqlite-restore-database is a byte-compiled function defined in
emacsql-sqlite.el.
Signature
(emacsql-sqlite-restore-database DB DUMP)
Documentation
Restore database DB from DUMP.
DUMP is a file containing SQL statements. DB can be the file in which the database is to be stored, or it can be a database connection. In the latter case the current database is first dumped to a new file and the connection is closed. Then the database is restored from DUMP. No connection to the new database is created.
Source Code
;; Defined in ~/.emacs.d/elpa/emacsql-20261001.1544/emacsql-sqlite.el
(defun emacsql-sqlite-restore-database (db dump)
"Restore database DB from DUMP.
DUMP is a file containing SQL statements. DB can be the file
in which the database is to be stored, or it can be a database
connection. In the latter case the current database is first
dumped to a new file and the connection is closed. Then the
database is restored from DUMP. No connection to the new
database is created."
(unless (stringp db)
(emacsql-sqlite-dump-database db t)
(emacsql-close (prog1 db (setq db (oref db file)))))
(with-temp-buffer
(unless (zerop (call-process "sqlite3" nil t nil db
(format ".read %s" dump)))
(error "Failed to read %s: %s" dump (buffer-string)))))