all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [BUG] ob-sql sql-connection-alist
@ 2023-01-15 16:00 Andreas Gerler
  2023-01-16 10:25 ` Daniel Kraus
  2023-01-16 10:33 ` Ihor Radchenko
  0 siblings, 2 replies; 18+ messages in thread
From: Andreas Gerler @ 2023-01-15 16:00 UTC (permalink / raw)
  To: emacs-orgmode


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

HI!

Last week I heard about using ob-sql with credentials stored in the variable used by isql.
However I had to modify ob-sql to get it actually working.
Can somebody test the pach before I send in a commit?

#+begin_src sql :engine mysql :dbconnection testdb
show tables;
#+end_src

(setq sql-connection-alist
      '((testdb (sql-product 'mysql)
                (sql-server "127.0.0.1")
                (sql-user "mysql”)
                (sql-port 3306)
                (sql-password “foo")
                (sql-database "mysql"))))

I was considering writing another patch to map the sql-product to engine.
That way we could get rid of another parameter in the src block.
Opinions?


[-- Attachment #1.2: ob-sql.el.diff --]
[-- Type: application/octet-stream, Size: 882 bytes --]

diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 39a4573a5..92a157085 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -1,6 +1,6 @@
 ;;; ob-sql.el --- Babel Functions for SQL            -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2023 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Maintainer: Daniel Kraus <daniel@kraus.my>
@@ -234,7 +234,7 @@ database connections."
                                   (:database . sql-database)))
                   (mapped-name (cdr (assq name name-mapping))))
              (cadr (assq mapped-name
-                         (cdr (assoc dbconnection sql-connection-alist))))))))
+                         (cdr (assoc-string dbconnection sql-connection-alist t))))))))
 
 (defun org-babel-execute:sql (body params)
   "Execute a block of Sql code with Babel.

[-- Attachment #1.3: Type: text/plain, Size: 102 bytes --]




Thanks in advance…


Andreas Gerler

—

http://www.bundesbrandschatzamt.de/~baron


[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 874 bytes --]

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

end of thread, other threads:[~2023-01-30 17:04 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-15 16:00 [BUG] ob-sql sql-connection-alist Andreas Gerler
2023-01-16 10:25 ` Daniel Kraus
2023-01-20 17:24   ` Andreas Gerler
2023-01-20 17:30     ` Andreas Gerler
2023-01-20 20:41       ` Daniel Kraus
2023-01-20 21:03         ` Andreas Gerler
2023-01-21  8:48         ` Ihor Radchenko
2023-01-21 12:15           ` Andreas Gerler
2023-01-22 10:58           ` Bastien Guerry
2023-01-26 10:44           ` Bastien Guerry
2023-01-27 13:13             ` Ihor Radchenko
2023-01-27 13:18             ` Ihor Radchenko
2023-01-27 16:58               ` Andreas Gerler
2023-01-28 14:13                 ` Andreas Gerler
2023-01-30 16:59                   ` Daniel Kraus
2023-01-16 10:33 ` Ihor Radchenko
2023-01-16 10:45   ` Daniel Kraus
2023-01-16 11:05     ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.