Hello, I'm new user of ConTeXt (for one week) and I would like to connect ConTeXt with a database(Oracle, PostegreSQL, MySQL...). Is it possible or must I write a PERL script to export datas in XML files ? I found this in mail archive : \startSQL my_query \stopSQL but I don't know how to use this (how to use the result of the query, where I write database connection's parameters...). Do you know where can I find a manual or any help? Thanks in advance, P.S. : I'm French and my English isn't very good. I'm sorry about this. Frederic Leguedois ########################################### This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange. For more information, connect to http://www.F-Secure.com/
Hi, What you are asking for (MySQL I/O) cannot be done. The context command you refer to intended solely for syntax highlighting of SQL statements. However, you got me thinking. :) See attached context module and test file. It's extremely crude and more of a proof of concept than a full module, but it seems to work OK on the simple tests I threw at it. All of the commands and macros it provides are in the demonstration file. Stuff to keep in mind: - \write18 had better be enabled - the statement is fed to a 'mysql' in batchmode during \MySQLexecute - The result is saved to a file named \jobname-[Queryname]-result.dat - You always have to re-execute before you attempt to process the the results - The 'Countexecutable' is supposed to return a single line that starts with the number of lines of the \jobname-[Queryname]-result.dat file. - No error checking whatsoever is done. Spefically, nothing is done about MySQL's output format, so you can expect problems with embedded newlines and other specials characters The module is a joke, ok? But a fun one :-) Greetings, Taco On Wed, 23 Apr 2003 20:55:16 +0200, LEGUEDOIS, wrote:
but I don't know how to use this (how to use the result of the query, where I write database connection's parameters...). Do you know where can I find a manual or any help?
-- groeten, Taco
In addition to taco's stuff i attached what i could locate on my machine (last year i played a bit with mysql and storing xml and so) Hans
What you are asking for (MySQL I/O) cannot be done. The context command you refer to intended solely for syntax highlighting of SQL statements.
However, you got me thinking. :)
See attached context module and test file. It's extremely crude and more of a proof of concept than a full module, but it seems to work OK on the simple tests I threw at it. All of the commands and macros it provides are in the demonstration file.
Stuff to keep in mind:
- \write18 had better be enabled
- the statement is fed to a 'mysql' in batchmode during \MySQLexecute
- The result is saved to a file named \jobname-[Queryname]-result.dat
- You always have to re-execute before you attempt to process the the results
- The 'Countexecutable' is supposed to return a single line that starts with the number of lines of the \jobname-[Queryname]-result.dat file.
- No error checking whatsoever is done. Spefically, nothing is done about MySQL's output format, so you can expect problems with embedded newlines and other specials characters
The module is a joke, ok? But a fun one :-)
Greetings, Taco
On Wed, 23 Apr 2003 20:55:16 +0200, LEGUEDOIS, wrote:
but I don't know how to use this (how to use the result of the query, where I write database connection's parameters...). Do you know where can I find a manual or any help?
-- groeten,
Taco
================================================================ Deze e-mail is door E-mail VirusScanner van Planet Internet gecontroleerd op virussen. Op http://www.planet.nl/evs staat een verwijzing naar de actuele lijst waar op wordt gecontroleerd.
------------------------------------------------------------------------- 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 -------------------------------------------------------------------------
participants (3)
-
Hans Hagen
-
LEGUEDOIS, Frederic
-
Taco Hoekwater