Nicolas Goaziou writes: > Hello, > > Saulius Menkevičius writes: > >> This (tiny) patch implements ability to set dbport for org-babel sql >> functionality. I often use ssh port forwarding to connect to remote >> mysql servers where port is mapped to non-standard one on local >> machine. > > Thank you. > >> This is my first patch, below the 15 line threshold. >> >> From ca3f85877bdf406deefaf66cbac3483a7e41f134 Mon Sep 17 00:00:00 2001 >> From: =?UTF-8?q?Saulius=20Menkevi=C4=8Dius?= >> Date: Mon, 6 Apr 2015 23:13:06 +0300 >> Subject: [PATCH] ob-sql: Add possibility to set dbport >> >> * lisp/ob-sql.el: will now recognize dbport parameter. Currently it >> is supported for mysql engine only. > > You need to also specify what functions are modified, e.g., > > * lisp/ob-sql.el (org-babel-sql-dbstring-mysql): Change signature. Done. > >> +(defun org-babel-sql-dbstring-mysql (host port user password database) >> "Make MySQL cmd line args for database connection. Pass nil to omit that arg." >> (combine-and-quote-strings >> (delq nil >> (list (when host (concat "-h" host)) >> + (when port (concat "-P" (number-to-string port))) > > Isn't PORT a string already? Apparently it is not a string. I don't know the internal machinery for #+header parameters in org-mode/babel, but apparently number-to-string is required, otherwise I get the "progn: Wrong type argument: sequencep, 33060" error. Where 33060 is my port number from the :dbport param. > >> (dbhost (cdr (assoc :dbhost params))) >> + (dbport (cdr (assoc :dbport params))) > > Nitpick: `assoc' -> `assq' Ok. I did not know much of elisp to decide on which one to. This was copy-paste code from previous line, sorry. Updated patch is attached to this mail.