Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you're quite right, the reason that sql-set-sqli-buffer is not finding a suitable SQLi buffer is because it takes the product subtype of the SQL-mode buffer into account when walking through the list of open buffers. </p> <p>Here's the code for the buffer testing from my copy of sql.el, which shipped with my emacs ( version - GNU emacs 24.2.1</p> <pre><code>(defun sql-find-sqli-buffer (&amp;optional product connection) "Returns the name of the current default SQLi buffer or nil. In order to qualify, the SQLi buffer must be alive, be in `sql-interactive-mode' and have a process." (let ((buf sql-buffer) (prod (or product sql-product))) (or ;; Current sql-buffer, if there is one. (and (sql-buffer-live-p buf prod connection) buf) ;; Global sql-buffer (and (setq buf (default-value 'sql-buffer)) (sql-buffer-live-p buf prod connection) buf) ;; Look thru each buffer (car (apply 'append (mapcar (lambda (b) (and (sql-buffer-live-p b prod connection) (list (buffer-name b)))) (buffer-list))))))) </code></pre> <p>the two values used to primarily used to test eligibility are a buffer and a symbol identifying the product type. This symbol is passed in as an argument, or defaults to the value of sql-product. It appears that sql-product, unless set in some other way is defaulted to 'ansi, which is why your editing buffer is SQL[ANSI].</p> <p>You should try setting the product type in this buffer (e.g. with <code>M-x sql-set-product</code>) before trying to associate a SQLi buffer with the query buffer. If you want the default to always be 'mysql' you can set this in your init file, or customize it using <code>M-x customize-variable</code></p> <p>SQL-mode is quite order dependent on having the buffer set up with the right local variables in order to have a working associated iSQL session. </p> <p>A typical sequence I use to initiate an iSQL buffer with a query in another buffer I am already editing is as follows</p> <ol> <li>Switch to a buffer with the SQL text in it , by visiting a file perhaps, or using <code>C-x b</code> to create a temporary buffer. </li> <li>Set this buffer to be in the correct SQL type, with <code>M-x sql-set-product</code> and then entering a known type , such as "mysql" at the prompt.</li> <li>Hitting <code>C-c &lt;TAB&gt;</code> (bound to <code>sql-product-interactive</code>) to switch to an iSQL buffer associated to this buffer, potentially by locating or creating an new comint process</li> </ol> <p>It is probably worth reading the output of the <code>M-x sql-help</code> command. The documentation for SQL-mode is very light. I've figured out what little I know about it mostly from reading the source.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload