emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jonathan Leech-Pepin <jonathan.leechpepin@gmail.com>
To: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: [PATCH] ob-sql.el: Add support for MS sqlcmd
Date: Thu, 4 Sep 2014 08:49:39 -0400	[thread overview]
Message-ID: <CAEWDx5eJnC8DMsF-LJcT4U-2nJLR8fv9zDdHtc4aG-FA8-UHpg@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1207 bytes --]

Patch provided inline and as attachment to ensure gmail does not mangle it.

Regards,
Jonathan



ob-sql.el: Add support for sqlcmd

* lisp/ob-sql.el (org-babel-execute:sql): Add support for sqlcmd on
  Windows.  This is a replacement for osql.
---
 lisp/ob-sql.el |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 7b85df8..e96d55d 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -116,6 +116,12 @@ This function is called by
`org-babel-execute-src-block'."
                                      (or cmdline "")
                                      (org-babel-process-file-name in-file)
                                      (org-babel-process-file-name
out-file)))
+            ('mssqlcmd (format "sqlcmd %s -S %s -s \"\t\" -i %s -o %s"
+                    (or cmdline "")
+                    dbhost
+                    (org-babel-process-file-name in-file)
+                    (org-babel-process-file-name
+                     out-file)))
                     ('mysql (format "mysql %s %s %s < %s > %s"
                     (dbstring-mysql dbhost dbuser dbpassword database)
                     (if colnames-p "" "-N")
-- 
1.7.9

[-- Attachment #1.2: Type: text/html, Size: 1741 bytes --]

[-- Attachment #2: 0001-ob-sql.el-Add-support-for-sqlcmd.patch --]
[-- Type: application/octet-stream, Size: 1204 bytes --]

From f26188c0f42002867d0338e2be949146a2e974b7 Mon Sep 17 00:00:00 2001
From: Jonathan Leech-Pepin <jonathan.leechpepin@gmail.com>
Date: Thu, 4 Sep 2014 08:44:47 -0400
Subject: [PATCH] ob-sql.el: Add support for sqlcmd

* lisp/ob-sql.el (org-babel-execute:sql): Add support for sqlcmd on
  Windows.  This is a replacement for osql.
---
 lisp/ob-sql.el |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 7b85df8..e96d55d 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -116,6 +116,12 @@ This function is called by `org-babel-execute-src-block'."
                                      (or cmdline "")
                                      (org-babel-process-file-name in-file)
                                      (org-babel-process-file-name out-file)))
+		    ('mssqlcmd (format "sqlcmd %s -S %s -s \"\t\" -i %s -o %s"
+				    (or cmdline "")
+				    dbhost
+				    (org-babel-process-file-name in-file)
+				    (org-babel-process-file-name
+				     out-file)))
                     ('mysql (format "mysql %s %s %s < %s > %s"
 				    (dbstring-mysql dbhost dbuser dbpassword database)
 				    (if colnames-p "" "-N")
-- 
1.7.9


                 reply	other threads:[~2014-09-04 12:50 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.orgmode.org/

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

  git send-email \
    --in-reply-to=CAEWDx5eJnC8DMsF-LJcT4U-2nJLR8fv9zDdHtc4aG-FA8-UHpg@mail.gmail.com \
    --to=jonathan.leechpepin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).