From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/87567 Path: news.gmane.org!not-for-mail From: Matt Baker Newsgroups: gmane.comp.tex.context Subject: LuaTeX/ConTeXt connect to SQL Server Date: Fri, 23 May 2014 13:47:07 -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="===============1598372489==" X-Trace: ger.gmane.org 1401089342 4920 80.91.229.3 (26 May 2014 07:29:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 May 2014 07:29:02 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Mon May 26 09:28:56 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 1WopL6-0004cU-CE for gctc-ntg-context-518@m.gmane.org; Mon, 26 May 2014 09:28:56 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id C3CD710273 for ; Mon, 26 May 2014 09:28:55 +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 7DZD4gNCxOIu for ; Mon, 26 May 2014 09:28:55 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 13D4810234 for ; Mon, 26 May 2014 09:28:50 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 648B8101E8 for ; Fri, 23 May 2014 21:47:20 +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 ovqt4edZJYHi for ; Fri, 23 May 2014 21:47:18 +0200 (CEST) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id 71C46101E3 for ; Fri, 23 May 2014 21:47:10 +0200 (CEST) Original-Received: from mail-ig0-x235.google.com (mail-ig0-x235.google.com [IPv6:2607:f8b0:4001:c05::235]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id s4NJl85Z027142 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Fri, 23 May 2014 21:47:09 +0200 Original-Received: by mail-ig0-f181.google.com with SMTP id h3so1122400igd.14 for ; Fri, 23 May 2014 12:47:07 -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=7hLj1MnOIJR+VYqdzu+P1NOQmNvrjp+V8sBgHdFBXbY=; b=sJS9s7jl9kALi8CIOCSiailCvGK1ydcfMui9sqiZgqNbx6EljvmwpTFg67uszscVCb jTSAHWdupexEm5HPXd4pSZAgoOsvSSe66Iys3LL61KjIiO80kxUQZp6+0o0zrvsiylII j8SdL6go5JV77D+xzEmM837t+HB4P8lJ3HDZcPTwZ5qh0we6K22f+oweFAkFUopNIcrO CTo/KBQzppYXgC7cmhcyQc1pbLOxKr8T3+6Oc6BxcyQVxVNQ93mqfGW2sxj+H9q8Nskw 37F+PJznkZ+vYv5MOAFv8MtZZmLbbPL254L+r2pvvhUGNXQyWwsIDjOGUkyUwVdXJK5O uTSw== X-Received: by 10.43.151.209 with SMTP id kt17mr7085178icc.2.1400874427700; Fri, 23 May 2014 12:47:07 -0700 (PDT) Original-Received: by 10.42.97.69 with HTTP; Fri, 23 May 2014 12:47:07 -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::235; country=US X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 03M5vL9hv - 226457ce486c - 20140523 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-Mailman-Approved-At: Mon, 26 May 2014 09:28:46 +0200 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:87567 Archived-At: --===============1598372489== Content-Type: multipart/alternative; boundary=001a11c2d48ea358c904fa167e9b --001a11c2d48ea358c904fa167e9b 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... --001a11c2d48ea358c904fa167e9b 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 class=3D"" style=3D"margin:0px;padding:0px;border:0px;vertical-align:b=
aseline;color:rgb(0,0,0)">    local presets =3D {
    server =3D "XXX\XXX",
    Database =3D "Customer",
    Integrated Security =3D "True",
    }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'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 inf= ormation anywhere about such a call in lua or context...

--001a11c2d48ea358c904fa167e9b-- --===============1598372489== 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 ___________________________________________________________________________________ --===============1598372489==--