* lisp/ob-sql.el: Add a database type 'oracle that uses sqlplus to
support running SQL blocks against an Oracle database.
Use with properties like this (all mandatory):
:engine oracle :dbhost <host.com> :dbport <1521> :dbuser <username>
:database <database> :dbpassword <secret>
TINYCHANGE
Add changes from Emacs repo that should have been backported with
bb77dd2.
Update copyright year to 2015
7e09ef09a479731d01b1ca46e94ddadd73ac98e3
Paul Eggert
Thu Jan 1 14:26:41 2015 -0800
* lisp/ob-sql.el (org-babel-sql-dbstring-mysql): Change type
signature to accept server port number too.
(org-babel-execute:sql) Will now recognize the dbport parameter.
Passed to `org-babel-sql-dbstring-mysql' only for now.
TINYCHANGE
* lisp/ob-sql.el (dbstring-mysql): Rename function and tweak a bit its
implementation
(org-babel-execute:sql): Use new function name
Prefix `dbstring-mysql' function with the namespace "org-babel-sql" to
avoid name collisions.
Also replace the call to `remq' by `delq' because it is a bit more
efficient, and also to be consistent with
`org-babel-sql-dbstring-postgresql'.
* lisp/ob-sql.el (org-babel-sql-dbstring-postgresql): New function
(org-babel-execute:sql): Use new function.
Before this patch, it was necessary to use :cmdline parameter to
specify host, user and database different the the default ones. Now,
this can be done using parameters that are independents of the engine
used.
This is not trivial (and not recommended) to pass password as a
command line argument to psql, so :dbpassword is not supported.
* lisp/ob-sql.el (org-babel-execute:sql): Unquote cmdline argument in
format string, dbish requires three separate arguments. Add dbi to
the list of engines with automatically added header separator.
* add a header-row delimiter to the tables returned from mysql
* add new sql-specific header args for the database connection, and implements them for mysql
* add support for :colnames (mysql only)
* (minor) add an edebug spec to org-babel-result-cond to allow edebugging through it
* add some doc about what header args are used
* lisp/ob.el (org-babel-result-cond): This function should now be used
by all language backends to handle the processing of raw code block
output into scalar results, table results, or ignored results
depending on the value of result-params.
* lisp/ob-C.el (org-babel-C-execute): Use org-babel-result-cond.
* lisp/ob-R.el (org-babel-R-evaluate-external-process): Use
org-babel-result-cond.
(org-babel-R-evaluate-session): Use org-babel-result-cond.
* lisp/ob-awk.el (org-babel-execute:awk): Use org-babel-result-cond.
* lisp/ob-clojure.el (org-babel-execute:clojure): Use
org-babel-result-cond.
* lisp/ob-emacs-lisp.el (org-babel-execute:emacs-lisp): Use
org-babel-result-cond.
* lisp/ob-fortran.el (org-babel-execute:fortran): Use
org-babel-result-cond.
* lisp/ob-io.el (org-babel-io-evaluate): Use org-babel-result-cond.
* lisp/ob-java.el (org-babel-execute:java): Use org-babel-result-cond.
* lisp/ob-lisp.el (org-babel-execute:lisp): Use org-babel-result-cond.
* lisp/ob-maxima.el (org-babel-execute:maxima): Use
org-babel-result-cond.
* lisp/ob-picolisp.el (org-babel-execute:picolisp): Use
org-babel-result-cond.
* lisp/ob-python.el (org-babel-python-evaluate-external-process): Use
org-babel-result-cond.
(org-babel-python-evaluate-session): Use org-babel-result-cond.
* lisp/ob-scala.el (org-babel-scala-evaluate): Use org-babel-result-cond.
* lisp/ob-sh.el (org-babel-sh-evaluate): Use org-babel-result-cond.
* lisp/ob-shen.el (org-babel-execute:shen): Use org-babel-result-cond.
* lisp/ob-sql.el (org-babel-execute:sql): Use org-babel-result-cond.
* lisp/ob-sqlite.el (org-babel-execute:sqlite): Use
org-babel-result-cond.
I started from the 78ec8e commit then cherry-picked and squashed
commits that have been done in master since then, except the bad
commits that overwrote the tree (in master) with the tree in maint.
This commit also bumps the version number to 7.8.06.
The only "fix" that was made between 78ec8e and the previous commit
is e0072f which has been reported to break stuff.
This fixes a wrong merge that should not have happened:
commit 7e903a merges the master branch into the maint branch,
while we really want to keep the maint branch a bugfix-only
branch.
This commit reverts back the maint branch to its state before
merging the master branch. From there, we will fix remaining
problems with the maint branch (e.g. copyright issues) then
release this maint branch as Org-mode 7.8.05.
* lisp/ob-sql.el(org-babel-execute:sql): Add support for MonetDB to
SQL code blocks.
Hi,
the attached patch adds support for evaluating SQL blocks on MonetDB.
The MonetDB client normally requires the password to be inputted on the
console. To get around this, you have to use a dotfile ~/.monetdb with
authentification data. Note that this file is ignored if you specify a
user on the cmdline. See
http://www.monetdb.org/Documentation/mclient-man-page for details.
A usage example follows.
Setup MonetDB test database and authentification data
#+BEGIN_SRC sh :results output verbatim
MONETDB_DIR=$HOME/unix/var/monetdb/demodb
monetdbd create $MONETDB_DIR
monetdbd start $MONETDB_DIR
monetdb create demodb
monetdb release demodb
cat > ~/.monetdb <<EOF
user=monetdb
password=monetdb
EOF
#+END_SRC
#+RESULTS:
: created database in maintenance mode: demodb
: taken database out of maintenance mode: demodb
Data is returned without column names (the default return format
cannot be parsed by Babel).
#+BEGIN_SRC sql :engine monetdb :cmdline demodb
CREATE TABLE foo ( bar INTEGER );
SELECT 'Table count', count(*) FROM foo;
#+END_SRC
#+RESULTS:
| Table count | 0 |
The parameter "-i" is required on the command line in order to use
special client commands. Also note that a newline is required at the
end if the last line contains a special client command.
#+BEGIN_SRC sql :engine monetdb :cmdline demodb -i :results output
verbatim
\d
\?
#+END_SRC
#+RESULTS:
#+begin_example
TABLE sys.foo
\? - show this message
\<file - read input from file
\>file - save response in file, or stdout if no file is given
\|cmd - pipe result to process, or stop when no command is given
\h - show the readline history
\D table- dumps the table, or the complete database if none given.
\d[Stvsfn]+ [obj] - list database objects, or describe if obj given
\A - enable auto commit
\a - disable auto commit
\e - echo the query in sql formatting mode
\f - format using a built-in renderer {csv,tab,raw,sql,xml}
\w# - set maximal page width (-1=unlimited, 0=terminal width,
>0=limit to num)
\r# - set maximum rows per page (-1=raw)
\L file - save client/server interaction
\X - trace mclient code
\q - terminate session
#+end_example
Have fun!
Also remove blank lines before the ";;; org*el ends here" declarations.
Having a "Version" header forced us to update every file when releasing a
new version of Org; it also forced us to update every file when merging Org
with Emacs trunk, thus cluttering the diffs between the previously merged
version and the new one with useless information.
Glenn Morris suggested this in emacs-devel:
http://lists.gnu.org/archive/html/emacs-devel/2011-08/msg00322.html