unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Evan Misshula <em64@columbia.edu>
To: michael@mauger.com, help-gnu-emacs@gnu.org
Subject: [SQL Mode and MS-SQL and Free TDS]
Date: Thu, 25 Jan 2024 01:41:01 -0500	[thread overview]
Message-ID: <CAM38Xu9W+e+fhsE-RJ-i1nA=ni+rtpVrs24tcYbgP=xujWk_6Q@mail.gmail.com> (raw)

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


                 reply	other threads:[~2024-01-25  6:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM38Xu9W+e+fhsE-RJ-i1nA=ni+rtpVrs24tcYbgP=xujWk_6Q@mail.gmail.com' \
    --to=em64@columbia.edu \
    --cc=help-gnu-emacs@gnu.org \
    --cc=michael@mauger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).