emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] Add support for :dbhost, :dbuser and :database parameter


From: Nicolas Goaziou
Subject: Re: [O] [PATCH] Add support for :dbhost, :dbuser and :database parameters for poastgresql in ob-sql.el
Date: Sat, 20 Sep 2014 14:16:40 +0200

Hello,

Steven Rémot <address@hidden> writes:

> This patch adds support for :dbhost, :dbuser and :database parameters
> for SQL code blocks that uses postgresql engine. This allows to
> abstract postgresql login details instead of sending parameters in
> a psql-specific format using :cmdline argument.

Thanks for your patch. Some comments below.

> * lisp/ob-sql.el: Add support for :dbhost, :dbuser and :database
>   parameters in sql code blocks for postgresql engine.

It should be

  * lisp/ob-sql.el (dbstring-postgresql): New function
  (org-babel-execute:sql): Use new function.

> +(defun dbstring-postgresql (host user database)
> +  "Make PostgreSQL command line ards for database connection.
                                   ^^^^
                                   args

> +Pass nil to omit that arg."
> +  (combine-and-quote-strings
> +   (remq nil
> +      (list (when host (concat "-h" host))
> +            (when user (concat "-U" user))
> +            (when database (concat "-d" database))))))
> +

This is not related to your patch, but while you're at it, use `delq'
instead of `remq' (nitpick) and `dbstring-postgresql' needs to be
renamed `org-babel-sql-dbstring-postgresql' or some such.


Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]