emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Postgresql support for ob-sql.el
@ 2010-09-15 14:02 Harri Kiiskinen
  2010-09-17 17:18 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: Harri Kiiskinen @ 2010-09-15 14:02 UTC (permalink / raw)
  To: emacs-orgmode


[-- 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Postgresql support for ob-sql.el
  2010-09-15 14:02 [PATCH] Postgresql support for ob-sql.el Harri Kiiskinen
@ 2010-09-17 17:18 ` Eric Schulte
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2010-09-17 17:18 UTC (permalink / raw)
  To: Harri Kiiskinen; +Cc: emacs-orgmode

Thanks Harri!

I've just applied this patch to the repository.

If you think you'll want to contribute patches longer than 10 lines
please consider the FSF assignment process described at
http://orgmode.org/worg/org-contribute.php

Thanks -- Eric

Harri Kiiskinen <harri.kiiskinen@utu.fi> writes:

> 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
>
> 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)))
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-17 17:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-15 14:02 [PATCH] Postgresql support for ob-sql.el Harri Kiiskinen
2010-09-17 17:18 ` Eric Schulte

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).