From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id mN2gByzWz14GJwAA0tVLHw (envelope-from ) for ; Thu, 28 May 2020 15:18:04 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id qJJOAyzWz14NcgAAbx9fmQ (envelope-from ) for ; Thu, 28 May 2020 15:18:04 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A5C329400C3 for ; Thu, 28 May 2020 15:18:02 +0000 (UTC) Received: from localhost ([::1]:56354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jeKIC-00081G-DB for larch@yhetil.org; Thu, 28 May 2020 11:18:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jeKHa-000819-E3 for emacs-orgmode@gnu.org; Thu, 28 May 2020 11:17:22 -0400 Received: from mout-p-101.mailbox.org ([2001:67c:2050::465:101]:44568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1jeKHY-0000o0-Jo for emacs-orgmode@gnu.org; Thu, 28 May 2020 11:17:22 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 49XrsQ1NnpzKmfS for ; Thu, 28 May 2020 17:17:14 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de [80.241.56.125]) (amavisd-new, port 10030) with ESMTP id xaltORJmq1nu for ; Thu, 28 May 2020 17:17:10 +0200 (CEST) From: Daniel Kraus To: emacs-orgmode@gnu.org Subject: [PATCH] ob-sql: Respect database param when using dbconnection Date: Thu, 28 May 2020 17:17:03 +0200 Message-ID: <87a71s9jio.fsf@kraus.my> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Rspamd-Queue-Id: 12397175C X-Rspamd-Score: -5.45 / 15.00 / 15.00 Received-SPF: none client-ip=2001:67c:2050::465:101; envelope-from=daniel@kraus.my; helo=mout-p-101.mailbox.org X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: REoeKbFiSI+V --=-=-= Content-Type: text/plain Hi, I use ob-sql with the :dbconnection param so I don't have my username and password in my org file. But often I don't want to use the default database from the dbconnection alist but rather specify it explicitly with :database. Attached is a patch that fixes this. Thanks, Daniel --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ob-sql-Respect-database-param-when-using-dbconnectio.patch Content-Description: [PATCH] ob-sql: Respect database param when using dbconnection >From a8dccff104d7426e2f353b1005e0bdcc51de6e99 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Tue, 26 May 2020 16:07:34 +0200 Subject: [PATCH] ob-sql: Respect database param when using dbconnection --- lisp/ob-sql.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el index 7c359b988..d7a8bf0a0 100644 --- a/lisp/ob-sql.el +++ b/lisp/ob-sql.el @@ -191,7 +191,8 @@ then look for the parameter into the corresponding connection defined in `sql-connection-alist`, otherwise look into PARAMS. Look `sql-connection-alist` (part of SQL mode) for how to define database connections." - (if (assq :dbconnection params) + (if (and (assq :dbconnection params) + (not (and (assq :database params) (eq name :database)))) (let* ((dbconnection (cdr (assq :dbconnection params))) (name-mapping '((:dbhost . sql-server) (:dbport . sql-port) -- 2.26.2 --=-=-=--