ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: LaTeXDB equivalent for ConTeXt ?
Date: Thu, 21 Aug 2003 23:37:35 +0200	[thread overview]
Message-ID: <5.2.0.9.1.20030821233546.012afd50@server-1> (raw)
In-Reply-To: <1061379374.23522.7.camel@JBC.yorkref.com>

At 13:36 20/08/2003 +0200, you wrote:
>Hi,
>
>Is there anything like LaTeXDB:
>
><http://privat.hgesser.com/software/latexdb/>
>
>in ConTeXt?
>
>The short story is that LaTeXDB makes it possible to include SQL queries
>in a LaTeX document.

I have played with the following code:

% interface=en output=pdftex

\unprotect

\definesystemvariable{sq}

\def\startSQLquery#1#2\stopSQLquery
   {\setvalue{\??sq:#1}{#2}}

\def\applySQLquery#1% last line is quit without ;
   {\bgroup
    \def\\{\rawcharacter{`\\}}%
    \long\def\next##1;##2%
      {\ifx##2\empty
         \immediate\write\scratchwrite{##1}%
         \@EA\gobbleuntil\@EA\relax
       \else
         \immediate\write\scratchwrite{##1;}%
         \@EA\next
       \fi##2}%
    \immediate\openout\scratchwrite=\bufferprefix\jobname-sql.sql
    \@EAEAEA\next\csname\??sq:#1\endcsname\empty\empty;\empty\relax
    \immediate\closeout\scratchwrite
    \executeSQLcommand
      {\bufferprefix\jobname-sql.sql}%
      {\bufferprefix\jobname-sql.log}%
    \egroup}

\def\executeSQLcommand#1#2%
% {\executesystemcommand{c:/mysql/bin/mysql.exe < #1 > #2}}
   {\executesystemcommand{c:/mysql/bin/mysqldump.exe  -r #2 < #1}}

\protect % \endinput

\starttext

\startSQLquery{test}
   connect cod ;
%  select leerling into outfile "e:/tmp/test.tmp" from ws_p ;
%select data into outfile "e:/tmp/test.tmp"
select data from ws_p ;
   quit
\stopSQLquery

\applySQLquery{test}

\typefile{e:/tmp/test.tmp}

\stoptext

t
There have been discussions of extending the (fptex) url input file support 
with something that could talk to ports (services) ... maybe its time to 
pick up that thread.

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

  reply	other threads:[~2003-08-21 21:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-20 11:36 Jules Colding
2003-08-21 21:37 ` Hans Hagen [this message]
2003-08-22  9:01   ` Jules Colding
2003-08-22 21:09   ` Jules Colding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5.2.0.9.1.20030821233546.012afd50@server-1 \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).