Function: sql-read-table-name

sql-read-table-name is a byte-compiled function defined in sql.el.gz.

Signature

(sql-read-table-name PROMPT)

Documentation

Read the name of a database table.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/sql.el.gz
(defun sql-read-table-name (prompt)
  "Read the name of a database table."
  (let* ((tname
          (and (buffer-local-value 'sql-contains-names (current-buffer))
               (thing-at-point-looking-at
                (concat "\\_<\\sw\\(:?\\sw\\|\\s_\\)*"
                        "\\(?:[.]+\\sw\\(?:\\sw\\|\\s_\\)*\\)*\\_>"))
               (buffer-substring-no-properties (match-beginning 0)
                                               (match-end 0))))
         (sql-completion-sqlbuf (sql-find-sqli-buffer))
         (product (when sql-completion-sqlbuf
                    (with-current-buffer sql-completion-sqlbuf sql-product)))
         (completion-ignore-case t))

    (if product
        (if (sql-get-product-feature product :completion-object)
            (completing-read prompt #'sql--completion-table
                             nil nil tname)
          (read-from-minibuffer prompt tname))
      (user-error "There is no active SQLi buffer"))))