From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xi Shen Subject: Re: [PATCH] ob-sql.el: Support sqlcmd and cygwin environment Date: Thu, 16 Jun 2016 06:04:26 +0000 Message-ID: References: <87r3c4em1r.fsf@saiph.selenimh> <87a8isdso8.fsf@saiph.selenimh> <87vb1c0yyn.fsf@saiph.selenimh> <87inxaz9b9.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=001a113cecce3a85dc05355f03c7 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDQPu-0006Q9-AE for Emacs-orgmode@gnu.org; Thu, 16 Jun 2016 02:04:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDQPs-00013f-Sw for Emacs-orgmode@gnu.org; Thu, 16 Jun 2016 02:04:38 -0400 Received: from mail-oi0-x236.google.com ([2607:f8b0:4003:c06::236]:35102) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDQPs-00013a-L0 for Emacs-orgmode@gnu.org; Thu, 16 Jun 2016 02:04:36 -0400 Received: by mail-oi0-x236.google.com with SMTP id w5so53998470oib.2 for ; Wed, 15 Jun 2016 23:04:36 -0700 (PDT) In-Reply-To: <87inxaz9b9.fsf@saiph.selenimh> 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" To: "Emacs-orgmode@gnu.org" --001a113cecce3a85dc05355f03c7 Content-Type: multipart/alternative; boundary=001a113cecce3a85d605355f03c5 --001a113cecce3a85d605355f03c5 Content-Type: text/plain; charset=UTF-8 Hi Nicolas, Please take a look at the updated patch. Changes: - add ORG-NEWS entry - add function declaration - add input file template for `mssql' engine to remove the "affected rows" tail On Thu, Jun 16, 2016 at 12:49 AM Nicolas Goaziou wrote: > Hello, > > Xi Shen writes: > > > I suppose I should put the news entry to ./etc/ORG-NEWS file, but into > > which version? I created below entry, please take look and let me know > > where do you want me to put it. > > I'd say > > Version 9.0 > New features > Babel > > or > > Version 9.0 > Miscellaneous > > > *** Improved support to Microsoft SQL Server in =ob-sql.el= > > =ob-sql.el= library removes support to the ~msosql~ engine which uses > > the deprecated =osql= command line tool, and replaces it with ~mssql~ > > engine which uses the =sqlcmd= command line tool. Use with properties > > like this: > > > > #+BEGIN_EXAMPLE > > :engine mssql > > :dbhost > > :dbuser > > :dbpassword > > :database > > #+END_EXAMPLE > > > > If you want to use the *trusted connection* feature, omit *both* the > > =dbuser= and =dbpassword= properties and add =cmdline -E= to the > > properties. > > > > If your Emacs is running in a Cygwin environment, the =ob-sql.el= > > library can pass the converted path to the =sqlcmd= tool. > > It looks good. > > > I checked the code and it does not quote the arguments for me. It is a > safe > > manner in Windows to always quote the path. So I will keep it. > > Fair enough. > > > I have a question. Currently the table generated by mssql engine has the > > "affected rows" append to the end, like this. > > > > | memberid | username | xx | flags | > > |-------------------+----------+------+-------| > > | 1 | GPL | Indo | NULL | > > | 2 | GPL | Indo | NULL | > > | | | | | > > | (2 rows affected) | | | | > > > > I personally prefer to remove it. Do you or the org community has a > > preference about this? Maybe I should keep the behavior align with other > > engines? > > I lean towards removing it, too. I doesn't give useful feedback. We can > always insert it back later if it introduces unwanted side-effects. > > > Thank you. > > > Regards, > > -- > Nicolas Goaziou > -- Thanks, David S. --001a113cecce3a85d605355f03c5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Nicolas,

Please take a look at the u= pdated patch. Changes:

