emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Harri Kiiskinen <harri.kiiskinen@utu.fi>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Postgresql support for ob-sql.el
Date: Wed, 15 Sep 2010 17:02:02 +0300 (EEST)	[thread overview]
Message-ID: <20100915.170202.401240283.harri.kiiskinen@utu.fi> (raw)


[-- Attachment #1.1.1: Type: Text/Plain, Size: 227 bytes --]

The attaches patch adds support to postgresql to ob-sql.el

It achieves this in the same way the mysql support is done, by using
the psql client with suitable command line arguments.

Best,

Harri Kiiskinen
harkiisk@gmail.com


[-- Attachment #1.1.2: ob-sql.el.diff --]
[-- Type: Text/X-Patch, Size: 661 bytes --]

diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 4e1daa5..2636752 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -66,6 +66,8 @@ This function is called by `org-babel-execute-src-block'."
          (command (case (intern engine)
                     ('mysql (format "mysql %s -e \"source %s\" > %s"
                                     (or cmdline "") in-file out-file))
+		    ('postgresql (format "psql -A -P footer=off -F \"\t\"  -f %s -o %s %s"
+					 in-file out-file (or cmdline "")))
                     (t (error "no support for the %s sql engine" engine)))))
     (with-temp-file in-file
       (insert (org-babel-expand-body:sql body params)))

[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

             reply	other threads:[~2010-09-15 14:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-15 14:02 Harri Kiiskinen [this message]
2010-09-17 17:18 ` [PATCH] Postgresql support for ob-sql.el Eric Schulte

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=20100915.170202.401240283.harri.kiiskinen@utu.fi \
    --to=harri.kiiskinen@utu.fi \
    --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).