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



(byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\305\306\307\310\311\312%\207" [require cl-lib cl-generic eieio emacsql-compiler custom-declare-group emacsql nil "The EmacSQL SQL database front-end." :group comm] 6)
(defconst emacsql-version "4.3.3")#@271 Maximum number of seconds to wait before bailing out on a SQL command.
If nil, wait forever.  This is used by the `mysql', `pg' and `psql'.  It
is not being used by the `sqlite-builtin' and `sqlite-module' back-ends,
which respect `emacsql-sqlite-busy-timeout' instead.
(defvar emacsql-global-timeout 30 (#$ . 351))#@79 Access the slot `types' from object of class `emacsql-connection'.

(fn THIS)#@76 You cannot create a new object of type `emacsql-connection'.

(fn &rest _)
(byte-code "\300\301\302\303!\"\210\300\304\305\303!\"\210\300\306\304\"\210\307\306\310\311#\210\312\303\313\304#\314\303\315\316\317$\210\320\321\315\322\315\323%\207" [defalias emacsql-connection-p eieio-make-class-predicate emacsql-connection emacsql-connection--eieio-childp eieio-make-child-predicate emacsql-connection-child-p make-obsolete "use (cl-typep ... 'emacsql-connection) instead" "25.1" define-symbol-prop cl-deftype-satisfies eieio-defclass-internal nil ((handle :initarg :handle :documentation "Internal connection handler.\nThe value is a record-like object and should not be accessed\ndirectly.  Depending on the concrete implementation, `type-of'\nmay return `process', `user-ptr' or `sqlite' for this value.") (log-buffer :type (or null buffer) :initarg :log-buffer :initform nil :documentation "Output log (debug).") (finalizer :documentation "Object returned from `make-finalizer'.") (types :allocation :class :initform nil :reader emacsql-types :documentation "Maps EmacSQL types to SQL types.")) (:documentation "A connection to a SQL database." :abstract t) cl-generic-define-method emacsql-types ((this emacsql-connection)) #[257 "\300\301\"\207" [slot-value types] 4 (#$ . 672)]] 7)
(defalias 'emacsql-connection #[128 "\300\301!\207" [error "Class emacsql-connection is abstract"] 3 (#$ . 755)])#@59 Close CONNECTION and free all resources.

(fn CONNECTION)#@68 Re-establish CONNECTION with the same parameters.

(fn CONNECTION)#@73 Return non-nil if CONNECTION is still alive and ready.

(fn CONNECTION)#@287 Return an alist mapping EmacSQL types to database types.
This will mask `emacsql-type-map' during expression compilation.
This alist should have four key symbols: integer, float, object,
nil (default type).  The values are strings to be inserted into
a SQL expression.

(fn CONNECTION)#@53 Get process buffer for CONNECTION.

(fn CONNECTION)#@50 Enable debugging on CONNECTION.

(fn CONNECTION)#@107 Log MESSAGE into CONNECTION's log.
MESSAGE should not have a newline on the end.

(fn CONNECTION MESSAGE)#@54 Send MESSAGE to CONNECTION.

(fn CONNECTION MESSAGE)#@27 

(fn CONNECTION MESSAGE)#@67 Clear the connection buffer for CONNECTION-SPEC.

(fn CONNECTION)#@72 Return non-nil if CONNECTION is ready for more input.

(fn CONNECTION)#@89 Block until CONNECTION is waiting for further input.

(fn CONNECTION &optional TIMEOUT)#@86 Return the results of parsing the latest output or signal an error.

(fn CONNECTION)#@88 Compile s-expression SQL for CONNECTION into a string.

(fn CONNECTION SQL &rest ARGS)
(byte-code "\300\301\302\301\303\304#\305#\210\300\306\302\306\307\304#\310#\210\311\312\304\313\304\314%\210\300\315\302\315\316\304#\317#\210\311\320\304\321\304\322%\210\311\323\304\324\304\325%\210\311\326\304\327\304\330%\210\300\331\302\331\332\304#\333#\210\311\331\334\335\304\336%\210\311\337\304\340\304\341%\210\300\342\302\342\343\304#\344#\210\311\345\304\346\304\347%\210\300\350\302\350\351\304#\352#\207" [defalias emacsql-close cl-generic-define (connection) nil "Close CONNECTION and free all resources.\n\n(fn CONNECTION)" emacsql-reconnect (connection) "Re-establish CONNECTION with the same parameters.\n\n(fn CONNECTION)" cl-generic-define-method emacsql-live-p ((connection emacsql-connection)) #[257 "\300\301\302\"!\205\n \303\207" [process-live-p eieio-oref handle t] 5 (#$ . 2298)] emacsql-types (connection) "Return an alist mapping EmacSQL types to database types.\nThis will mask `emacsql-type-map' during expression compilation.\nThis alist should have four key symbols: integer, float, object,\nnil (default type).  The values are strings to be inserted into\na SQL expression.\n\n(fn CONNECTION)" emacsql-buffer ((connection emacsql-connection)) #[257 "\300\301\302\"!\207" [process-buffer eieio-oref handle] 5 (#$ . 2667)] emacsql-enable-debugging ((connection emacsql-connection)) #[257 "\300\301\302\"!?\205 \303\302\304\305!#\207" [buffer-live-p eieio-oref log-buffer eieio-oset generate-new-buffer " *emacsql-log*"] 6 (#$ . 2724)] emacsql-log ((connection emacsql-connection) message) #[514 "\300\301\"\211\205! \302!\204 \303!\262r\211q\210db\210\304\305P\")\207" [eieio-oref log-buffer buffer-live-p emacsql-enable-debugging princ "\n"] 6 (#$ . 2779)] emacsql-send-message (connection message) "Send MESSAGE to CONNECTION.\n\n(fn CONNECTION MESSAGE)" (:before) ((connection emacsql-connection) message) #[514 "\300\"\207" [emacsql-log] 5 (#$ . 2948)] emacsql-clear ((connection emacsql-connection)) #[257 "\300!\211\205 \301!\205 r\211q\210\302 )\207" [emacsql-buffer buffer-live-p erase-buffer] 4 (#$ . 2979)] emacsql-waiting-p (connection) "Return non-nil if CONNECTION is ready for more input.\n\n(fn CONNECTION)" emacsql-wait ((connection emacsql-connection) &optional timeout) #[513 "\211\206 \211\205 \301 \\\203 \301 W\2033 \302!\2043 \303 \304\305\"\216\306\307\310\"\")\266\202 \302!?\205@ \311\312\313D\"\207" [emacsql-global-timeout float-time emacsql-waiting-p match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data t] 3] accept-process-output eieio-oref handle signal emacsql-timeout "Query timed out"] 9 (#$ . 3126)] emacsql-parse (connection) "Return the results of parsing the latest output or signal an error.\n\n(fn CONNECTION)"] 6)
(defalias 'emacsql-compile #[642 "\203\n \301!\206 \302\303\304!#\305P)\207" [emacsql-type-map emacsql-types apply emacsql-format emacsql-prepare ";"] 7 (#$ . 3309)])#@93 Send SQL s-expression to CONNECTION and return the results.

(fn CONNECTION SQL &rest ARGS)#@34 

(fn CONNECTION SQL &rest ARGS)#@80 You cannot create a new object of type `emacsql-protocol-mixin'.

(fn &rest _)
(byte-code "\300\301\302\301\303\304#\305#\210\306\301\304\307\304\310%\210\300\311\312\313!\"\210\300\314\315\313!\"\210\300\316\314\"\210\317\316\320\321#\210\322\313\323\314#\324\313\304\211\325$\207" [defalias emacsql cl-generic-define (connection sql &rest args) nil "Send SQL s-expression to CONNECTION and return the results.\n\n(fn CONNECTION SQL &rest ARGS)" cl-generic-define-method ((connection emacsql-connection) sql &rest args) #[642 "\300\301$\302!\210\303\"\210\304!\210\305!\207" [apply emacsql-compile emacsql-clear emacsql-send-message emacsql-wait emacsql-parse] 8 (#$ . 6410)] emacsql-protocol-mixin-p eieio-make-class-predicate emacsql-protocol-mixin emacsql-protocol-mixin--eieio-childp eieio-make-child-predicate emacsql-protocol-mixin-child-p make-obsolete "use (cl-typep ... 'emacsql-protocol-mixin) instead" "25.1" define-symbol-prop cl-deftype-satisfies eieio-defclass-internal (:documentation "A mixin for back-ends following the EmacSQL protocol.\nThe back-end prompt must be a single \"]\" character.  This prompt\nvalue was chosen because it is unreadable.  Output must have\nexactly one row per line, fields separated by whitespace.  NULL\nmust display as \"nil\"." :abstract t)] 6)
(defalias 'emacsql-protocol-mixin #[128 "\300\301!\207" [error "Class emacsql-protocol-mixin is abstract"] 3 (#$ . 6448)])#@141 Return t if the end of the buffer has a properly-formatted prompt.
Also return t if the connection buffer has been killed.

(fn CONNECTION)#@167 Signal a specific condition for CODE from CONNECTION.
Subclasses should override this method in order to provide more
specific error conditions.

(fn _ CODE MESSAGE)#@65 Parse well-formed output into an s-expression.

(fn CONNECTION)#@83 Register CONNECTION for automatic cleanup and return CONNECTION.

(fn CONNECTION)
(byte-code "\300\301\302\303\302\304%\210\300\305\302\306\302\307%\210\300\310\302\311\302\312%\207" [cl-generic-define-method emacsql-waiting-p nil ((connection emacsql-protocol-mixin)) #[257 "\300!\301!?\206 r\211q\210\302 \303Y\205 d\303Zd{\304\230)\207" [emacsql-buffer buffer-live-p buffer-size 2 "#\n"] 4 (#$ . 7880)] emacsql-handle ((_ emacsql-protocol-mixin) code message) #[771 "\300\301D\"\207" [signal emacsql-error] 7 (#$ . 8026)] emacsql-parse ((connection emacsql-protocol-mixin)) #[257 "r\301!q\210eb\210p\302 \211\303=\203 \304\302 \302 #\202- \211\302 \305=\204- \304\302 \302 #\210*\207" [standard-input emacsql-buffer read error emacsql-handle success] 7 (#$ . 8197)]] 6)
(defalias 'emacsql-register #[257 "\211\300\301\302\303\304\"!#\210\207" [eieio-oset finalizer make-finalizer make-closure #[0 "\301\300!\207" [V0 emacsql-close] 2]] 9 (#$ . 8266)])#@352 Open an EmacSQL connection, evaluate BODY, and close the connection.
CONNECTION-SPEC establishes a single binding.

  (emacsql-with-connection (db (emacsql-sqlite "company.db"))
    (emacsql db [:create-table foo [x]])
    (emacsql db [:insert :into foo :values ([1] [2] [3])])
    (emacsql db [:select * :from foo]))

(fn CONNECTION-SPEC &rest BODY)
(defalias 'emacsql-with-connection '(macro . #[385 "\300@A@DC\301\302B\303@DEE\207" [let unwind-protect progn emacsql-close] 8 (#$ . 9241)]))#@67 Keeps track of nested transactions in `emacsql-with-transaction'.
(byte-code "\300\301\302\303#\300\207" [function-put emacsql-with-connection lisp-indent-function 1] 4)
(defvar emacsql--transaction-level 0 (#$ . 9744))#@385 Evaluate BODY inside a single transaction, issuing a rollback on error.
This macro can be nested indefinitely, wrapping everything in a
single transaction at the lowest level.

Warning: BODY should *not* have any side effects besides making
changes to the database behind CONNECTION.  Body may be evaluated
multiple times before the changes are committed.

(fn CONNECTION &rest BODY)
(defalias 'emacsql-with-transaction '(macro . #[385 "\300\301D\302B\303\304\305\306\307\310\311\300\312\310\fBDC\313BBE\314BBBE\315BB\316BBB\207" [let emacsql--connection ((emacsql--completed nil) (emacsql--transaction-level (1+ emacsql--transaction-level)) (emacsql--result)) unwind-protect while (not emacsql--completed) condition-case nil progn (when (= 1 emacsql--transaction-level) (emacsql emacsql--connection [:begin])) result ((setq emacsql--result result) (when (= 1 emacsql--transaction-level) (emacsql emacsql--connection [:commit])) (setq emacsql--completed t)) ((emacsql-locked (emacsql emacsql--connection [:rollback]) (sleep-for 0.05))) ((when (and (= 1 emacsql--transaction-level) (not emacsql--completed)) (emacsql emacsql--connection [:rollback]))) (emacsql--result)] 15 (#$ . 9970)]))#@143 Thread CONNECTION through STATEMENTS.
A statement can be a list, containing a statement with its arguments.

(fn CONNECTION &rest STATEMENTS)
(byte-code "\300\301\302\303#\300\207" [function-put emacsql-with-transaction lisp-indent-function 1] 4)
(defalias 'emacsql-thread '(macro . #[385 "\300\301DC\302\301\303\211:\2033 @\262\304!\203$ \305\301EB\262\202, \306\307\"B\262A\262\202\n \266\202\237BBE\207" [let emacsql--conn emacsql-with-transaction nil vectorp emacsql append (emacsql emacsql--conn)] 12 (#$ . 11166)]))#@754 For each result row bind the column names for each returned row.
Returns the result of the last evaluated BODY.

All column names must be provided in the query ($ and * are not
allowed).  Hint: all of the bound identifiers must be known at
compile time.  For example, in the expression below the variables
`name' and `phone' will be bound for the body.

  (emacsql-with-bind db [:select [name phone] :from people]
    (message "Found %s with %s" name phone))

  (emacsql-with-bind db ([:select [name phone]
                          :from people
                          :where (= name $1)] my-name)
    (message "Found %s with %s" name phone))

Each column must be a plain symbol, no expressions allowed here.

(fn CONNECTION SQL-AND-ARGS &rest BODY)
(byte-code "\300\301\302\303#\300\207" [function-put emacsql-thread lisp-indent-function 1] 4)
(defalias 'emacsql-with-bind '(macro . #[642 "\300!\203\n \202\f @\300!?\205 A\301\234\302=\204! \303\304!\210\305\234\211\306=\203. \307\310!\210\311\312\"\2049 \303\313!\210\314\315\316BBBD\317B\320\321\322\323\324\325\326\"\327\fBBBEEE\207" [vectorp 0 :select cl--assertion-failed (eq :select (elt sql 0)) 1 * error "Must explicitly list columns in `emacsql-with-bind'" cl-every symbolp (cl-every #'symbolp vars) let emacsql--results emacsql ((emacsql--final nil)) dolist (emacsql--result emacsql--results emacsql--final) setq emacsql--final cl-destructuring-bind cl-coerce list emacsql--result] 16 (#$ . 11708)]))#@53 Name of the buffer for displaying intermediate SQL.
(byte-code "\300\301\302\303#\300\207" [function-put emacsql-with-bind lisp-indent-function 2] 4)
(defvar emacsql-show-buffer-name "*emacsql-show*" (#$ . 13197))#@59 Indent and wrap the SQL expression in the current buffer.
(defalias 'emacsql--indent #[0 "\212eb\210\302\303\304\302\305#\205 i	\306_V\203 \307v\210\310c\210\202 *\207" [case-fold-search fill-column nil search-forward-regexp " [A-Z]+" :no-error 0.8 -1 "\n    "] 4 (#$ . 13416)])#@64 Fontify and display the SQL expression in STRING.

(fn STRING)
(defalias 'emacsql-show-sql #[257 "\303\304\305\"r\211q\210\306\307\"\216c\210\310 \210\311 \210\312 \210\313 \210\314 *\262r\315!q\210G	W\2035 \316\317\"\202G \320\321 \210\211c)\210\322 \210\323 \210\324p!)\207" [emacsql-show-buffer-name fill-column buffer-read-only generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205	 \302\300!\207" [V0 buffer-name kill-buffer] 2] sql-mode sql-highlight-sqlite-keywords font-lock-ensure emacsql--indent buffer-string get-buffer-create message "%s" nil erase-buffer special-mode visual-line-mode pop-to-buffer] 5 (#$ . 13704)])#@70 Convert a s-expression SQL into a flat string for display.

(fn SQL)
(defalias 'emacsql-flatten-sql #[257 "\300!\211\203 \211A\262\242\202 \301\302\303GD\"\304\305\306\307\"\310\211:\203< @\262\311\305\312T\"!B\262A\262\202! \266\202\237#\313P\207" [emacsql-prepare signal wrong-number-of-arguments (string . vars) apply format mapcar car nil intern "$%d" ";"] 13 (#$ . 14356)])#@170 Display the compiled SQL of the s-expression SQL expression before point.
A prefix argument causes the SQL to be printed into the current buffer.

(fn &optional PREFIX)
(defalias 'emacsql-show-last-sql #[256 "\300\301!\203 \301 \202 \302 \303!\203! \304!\203 \211c\207\305!\207\306\307\"\207" [fboundp elisp--preceding-sexp preceding-sexp emacsql-sql-p emacsql-flatten-sql emacsql-show-sql user-error "Invalid SQL: %S"] 5 (#$ . 14758) "P"])#@56 Return non-nil if point is inside a vector expression.
(defalias 'emacsql--inside-vector-p #[0 "`\212\300 \210\301`\"\302\234\211\205 \211b\210\303\304!)\207" [beginning-of-defun parse-partial-sexp 1 looking-at "\\["] 4 (#$ . 15212)])#@86 Don't indent vectors in `emacs-lisp-mode' like lists.

(fn FN &optional PARSE-START)
(defalias 'emacsql--calculate-vector-indent #[513 "\212\301 \210\302 )\203 \303!)\207!\207" [lisp-indent-offset beginning-of-line emacsql--inside-vector-p 1] 4 (#$ . 15454)])#@133 When called, advise `calculate-lisp-indent' to stop indenting vectors.
Once activated, vector contents no longer indent like lists.
(defalias 'emacsql-fix-vector-indentation #[0 "\300\301\302\303#\207" [advice-add calculate-lisp-indent :around emacsql--calculate-vector-indent] 4 (#$ . 15726) nil])
(provide 'emacsql)