- add ORG-NEWS entry
<= div>- add function declaration
- add input file template for `mss= ql' engine to remove the "affected rows" tail

<= br>
On Thu, Jun 16, 2016 at 12:4= 9 AM Nicolas Goaziou <mail@nic= olasgoaziou.fr> wrote:
Hello= ,

Xi Shen <davi= dshen84@gmail.com> writes:

> I suppose I should put the news entry to ./etc/ORG-NEWS file, but into=
> which version? I created below entry, please take look and let me know=
> where do you want me to put it.

I'd say

=C2=A0 Version 9.0 > New features > Babel

or

=C2=A0 Version 9.0 > Miscellaneous

> *** Improved support to Microsoft SQL Server in =3Dob-sql.el=3D
> =3Dob-sql.el=3D library removes support to the ~msosql~ engine which u= ses
> the deprecated =3Dosql=3D command line tool, and replaces it with ~mss= ql~
> engine which uses the =3Dsqlcmd=3D command line tool.=C2=A0 Use with p= roperties
> like this:
>
> #+BEGIN_EXAMPLE
>=C2=A0 :engine mssql
>=C2=A0 :dbhost <host.com>
>=C2=A0 :dbuser <username>
>=C2=A0 :dbpassword <secret>
>=C2=A0 :database <database>
> #+END_EXAMPLE
>
> If you want to use the *trusted connection* feature, omit *both* the > =3Ddbuser=3D and =3Ddbpassword=3D properties and add =3Dcmdline -E=3D = to the
> properties.
>
> If your Emacs is running in a Cygwin environment, the =3Dob-sql.el=3D<= br> > library can pass the converted path to the =3Dsqlcmd=3D tool.

It looks good.

> I checked the code and it does not quote the arguments for me. It is a= safe
> manner in Windows to always quote the path. So I will keep it.

Fair enough.

> I have a question. Currently the table generated by mssql engine has t= he
> "affected rows" append to the end, like this.
>
>=C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 memberid | username | = xx=C2=A0 =C2=A0| flags |
>=C2=A0 =C2=A0|-------------------+----------+------+-------|
>=C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A01 | GPL=C2=A0 =C2=A0 =C2=A0 | Indo | NULL=C2=A0 |
>=C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A02 | GPL=C2=A0 =C2=A0 =C2=A0 | Indo | NULL=C2=A0 |
>=C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 |=C2= =A0 =C2=A0 =C2=A0 =C2=A0|
>=C2=A0 =C2=A0| (2 rows affected) |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |= =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0|
>
> I personally prefer to remove it. Do you or the org community has a > preference about this? Maybe I should keep the behavior align with oth= er
> engines?

I lean towards removing it, too. I doesn't give useful feedback. We can=
always insert it back later if it introduces unwanted side-effects.


Thank you.


Regards,

--
Nicolas Goaziou
--


Thanks,
David S.

--001a113cecce3a85d605355f03c5-- --001a113cecce3a85dc05355f03c7 Content-Type: application/octet-stream; name="0001-ob-sql.el-Support-sqlcmd-in-Cygwin-environment.patch" Content-Disposition: attachment; filename="0001-ob-sql.el-Support-sqlcmd-in-Cygwin-environment.patch" Content-Transfer-Encoding: base64 Content-ID: <15557cca615c42fe9882> X-Attachment-Id: 15557cca615c42fe9882 RnJvbSBlNjg5YmIxN2RjN2Y2NDRmNzFlODg0ZDBiMDYwMTMzNTlkMmY3YTcwIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBYaSBTaGVuIDxkYXZpZHNoZW44NEBnbWFpbC5jb20+CkRhdGU6 IFdlZCwgOCBKdW4gMjAxNiAxMzo0OTo1NCArMDgwMApTdWJqZWN0OiBbUEFUQ0hdIG9iLXNxbC5l bDogU3VwcG9ydCBzcWxjbWQgaW4gQ3lnd2luIGVudmlyb25tZW50CgoqIGV0Yy9PUkctTkVXUzog QWRkICJJbXByb3ZlZCBzdXBwb3J0IHRvIE1pY3Jvc29mdCBTUUwgU2VydmVyIHZpYQogIH5zcWxj bWR+IiBzZWN0aW9uIHRvIGFkZHJlc3NzIHRoaXMgY2hhbmdlLgoKKiBsaXNwL29iLXNxbC5lbCAo b3JnLWJhYmVsLXNxbC1kYnN0cmluZy1tc3NxbCk6IEZ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