;ELC   
;;; Compiled
;;; in Emacs version 30.2
;;; with all optimizations.


#@81 Access the slot `types' from object of class `emacsql--sqlite-base'.

(fn THIS)#@78 You cannot create a new object of type `emacsql--sqlite-base'.

(fn &rest _)
(byte-code "\300\301!\210\302\303\304\305!\"\210\302\306\307\305!\"\210\302\310\306\"\210\311\310\312\313#\210\314\305\315\306#\316\305\317\320\321$\210\322\323\324\325\324\326%\207" [require emacsql defalias emacsql--sqlite-base-p eieio-make-class-predicate emacsql--sqlite-base emacsql--sqlite-base--eieio-childp eieio-make-child-predicate emacsql--sqlite-base-child-p make-obsolete "use (cl-typep ... 'emacsql--sqlite-base) instead" "25.1" define-symbol-prop cl-deftype-satisfies eieio-defclass-internal (emacsql-connection) ((file :initarg :file :initform nil :type (or null string) :documentation "Database file name.") (types :allocation :class :reader emacsql-types :initform '((integer "INTEGER") (float "REAL") (object "TEXT") (nil nil)))) (:abstract t) cl-generic-define-method emacsql-types nil ((this emacsql--sqlite-base)) #[257 "\300\301\"\207" [slot-value types] 4 (#$ . 83)]] 7)
(defalias 'emacsql--sqlite-base #[128 "\300\301!\207" [error "Class emacsql--sqlite-base is abstract"] 3 (#$ . 168)])#@92 List of all of SQLite's reserved words.
Also see http://www.sqlite.org/lang_keywords.html.
(defconst emacsql-sqlite-reserved '(ABORT ACTION ADD AFTER ALL ALTER ANALYZE AND AS ASC ATTACH AUTOINCREMENT BEFORE BEGIN BETWEEN BY CASCADE CASE CAST CHECK COLLATE COLUMN COMMIT CONFLICT CONSTRAINT CREATE CROSS CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP DATABASE DEFAULT DEFERRABLE DEFERRED DELETE DESC DETACH DISTINCT DROP EACH ELSE END ESCAPE EXCEPT EXCLUSIVE EXISTS EXPLAIN FAIL FOR FOREIGN FROM FULL GLOB GROUP HAVING IF IGNORE IMMEDIATE IN INDEX INDEXED INITIALLY INNER INSERT INSTEAD INTERSECT INTO IS ISNULL JOIN KEY LEFT LIKE LIMIT MATCH NATURAL NO NOT NOTNULL NULL OF OFFSET ON OR ORDER OUTER PLAN PRAGMA PRIMARY QUERY RAISE RECURSIVE REFERENCES REGEXP REINDEX RELEASE RENAME REPLACE RESTRICT RIGHT ROLLBACK ROW SAVEPOINT SELECT SET TABLE TEMP TEMPORARY THEN TO TRANSACTION TRIGGER UNION UNIQUE UPDATE USING VACUUM VALUES VIEW VIRTUAL WHEN WHERE WITH WITHOUT) (#$ . 1264))#@173 Alist mapping SQLite error codes to EmacSQL conditions.
Elements have the form (ERRCODE SYMBOLIC-NAME EMACSQL-ERROR
ERRSTR).  Also see https://www.sqlite.org/rescode.html.
(defconst emacsql-sqlite-error-codes '((1 SQLITE_ERROR emacsql-error "SQL logic error") (2 SQLITE_INTERNAL emacsql-internal nil) (3 SQLITE_PERM emacsql-access "access permission denied") (4 SQLITE_ABORT emacsql-error "query aborted") (5 SQLITE_BUSY emacsql-locked "database is locked") (6 SQLITE_LOCKED emacsql-locked "database table is locked") (7 SQLITE_NOMEM emacsql-memory "out of memory") (8 SQLITE_READONLY emacsql-access "attempt to write a readonly database") (9 SQLITE_INTERRUPT emacsql-error "interrupted") (10 SQLITE_IOERR emacsql-access "disk I/O error") (11 SQLITE_CORRUPT emacsql-corruption "database disk image is malformed") (12 SQLITE_NOTFOUND emacsql-error "unknown operation") (13 SQLITE_FULL emacsql-access "database or disk is full") (14 SQLITE_CANTOPEN emacsql-access "unable to open database file") (15 SQLITE_PROTOCOL emacsql-access "locking protocol") (16 SQLITE_EMPTY emacsql-corruption nil) (17 SQLITE_SCHEMA emacsql-error "database schema has changed") (18 SQLITE_TOOBIG emacsql-error "string or blob too big") (19 SQLITE_CONSTRAINT emacsql-constraint "constraint failed") (20 SQLITE_MISMATCH emacsql-error "datatype mismatch") (21 SQLITE_MISUSE emacsql-error "bad parameter or other API misuse") (22 SQLITE_NOLFS emacsql-error "large file support is disabled") (23 SQLITE_AUTH emacsql-access "authorization denied") (24 SQLITE_FORMAT emacsql-corruption nil) (25 SQLITE_RANGE emacsql-error "column index out of range") (26 SQLITE_NOTADB emacsql-corruption "file is not a database") (27 SQLITE_NOTICE emacsql-warning "notification message") (28 SQLITE_WARNING emacsql-warning "warning message")) (#$ . 2245))#@235 Whether to include names of columns as an additional row.
Never enable this globally, only let-bind it around calls to `emacsql'.
Currently only supported by `emacsql-sqlite-builtin-connection' and
`emacsql-sqlite-module-connection'.
(defvar emacsql-include-header nil (#$ . 4059))#@127 Seconds to wait when trying to access a table blocked by another process.
See https://www.sqlite.org/c3ref/busy_timeout.html.
(defvar emacsql-sqlite-busy-timeout 20 (#$ . 4347))#@707 Return the connection stored in VARIABLE to the database in FILE.

If the value of VARIABLE is a live database connection, return that.

Otherwise open a new connection to the database in FILE and store the
connection in VARIABLE, before returning it.  If FILE is nil, use an
in-memory database.  Always enable support for foreign key constrains.
If optional SETUP is non-nil, it must be a function, which takes the
connection as only argument.  This function can be used to initialize
tables, for example.

If optional USE-MODULE is non-nil, then use the external module even
when Emacs was built with SQLite support.  This is intended for testing
purposes.

(fn VARIABLE FILE &optional SETUP USE-MODULE)
(defalias 'emacsql-sqlite-connection #[1026 "J\211\205 \300!\205 \211\262\206 \301\302$L\207" [emacsql-live-p emacsql-sqlite-open nil] 10 (#$ . 4531)])#@724 Open a connection to the database stored in FILE using an SQLite back-end.

Automatically use the best available back-end, as returned by
`emacsql-sqlite-default-connection'.

If FILE is nil, use an in-memory database.  If optional DEBUG is
non-nil, log all SQLite commands to a log buffer, for debugging
purposes.  Always enable support for foreign key constrains.

If optional SETUP is non-nil, it must be a function, which takes the
connection as only argument.  This function can be used to initialize
tables, for example.

If optional USE-MODULE is non-nil, then use the external module even
when Emacs was built with SQLite support.  This is intended for testing
purposes.

(fn FILE &optional DEBUG SETUP USE-MODULE)
(defalias 'emacsql-sqlite-open #[1025 "\203 \300\301!\302\"\210\303!\304\305#\203 \306!\210\307\310\"\210\203) !\210\207" [make-directory file-name-directory t emacsql-sqlite-default-connection make-instance :file emacsql-enable-debugging emacsql [:pragma (= foreign-keys on)]] 9 (#$ . 5405)])#@299 Determine and return the best SQLite connection class.

Signal an error if none of the connection classes can be used.

If optional USE-MODULE is non-nil, then use the external module even
when Emacs was built with SQLite support.  This is intended for testing
purposes.

(fn &optional USE-MODULE)
(defalias 'emacsql-sqlite-default-connection #[256 "\211\204 \301\302!\203 \302 \203 \303\304!\203 \305\207\306\300!\203P \203P \30716 \303\310!\2052 \303\311!\2052 \3120\202M \210\313\314\315\"\210\316C\211\317\320\"\240\210\321\322\242\"\266\316\206S \323\324!\207" [module-file-suffix fboundp sqlite-available-p require emacsql-sqlite-builtin emacsql-sqlite-builtin-connection boundp (error) sqlite3 emacsql-sqlite-module emacsql-sqlite-module-connection display-warning emacsql "Since your Emacs does not come with\nbuilt-in SQLite support [1], but does support C modules, we can\nuse an EmacSQL backend that relies on the third-party `sqlite3'\npackage [2].\n\nPlease install the `sqlite3' Elisp package using your preferred\nEmacs package manager, and install the SQLite shared library\nusing your distribution's package manager.  That package should\nbe named something like `libsqlite3' [3] and NOT just `sqlite3'.\n\nThe legacy backend, which uses a custom SQLite executable, has\nbeen remove, so we can no longer fall back to that.\n\n[1]: Supported since Emacs 29.1, provided it was not disabled\n     with `--without-sqlite3'.\n[2]: https://github.com/pekingduck/emacs-sqlite3-api\n[3]: On Debian https://packages.debian.org/buster/libsqlite3-0" nil make-closure #[0 "\301\302\300\242\"\210\303\304\305!!\207" [V0 remove-hook post-command-hook pop-to-buffer get-buffer "*Warnings*"] 3] add-hook post-command-hook error "EmacSQL could not find or compile a back-end"] 6 (#$ . 6442)])#@19 

(fn CONNECTION)
(defalias 'emacsql-sqlite-set-busy-timeout #[257 "\205 \301\302\303_#\207" [emacsql-sqlite-busy-timeout emacsql [:pragma (= busy-timeout $s1)] 1000] 6 (#$ . 8248)])#@15 

(fn STRING)
(defalias 'emacsql-sqlite-read-column #[257 "\300\301GW\203 \302\"\211@B\262\211A\262\210\202 \237\207" [nil 0 read-from-string] 7 (#$ . 8440)])#@158 Return a list of symbols identifying tables in CONNECTION.
Tables whose names begin with "sqlite_", are not included
in the returned value.

(fn CONNECTION)
(defalias 'emacsql-sqlite-list-tables #[257 "\300\301\302\303\"\"\207" [mapcar car emacsql [:select name :from sqlite-master :where (and (= type 'table) (not-like name "sqlite_%")) :order-by [(asc name)]]] 6 (#$ . 8616)])#@535 Dump the database specified by CONNECTION to a file.

The dump file is placed in the same directory as the database
file and its name derives from the name of the database file.
The suffix is replaced with ".sql" and if optional VERSIONP is
non-nil, then the database version (the `user_version' pragma)
and a timestamp are appended to the file name.

Dumping is done using the official `sqlite3' binary.  If that is
not available and VERSIONP is non-nil, then the database file is
copied instead.

(fn CONNECTION &optional VERSIONP)
(defalias 'emacsql-sqlite-dump-database #[513 "\301\302\"@@\303\304\"\2119\203 \211J\202 \211\305!\306!\205( \307\310\"\311\312!P\313Q\314\315\"\203\230 \316!\203@ \203@ \317\320\"\210\321\322\323\"\324\325\"\216r\211q\210\326\327#\210\212\330\315\331\323\331\332&)\333U\204i \317\334\"\210\203t \307\335\"c\210\336\337\340\323#\203\204 \341\342\323\211\331\343%\210\326\344#)rq\210\345\331\211\331\333%*\210\207\203\307 \306!\346P\262\326\347!\210\316!\203\266 \203\266 \317\350\"\210\326\351#\210\352\"\210\326\353#\207\317\354!\207" [exec-path emacsql [:pragma user-version] eieio-oref file file-name-nondirectory file-name-sans-extension format "-v%s" format-time-string "-%Y%m%d-%H%M" ".sql" locate-file "sqlite3" file-exists-p error "Cannot dump database; %s already exists" generate-new-buffer " *temp file*" t make-closure #[0 "\301\300!\205	 \302\300!\207" [V0 buffer-name kill-buffer] 2] message "Dumping %s database to %s..." call-process nil ".dump" 0 "Failed to dump %s" "PRAGMA user_version=%s;\n" re-search-forward "^PRAGMA foreign_keys=\\(OFF\\);" 1000 replace-match "ON" 1 "Dumping %s database to %s...done" write-region ".db" "Cannot dump database because sqlite3 binary cannot be found" "Cannot copy database; %s already exists" "Copying %s database to %s..." copy-file "Copying %s database to %s...done" "Cannot dump database; sqlite3 binary isn't available"] 15 (#$ . 9002)])#@374 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.

(fn DB DUMP)
(defalias 'emacsql-sqlite-restore-database #[514 ";\204 \300\301\"\210\302\303\304\"\262!\210\305\306\301\"r\211q\210\307\310\"\216\311\312\313\301\313\314\315	\"&\316U?\205; \317\320\321 #*\207" [emacsql-sqlite-dump-database t emacsql-close eieio-oref file generate-new-buffer " *temp*" make-closure #[0 "\301\300!\205	 \302\300!\207" [V0 buffer-name kill-buffer] 2] call-process "sqlite3" nil format ".read %s" 0 error "Failed to read %s: %s" buffer-string] 12 (#$ . 10978)])
(provide 'emacsql-sqlite)
