From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gary Oberbrunner Subject: Re: patch for ob-sql.el: improve MySQL header formatting, and add db spec header vars Date: Fri, 1 Feb 2013 13:57:46 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=e89a8fb2024aaf676904d4ae5150 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:40285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1Lrg-0002I1-89 for emacs-orgmode@gnu.org; Fri, 01 Feb 2013 14:05:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U1Lo4-0002iS-C6 for emacs-orgmode@gnu.org; Fri, 01 Feb 2013 14:01:32 -0500 Received: from mail-oa0-f42.google.com ([209.85.219.42]:38108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1Lo4-0002hB-4T for emacs-orgmode@gnu.org; Fri, 01 Feb 2013 13:57:48 -0500 Received: by mail-oa0-f42.google.com with SMTP id i18so4352312oag.29 for ; Fri, 01 Feb 2013 10:57:46 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Orgmode Mailing List --e89a8fb2024aaf676904d4ae5150 Content-Type: multipart/alternative; boundary=e89a8fb2024aaf676104d4ae514e --e89a8fb2024aaf676104d4ae514e Content-Type: text/plain; charset=ISO-8859-1 Here's a better version of this patch, which also adds support for :colnames, which I needed. And it adds some doc about what header args are used. * add a header-row delimiter to the tables returned from mysql * adds new sql-specific header args for the database connection, and implements them for mysql * adds support for :colnames (mysql only) * (minor) adds an edebug spec to org-babel-result-cond to allow edebugging through it On Fri, Feb 1, 2013 at 10:18 AM, Gary Oberbrunner wrote: > Let me know if this would be better as a pull request. This patch does > three things: > > * add a header-row delimiter to the tables returned from mysql > * adds new sql-specific header args for the database connection, and > implements them for mysql > * (minor) adds an edebug spec to org-babel-result-cond to allow > edebugging through it > > -- > Gary > -- Gary --e89a8fb2024aaf676104d4ae514e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Here's a better version of this patch, which also adds= support for :colnames, which I needed. =A0And it adds some doc about what = header args are used.

=A0* add a header-row delimiter to the tables returned from mysql
=
=A0* adds new sq= l-specific header args for the database connection, and implements them for= mysql
=A0* adds suppor= t for :colnames (mysql only)
=A0* (minor) adds an edebug spec to org-babel-result-cond= to allow edebugging through it

=


On Fri,= Feb 1, 2013 at 10:18 AM, Gary Oberbrunner <garyo@oberbrunner.com&= gt; wrote:
Let me know if this would b= e better as a pull request. =A0This patch does three things:

=
=A0* add a header-row delimiter to the tables returned from mysql
=
=A0* adds new sql-specific header args for the database connection, an= d implements them for mysql
=A0* (minor) adds an edebug spec to org-babel-result-cond to allow ede= bugging through it

--
Gary



--
Gary
--e89a8fb2024aaf676104d4ae514e-- --e89a8fb2024aaf676904d4ae5150 Content-Type: application/octet-stream; name="org-mode-sql-2.patch" Content-Disposition: attachment; filename="org-mode-sql-2.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hcnp2xbd1 ZGlmZiAtLWdpdCBhL2xpc3Avb2ItY29yZS5lbCBiL2xpc3Avb2ItY29yZS5lbAppbmRleCBiZGY4 YzU0Li4xYTQyOTY1IDEwMDY0NAotLS0gYS9saXNwL29iLWNvcmUuZWwKKysrIGIvbGlzcC9vYi1j b3JlLmVsCkBAIC0yNTg1LDcgKzI1ODUsOCBAQCBFbWFjcyBzaHV0ZG93bi4iKSkKIAogKGRlZm1h Y3JvIG9yZy1iYWJlbC1yZXN1bHQtY29uZCAocmVzdWx0LXBhcmFtcyBzY2FsYXItZm9ybSAmcmVz dCB0YWJsZS1mb3JtcykKICAgIkNhbGwgdGhlIGNvZGUgdG8gcGFyc2UgcmF3IHN0cmluZyByZXN1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BwYXJh bXMpKSkKKyAgICAgICAgIChkYXRhYmFzZSAoY2RyIChhc3NvYyA6ZGF0YWJhc2UgcGFyYW1zKSkp CiAgICAgICAgICAoZW5naW5lIChjZHIgKGFzc29jIDplbmdpbmUgcGFyYW1zKSkpCisgICAgICAg ICAoY29sbmFtZXMtcCAobm90IChlcXVhbCAibm8iIChjZHIgKGFzc29jIDpjb2xuYW1lcyBwYXJh bXMpKSkpKQogICAgICAgICAgKGluLWZpbGUgKG9yZy1iYWJlbC10ZW1wLWZpbGUgInNxbC1pbi0i KSkKICAgICAgICAgIChvdXQtZmlsZSAob3IgKGNkciAoYXNzb2MgOm91dC1maWxlIHBhcmFtcykp CiAgICAgICAgICAgICAgICAgICAgICAgIChvcmctYmFiZWwtdGVtcC1maWxlICJzcWwtb3V0LSIp KSkKQEAgLTg1LDcgKzExNiw5IEBAIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGJ5IGBvcmctYmFi ZWwtZXhlY3V0ZS1zcmMtYmxvY2snLiIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAob3IgY21kbGluZSAiIikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAob3JnLWJhYmVsLXByb2Nlc3MtZmlsZS1uYW1lIGluLWZpbGUpCiAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgKG9yZy1iYWJlbC1wcm9jZXNzLWZpbGUtbmFtZSBvdXQtZmls ZSkpKQotICAgICAgICAgICAgICAgICAgICAoJ215c3FsIChmb3JtYXQgIm15c3FsICVzIDwgJXMg PiAlcyIKKyAgICAgICAgICAgICAgICAgICAgKCdteXNxbCAoZm9ybWF0ICJteXNxbCAlcyAlcyAl cyA8ICVzID4gJXMiCisJCQkJICAgIChkYnN0cmluZy1teXNxbCBkYmhvc3QgZGJ1c2VyIGRicGFz c3dvcmQgZGF0YWJhc2UpCisJCQkJICAgIChpZiBjb2xuYW1lcy1wICIiICItTiIpCiAgICAgICA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bXlzcWwKKwkgICA7OyBhZGQgaGVhZGVyIHJvdyBkZWxpbWl0ZXIg YWZ0ZXIgY29sdW1uLW5hbWVzIGhlYWRlciBpbiBmaXJzdCBsaW5lCisJICAgKGNvbmQKKwkgICAg KGNvbG5hbWVzLXAKKwkgICAgICh3aXRoLXRlbXAtYnVmZmVyCisJICAgICAgIChpbnNlcnQtZmls ZS1jb250ZW50cyBvdXQtZmlsZSkKKwkgICAgICAgKGdvdG8tY2hhciAocG9pbnQtbWluKSkKKwkg ICAgICAgKGZvcndhcmQtbGluZSAxKQorCSAgICAgICAoaW5zZXJ0ICItXG4iKQorCSAgICAgICAo c2V0cSBoZWFkZXItZGVsaW0gIi0iKQorCSAgICAgICAod3JpdGUtZmlsZSBvdXQtZmlsZSkKKwkg ICAgICAgKSkpKQorCSAgKHQKKwkgICA7OyBuZWVkIHRvIGZpZ3VyZSBvdXQgd2hhdCB0aGUgZGVs aW1pdGVyIGlzIGZvciB0aGUgaGVhZGVyIHJvdworCSAgICh3aXRoLXRlbXAtYnVmZmVyCisJICAg ICAoaW5zZXJ0LWZpbGUtY29udGVudHMgb3V0LWZpbGUpCisJICAgICAoZ290by1jaGFyIChwb2lu dC1taW4pKQorCSAgICAgKHdoZW4gKHJlLXNlYXJjaC1mb3J3YXJkICJeXFwoLStcXClbXi1dIiBu aWwgdCkKKwkgICAgICAgKHNldHEgaGVhZGVyLWRlbGltIChtYXRjaC1zdHJpbmctbm8tcHJvcGVy dGllcyAxKSkpCisJICAgICAoZ290by1jaGFyIChwb2ludC1tYXgpKQorCSAgICAgKGZvcndhcmQt Y2hhciAtMSkKKwkgICAgICh3aGlsZSAobG9va2luZy1hdCAiXG4iKQorCSAgICAgICAoZGVsZXRl LWNoYXIgMSkKKwkgICAgICAgKGdvdG8tY2hhciAocG9pbnQtbWF4KSkKKwkgICAgICAgKGZvcndh cmQtY2hhciAtMSkpCisJICAgICAod3JpdGUtZmlsZSBvdXQtZmlsZSkpKQorCSAgKQogCShvcmct dGFibGUtaW1wb3J0IG91dC1maWxlICcoMTYpKQogCShvcmctYmFiZWwtcmVhc3NlbWJsZS10YWJs ZQogCSAobWFwY2FyIChsYW1iZGEgKHgpCg== --e89a8fb2024aaf676904d4ae5150--