unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* [SQL Mode and MS-SQL and Free TDS]
@ 2024-01-25  6:41 Evan Misshula
  0 siblings, 0 replies; only message in thread
From: Evan Misshula @ 2024-01-25  6:41 UTC (permalink / raw)
  To: michael, help-gnu-emacs

Hi Mr. Mauger,

Thank you for your work maintaining and improving SQL-Mode. In customizing
it to work for me. I changed several  items and wanted to make those
changes available to the wider community.

1. I used Free-TDS (https://www.freetds.org/). FreeTDS is a set of
libraries for Unix and Linux that allows your programs to natively talk to
Microsoft SQL Server and Sybase databases. My employer uses MS SqlServer.

2. To get this to work, I had to change to functions. The first was to drop
"-D" parameter which has been deprecated by osql.  My version of
sql-comint-ms appears below.

(defun sql-comint-ms (product options &optional buf-name)
  "Create comint buffer and connect to Microsoft SQL Server."
  ;; Put all parameters to the program (if defined) in a list and call
  ;; make-comint.
  (let ((params
         (append
          (if (not (string= "" sql-user))
              (list "-U" sql-user))
;;          (if (not (string= "" sql-database))
;;              (list "-D" sql-database))
          (if (not (string= "" sql-server))
              (list "-S" sql-server))
          options)))
    (setq params
          (if (not (string= "" sql-password))
              `("-P" ,sql-password ,@params)
            (if (string= "" sql-user)
                ;; If neither user nor password is provided, use system
                ;; credentials.
                `("-E" ,@params)
              ;; If -P is passed to ISQL as the last argument without a
              ;; password, it's considered null.
              `(,@params "-P"))))
    (sql-comint product params buf-name)))

osql no longer supports the "-w" parameter and sql-ms-options appears below

(defcustom sql-ms-options '(" " " " " ")
  ;; -w is the linesize
  "List of additional options for `sql-ms-program'."
  :type '(repeat string)
  :version "22.1")

Thank you for your consideration. If you like these changes I can prepare a
pull request to support Free-TDS and another to update ms for changes to
osql.

Best,
Evan Misshula


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-25  6:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25  6:41 [SQL Mode and MS-SQL and Free TDS] Evan Misshula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).