From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Xi Shen <davidshen84@gmail.com>
Cc: "Emacs-orgmode@gnu.org" <Emacs-orgmode@gnu.org>
Subject: Re: [PATCH] ob-sql.el: Support sqlcmd and cygwin environment
Date: Sat, 11 Jun 2016 00:06:24 +0200 [thread overview]
Message-ID: <87r3c4em1r.fsf@saiph.selenimh> (raw)
In-Reply-To: <CANO68EOquCbO1EXUcDWA5O5pDVneL3r4G58q9shhG3ww7_sY3Q@mail.gmail.com> (Xi Shen's message of "Wed, 08 Jun 2016 10:24:44 +0000")
Hello,
Xi Shen <davidshen84@gmail.com> writes:
> I would like to apply this path to add sqlcmd support, and allow org-mode
> to execute and capture sqlcmd output in cygwin environment.
Thank you for the patch.
> I added a "platform-convert-file-name" function to convert a *nix path to
> Windows path. Should I put this function in ob-sql.el, or somewhere
> else?
I'm surprised it doesn't exist. Wouldn't `convert-standard-filename' do
the job?
In any case, it doesn't have a proper prefix.
> Subject: [PATCH] ob-sql.el: Support sqlcmd and cygwin environment
>
> * lisp/ob-sql.el (org-babel-sql-dbstring-mssql): Format Microsoft
> sqlcmd command line args.
>
> * lisp/ob-sql.el (platform-convert-file-name): Convert a *nix path to
> Windows long path in Cygwin environment, or do nothing.
>
> * lisp/ob-sql.el (org-babel-execute:sql): Add `mssql` command support.
> For both `msosql` and `mssql` the `input` and `output` path will be
> mapped by `platform-convert-file-name`
You can write it like
* lisp/ob-sql.el (org-babel-sql-dbstring-mssql): Format Microsoft
sqlcmd command line args.
(platform-convert-file-name): Convert a *nix path to Windows long path
in Cygwin environment, or do nothing.
(org-babel-execute:sql): Add `mssql' command support. For both `msosql'
and `mssql` the `input` and `output' path will be mapped by
`platform-convert-file-name'
> The `osql` command line tool was last updated in 2004,
> https://technet.microsoft.com/en-us/library/aa214012(v=sql.80).aspx,
> and could not output the query result in a way that morden
> `org-table.el` expects. The `sqlcmd` is the preferred command line
> tool to connect the Microsoft SQL Server and it also has a Linux
> version,
> https://msdn.microsoft.com/en-us/library/hh568447(v=sql.110).aspx.
Would it make sense to remove the msosql support then?
> +(defun org-babel-sql-dbstring-mssql (host user password database)
> + "Make Microsoft sqlcmd commmand line args for database
> +connection."
The first sentence has to fit on a single line.
> + (mapconcat 'identity
Nit-pick:
#'identity
> + "In Cygwin environment convert the file path into Windows long
> +path and quote it."
> + (if (fboundp 'cygwin-convert-file-name-to-windows)
> + (format "\"%s\"" (cygwin-convert-file-name-to-windows file))
> + file))
See above.
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2016-06-10 22:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-08 10:24 [PATCH] ob-sql.el: Support sqlcmd and cygwin environment Xi Shen
2016-06-10 22:06 ` Nicolas Goaziou [this message]
2016-06-11 2:17 ` Xi Shen
2016-06-11 8:40 ` Nicolas Goaziou
2016-06-12 2:12 ` Xi Shen
2016-06-12 10:37 ` Xi Shen
2016-06-13 5:36 ` Xi Shen
2016-06-13 6:30 ` Xi Shen
2016-06-14 11:52 ` Nicolas Goaziou
2016-06-14 13:02 ` Xi Shen
2016-06-15 4:01 ` Xi Shen
2016-06-15 16:49 ` Nicolas Goaziou
2016-06-16 6:04 ` Xi Shen
2016-06-16 8:56 ` tumashu
2016-06-16 22:29 ` Nicolas Goaziou
2016-06-20 12:34 ` Xi Shen
2016-07-04 8:11 ` Xi Shen
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.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r3c4em1r.fsf@saiph.selenimh \
--to=mail@nicolasgoaziou.fr \
--cc=Emacs-orgmode@gnu.org \
--cc=davidshen84@gmail.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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).