[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [SQL Mode and MS-SQL and Free TDS]
From: |
Michael Mauger |
Subject: |
Re: [SQL Mode and MS-SQL and Free TDS] |
Date: |
Wed, 09 Oct 2024 03:41:35 +0000 |
On Thursday, January 25th, 2024 at 1:41 AM, Evan Misshula <em64@columbia.edu>
wrote:
> Hi Mr. Mauger,
>
First of all, I apologize for the delay in responding to this. I've been out of
action due to health reasons--One of many benefits of getting old....
I'm not sure that this is still relavent to you, but I've made some notes below.
> 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.
I've had the displeasure of using both Sybase and SQL Server myself. Glad to
see some of the proprietary stack is getting Software Freedom love.
>
> 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))
Here's where I get confused. The current code has used "-d" (ie, not "-D") for
the db name since at least 2012 and the current MS `osql' tool still accepts
this (-d) parameter. Maybe your sources are out-of-sync? The "-D" option of
osql is different and would not work with a ODBC stack other than microsoft's.
Also, if the `sql-database' variable is set to an empty string, no "-d/D"
parameter is sent at all. So there may be a configuration issue as well. One
challenge we have had with SQL Server is that they keep releasing new tools
with different conventions and fewer and fewer support CLI interaction. If you
can send along information about the version of osql you are using and the
related settings, I may be able to identify if there is a bug to be addressed.
>
> 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")
The documentation for SQL Server 2022 osql still lists the -w and -n options as
acceptable. You can certainly set `sql-ms-options' to nil locally if they do
not apply to your use, but leaving them as defaults appears to be appropriate
as others have previously requested.
>
> 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.
>
Please feel free to forward any other settings that you needed to make to
support your configuration along with version numbers of the SQL Server client
and database as well as FreeTDS software that you are using.
> Best,
> Evan Misshula
Obviously, I understand if the long delay in response makes this all moot but I
do appreciate your raising these issues.
Happy Hacking.
--
MICHAEL@MAUGER.COM // FSF and SFConservancy // GNU Emacs sql.el maintainer
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [SQL Mode and MS-SQL and Free TDS],
Michael Mauger <=