mtx-context-sql.tex /size: 1576 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=mtx-context-sql-tables,
3%D        version=2012.10.19,
4%D          title=\CONTEXT\ Extra Trickry,
5%D       subtitle=SQL Tables,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14% begin help
15%
16% usage: context --extra=sql --tables [options]
17%
18% --host                  : hostname (default: localhost)
19% --username              : username (default: root)
20% --password              : password
21% --database              : database of which we want tables
22%
23% example: context --extra=sql --tables --host=localhost --username=root --password=*** --database=test
24%
25% end help
26
27\usemodule
28  [art-01,sql-tables]
29
30\setupbodyfont
31  [10pt]
32
33\setupheader
34  [state=high]
35
36\setuptabulate
37  [before={\blank[big,samepage]}]
38
39\starttext
40
41\startluacode
42
43    require("s-sql-tables")
44
45    local arguments = environment.arguments
46
47    local presets   = arguments.presets
48    local preloaded = presets and table.load(presets) or { }
49
50    local presets   = {
51        host     = preloaded.host     or arguments.host     or "localhost",
52        username = preloaded.username or arguments.username or "root",
53        password = preloaded.password or arguments.password or "",
54        database = preloaded.database or arguments.database or "",
55    }
56
57
58    if arguments.tables then
59        moduledata.sql.tables.showdefined(presets)
60    end
61
62\stopluacode
63
64\stoptext
65