From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/87580 Path: news.gmane.org!not-for-mail From: Matt Baker Newsgroups: gmane.comp.tex.context Subject: LuaTeX/ConTeXt connect to SQL Server Date: Mon, 26 May 2014 10:38:59 -0600 Message-ID: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1173946556==" X-Trace: ger.gmane.org 1401122364 3245 80.91.229.3 (26 May 2014 16:39:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 May 2014 16:39:24 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Mon May 26 18:39:18 2014 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Woxvh-0006PJ-IE for gctc-ntg-context-518@m.gmane.org; Mon, 26 May 2014 18:39:17 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 162EE1024E for ; Mon, 26 May 2014 18:39:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jHljkjJoPZKI for ; Mon, 26 May 2014 18:39:16 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 6E99A101FE for ; Mon, 26 May 2014 18:39:12 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E948D101E7 for ; Mon, 26 May 2014 18:39:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id zTGJt9fDCaCC for ; Mon, 26 May 2014 18:39:07 +0200 (CEST) Original-Received: from filter4-ams.mf.surf.net (filter4-ams.mf.surf.net [192.87.102.72]) by balder.ntg.nl (Postfix) with ESMTP id 75891101E6 for ; Mon, 26 May 2014 18:39:02 +0200 (CEST) Original-Received: from mail-ig0-x234.google.com (mail-ig0-x234.google.com [IPv6:2607:f8b0:4001:c05::234]) by filter4-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id s4QH1wJk005298 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Mon, 26 May 2014 19:01:59 +0200 Original-Received: by mail-ig0-f180.google.com with SMTP id c1so162949igq.1 for ; Mon, 26 May 2014 09:39:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=MiOWE71xEKvogGOngEVw6teBJ4hWYnRnzlNVwvmmI3w=; b=wtneGEMM/Wl5F1OybMiBDH5hXsFHS4/E2MCOaYuEDD53I1mR775HvVAL0MTv/MK/hP YL5D4tNoHBGszHEw8isVIaHV+gNTJDClypymR1KDKwYXW+nc79qH8vtj9hLKKRV3WgzC QKZpE+pfaP1EQF9QtC1TXy4gZYeTfsm5y5K8FsILrnzrsiYktP37Vb9H5IxZoIhbdNt4 Ufu5PfMpjnN1b1FaXREcZetm3umM+5OUOgieWXmoU5zxWr2MKTJglbuDYBic1b9ijfbQ BmWyJPeY1YS99AGpkVp7g4gYzfSdWmzLHKdmKdC8ORXqjxH9JoJmJxyKGa+/Xs8jA+FW 1zDw== X-Received: by 10.42.202.70 with SMTP id fd6mr23322357icb.47.1401122339725; Mon, 26 May 2014 09:38:59 -0700 (PDT) Original-Received: by 10.42.97.69 with HTTP; Mon, 26 May 2014 09:38:59 -0700 (PDT) X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=2607:f8b0:4001:c05::234; country=US X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 01M6F1Xb7 - 55bbd348feae - 20140526 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:87580 Archived-At: --===============1173946556== Content-Type: multipart/alternative; boundary=20cf301af82f58a7ce04fa503773 --20cf301af82f58a7ce04fa503773 Content-Type: text/plain; charset=UTF-8 FROM MY POSTING AT: http://tex.stackexchange.com/questions/180018/luatex-context-connect-to-sql-server?noredirect=1#comment415824_180018 I am looking to connect ConTeXt to a SQL Server database. I have looked through the manuals, and even read pragma-ade's SQL PDF (which, for me, seems a bit abstract). I am not extremely familiar with Lua but have read up on the language (I am more familiar with JS). For LaTex I used nlatexdb which did the trick, but LaTex isn't able to do what ConTeXt can. - The connection needs to use Windows Authentication. - The document is set up as a letter with an environment that it pulls from. - It would be preferable to have the connection and queries be seperate from the letter itself, and be able to place variables into the letter that can be populated through the queries (much like nlatexdb) if possible. - example: Dear ??first ??last, Thank you for your interest in ??product... etc. I am rather new to ConText and just starting to get the hang of it, long time latex user, the transition starts off rather confusing, but once it makes sense it opens up a whole toolbox of available tools which is great. Just need this one last tool. Any help would be much appreciated. EDIT:: Honestly I haven't gotten to any point that I felt I could attempt trying the connection. Looking at the SQL PDF from pragma-ade it should look something like: local presets = { server = "XXX\XXX", Database = "Customer", Integrated Security = "True", } presets.id = "XXX" local template = [[ SELECT 'Control_Content' FROM 'Customer.dbo.Report_Client_Data' WHERE 'Control_Name' LIKE 'Long_Name' AND 'Client_Id' = 154; ]] local data, keys = utilities.sql.execute { presets = presets, template = template, variables = {}, } I can't seem to find where or how the connection is being made, except perhaps where utilities.sql.execute is called, but I can't find any information anywhere about such a call in lua or context... --20cf301af82f58a7ce04fa503773 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

I am looking to connect ConTeXt to a SQL Server database. I = have looked through the manuals, and even read pragma-ade's SQL PDF (wh= ich, for me, seems a bit abstract). I am not extremely familiar with Lua bu= t have read up on the language (I am more familiar with JS). For LaTex I us= ed nlatexdb which did the trick, but LaTex isn't able to do what ConTeX= t can.

  • The connection needs to use Windows Authentication.

  • =
  • The document is set up as a letter with an environment that = it pulls from.

  • It would be preferable to have the connection and queries be= seperate from the letter itself, and be able to place variables into the l= etter that can be populated through the queries (much like nlatexdb) if pos= sible.

    • examp= le: Dear ??first ??last, Thank you for your interest in ??product... etc.

I am rather new to ConText and just starting = to get the hang of it, long time latex user, the transition starts off rath= er confusing, but once it makes sense it opens up a whole toolbox of availa= ble tools which is great. Just need this one last tool.

Any help would be much appreciated.

EDIT::= Honestly I haven't gotten to any point that I felt I could attempt try= ing the connection. Looking at the SQL PDF from pragma-ade it should look s= omething like:

<=
span style=3D"margin:0px;padding:0px;border:0px;vertical-align:baseline;col=
or:rgb(0,0,0)">    local presets =3D {
    server =3D "XXX<=
/span>\XXX",
    Database =3D "Cu=
stomer",
    Integrated Security =3D}
    presets.id =
=3D "XXX"
    local template =3D [[
    SELECT
    'Control_Content'
    FROM
    'Customer.dbo.Report_Client_Data'
    WHERE
    'Control_Name' LIKE 'Long_Name' AND 'Client_Id'=
 =3D 154;
     ]]

    local data, keys =3D =
utilities.sql.execute {
    presets =3D presets,
    template =3D template=
,
    variables =3D =
{},
    }

I can= 9;t seem to find where or how the connection is being made, except perhaps = where utilities.sql.execute is called, but I can't find any information= anywhere about such a call in lua or context...

--20cf301af82f58a7ce04fa503773-- --===============1173946556== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============1173946556==--