|
a/doc/sqlscreens.sgml |
|
b/doc/sqlscreens.sgml |
|
|
1 |
<!-- Use this header for the FreeBSD sgml toolchain -->
|
|
|
2 |
<!-- NOTE: the sgml version should be saved as ISO-8859-1. -->
|
1 |
<!DOCTYPE BOOK PUBLIC "-//FreeBSD//DTD DocBook V4.1-Based Extension//EN" [
|
3 |
<!DOCTYPE BOOK PUBLIC "-//FreeBSD//DTD DocBook V4.1-Based Extension//EN" [
|
|
|
4 |
|
|
|
5 |
<!-- Use this header for going XML -->
|
|
|
6 |
<!-- <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
|
7 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ -->
|
|
|
8 |
|
2 |
<!ENTITY SQLSC "<application>SQLScreens</application>">
|
9 |
<!ENTITY SQLSC "<application>SQLScreens</application>">
|
|
|
10 |
<!ENTITY SQLSCVERSION "1.2.1">
|
3 |
<!ENTITY MYSQL "<application>MySQL</application>">
|
11 |
<!ENTITY MYSQL "<application>MySQL</application>">
|
|
|
12 |
<!ENTITY SQLITE "<application>SQLite</application>">
|
4 |
<!ENTITY SQLSCDOWN "http://www.lesbonscomptes.com/sqlscreens/sqlscdownload.html">
|
13 |
<!ENTITY SQLSCDOWN "http://www.lesbonscomptes.com/sqlscreens/sqlscdownload.html">
|
5 |
|
14 |
<!ENTITY SQLSCRDMPS "http://lesbonscomptes.com/sqlscreens/sqlscdumps.html">
|
6 |
]>
|
15 |
]>
|
7 |
<book lang="en">
|
16 |
<book lang="en">
|
8 |
<bookinfo>
|
17 |
<bookinfo>
|
9 |
<title>&SQLSC;: a simple SQL screen generator</title>
|
18 |
<title>&SQLSC;: a simple SQL screen generator</title>
|
10 |
|
19 |
|
|
... |
|
... |
18 |
</bookinfo>
|
27 |
</bookinfo>
|
19 |
|
28 |
|
20 |
<chapter>
|
29 |
<chapter>
|
21 |
<title>Preface</title>
|
30 |
<title>Preface</title>
|
22 |
|
31 |
|
23 |
<para>This document describes &SQLSC; release 1.1.10</para>
|
32 |
<para>This document describes &SQLSC; release &SQLSCVERSION;</para>
|
24 |
|
33 |
|
25 |
<para>&SQLSC; is a TCL/TK package allowing the easy creation of
|
34 |
<para>&SQLSC; is a TCL/TK package allowing the easy creation of
|
26 |
screen forms, for querying and updating a relational
|
35 |
screen forms, for querying and updating a relational
|
27 |
database.</para>
|
36 |
database.</para>
|
28 |
|
37 |
|
29 |
<para>&SQLSC; is primarily designed to work with &MYSQL; as a
|
38 |
<para>&SQLSC; was primarily designed to work with &MYSQL; as a
|
30 |
backend. It also works with ODBC. It might still work with
|
39 |
backend. It also works with &SQLITE;,
|
31 |
INFORMIX and MSQL (untested for some time).</para>
|
40 |
and <application>ODBC</application>. It might still work
|
|
|
41 |
with <application>INFORMIX</application>
|
|
|
42 |
and <application>MSQL</application> (untested for a looong
|
|
|
43 |
time).</para>
|
32 |
|
44 |
|
33 |
<para>&SQLSC; is no match for commercial application development
|
45 |
<para>&SQLSC; is no match for commercial application development
|
34 |
tools. It is a very simple tool to create ad-hoc query screens. We
|
46 |
tools. It is a very simple tool to create ad-hoc query screens. We
|
35 |
found it very handy for creating our data-entry utilities in
|
47 |
found it very handy for creating our data-entry utilities in
|
36 |
CDKIT/MusicMaker (R.I.P), which is why we decided to publish it,
|
48 |
CDKIT/MusicMaker (R.I.P), which is why we decided to publish it,
|
|
... |
|
... |
39 |
|
51 |
|
40 |
<para>If you have struggled with (Y,N,Y,N,Y,Y,...) lists in the &MYSQL;
|
52 |
<para>If you have struggled with (Y,N,Y,N,Y,Y,...) lists in the &MYSQL;
|
41 |
grant tables, you may find &SQLSC; useful :-)</para>
|
53 |
grant tables, you may find &SQLSC; useful :-)</para>
|
42 |
|
54 |
|
43 |
<para>Still interested ? Details
|
55 |
<para>Still interested ? Details
|
44 |
<link linkend="sqlsc.preface.quickdescription">follow</link>. If you are
|
56 |
<link linkend="PREFACE.QUICKDESCRIPTION">follow</link>. If you are
|
45 |
reading this from the web site, you can have a look at the
|
57 |
reading this online, you can have a look at the
|
46 |
<ulink url="sqlscdumps.html">screen dumps</ulink>.</para>
|
58 |
<ulink url="&SQLSCRDMPS;">screen dumps</ulink>.</para>
|
47 |
|
59 |
|
48 |
<sect1 id="sqlsc.preface.quickdescription">
|
60 |
<sect1 id="PREFACE.QUICKDESCRIPTION">
|
49 |
<title>Quick description</title>
|
61 |
<title>Quick description</title>
|
50 |
|
62 |
|
51 |
<para>A typical &SQLSC; application will have a number of
|
63 |
<para>A typical &SQLSC; application will have a number of
|
52 |
screens, each with several entry/display fields. Each screen
|
64 |
screens, each with several entry/display fields. Each screen
|
53 |
will be linked to one or several database tables, each field to
|
65 |
will be linked to one or several database tables, each field to
|
|
... |
|
... |
148 |
|
160 |
|
149 |
<para>This said, the software is free and we are open to suggestions
|
161 |
<para>This said, the software is free and we are open to suggestions
|
150 |
to improve it.</para>
|
162 |
to improve it.</para>
|
151 |
|
163 |
|
152 |
<para>If you want a quick idea of what it does, do the installation,
|
164 |
<para>If you want a quick idea of what it does, do the installation,
|
153 |
have a look at the tablescreen.tcl file in the samples directory,
|
165 |
have a look at the <filename>tablescreen.tcl</filename> file
|
154 |
set the host and user name, and point it to any table, like:</para>
|
166 |
in the samples directory, set the host and user name
|
|
|
167 |
(depending on the backend type), and point it to any table,
|
|
|
168 |
like:</para>
|
155 |
|
169 |
|
156 |
<programlisting>
|
170 |
<programlisting>
|
157 |
tablescreen.tcl dbname tablename
|
171 |
tablescreen.tcl dbname tablename
|
158 |
</programlisting>
|
172 |
</programlisting>
|
159 |
|
173 |
|
|
... |
|
... |
161 |
table (you may need to adjust the host and user names in the script
|
175 |
table (you may need to adjust the host and user names in the script
|
162 |
or the environment to get the right permissions).</para>
|
176 |
or the environment to get the right permissions).</para>
|
163 |
</sect1>
|
177 |
</sect1>
|
164 |
</chapter>
|
178 |
</chapter>
|
165 |
|
179 |
|
166 |
<chapter id="sqlsc.installation">
|
180 |
<chapter id="INSTALLATION">
|
167 |
<title>Installation</title>
|
181 |
<title>Installation</title>
|
168 |
|
182 |
|
169 |
<sect1 id="sqlsc.installation.external">
|
183 |
<sect1 id="INSTALLATION.EXTERNAL">
|
170 |
<title>External software needed</title>
|
184 |
<title>External software needed</title>
|
171 |
|
185 |
|
172 |
<para>To use &SQLSC;, you will need a number of external software
|
186 |
<para>To use &SQLSC;, you will need a number of external software
|
173 |
packages:</para>
|
187 |
packages:</para>
|
174 |
|
188 |
|
|
... |
|
... |
179 |
FreeBSD or Linux, you just need to install the packages. Else,
|
193 |
FreeBSD or Linux, you just need to install the packages. Else,
|
180 |
you can get the source distributions from
|
194 |
you can get the source distributions from
|
181 |
<ulink url="http://tcl.activestate.com/">the main TCL
|
195 |
<ulink url="http://tcl.activestate.com/">the main TCL
|
182 |
site</ulink>
|
196 |
site</ulink>
|
183 |
|
197 |
|
184 |
. TCL and TK are very easy to compile.</para>
|
198 |
. TCL and TK are very easy to build.</para>
|
185 |
</listitem>
|
199 |
</listitem>
|
186 |
</itemizedlist>
|
200 |
</itemizedlist>
|
187 |
|
201 |
|
188 |
<para>In order to access the databases, the basic TCL interpreter
|
202 |
<para>In order to access the databases, the basic TCL interpreter
|
189 |
must be augmented with a database access module:</para>
|
203 |
must be augmented with a database access module:</para>
|
|
... |
|
... |
222 |
</listitem>
|
236 |
</listitem>
|
223 |
|
237 |
|
224 |
<listitem>
|
238 |
<listitem>
|
225 |
<para>For INFORMIX you will need the isqltcl package by Srinivas
|
239 |
<para>For INFORMIX you will need the isqltcl package by Srinivas
|
226 |
Kumar. It has become a little difficult to find lately and
|
240 |
Kumar. It has become a little difficult to find lately and
|
227 |
there is a copy on the <ulink url="&SQLSCDOWN">download
|
241 |
there is a copy on the <ulink url="&SQLSCDOWN;">download
|
228 |
page</ulink>.</para>
|
242 |
page</ulink>.</para>
|
229 |
</listitem>
|
243 |
</listitem>
|
230 |
</itemizedlist>
|
244 |
</itemizedlist>
|
231 |
|
245 |
|
232 |
<para>The &SQLSC; <ulink url="&SQLSCDOWN;">download page</ulink>
|
246 |
<para>The &SQLSC; <ulink url="&SQLSCDOWN;">download page</ulink>
|
233 |
has pointers or copies for some of these elements.</para>
|
247 |
has pointers or copies for some of these elements.</para>
|
234 |
|
248 |
|
235 |
<para>Only the direct &MYSQL; connection has been tested lately,
|
249 |
<para>Only the direct &MYSQL; and &SQLITE; backends have been
|
236 |
and there may be minor problems with the others.</para>
|
250 |
tested lately, and there may be minor problems with the
|
|
|
251 |
others.</para>
|
237 |
|
252 |
|
238 |
</sect1>
|
253 |
</sect1>
|
239 |
|
254 |
|
240 |
<sect1>
|
255 |
<sect1>
|
241 |
<title>Installation</title>
|
256 |
<title>Installation</title>
|
|
... |
|
... |
254 |
|
269 |
|
255 |
<para>First, if needed, compile and install TCL and TK (untar; cd
|
270 |
<para>First, if needed, compile and install TCL and TK (untar; cd
|
256 |
tcl8.../unix; configure; make; make install, same for tk).</para>
|
271 |
tcl8.../unix; configure; make; make install, same for tk).</para>
|
257 |
|
272 |
|
258 |
<para>The next step is to add database-access capability to the
|
273 |
<para>The next step is to add database-access capability to the
|
259 |
standard TCL/TK wish interpreter. This can be done in two ways,
|
274 |
standard TCL/TK wish interpreter. This can be done in several
|
|
|
275 |
ways:
|
|
|
276 |
<itemizedlist>
|
260 |
either by statically linking the database access module (mysqltcl or
|
277 |
<listitem>By statically linking the database access module
|
261 |
isqltcl) with the interpreter or by using the TCL load facility and
|
278 |
(e.g. mysqltcl or isqltcl) with the
|
|
|
279 |
interpreter.</listitem>
|
|
|
280 |
<listitem>By using the <application>TCL</application> load
|
262 |
a shared library. The dynamic version sometimes need some manual
|
281 |
facility and a shared library. The dynamic version sometimes
|
263 |
tweaking to work.</para>
|
282 |
need some manual tweaking to work.</listitem>
|
|
|
283 |
<listitem>By loading an external package that itself does
|
|
|
284 |
whatever is needed (e.g. <literal>package require
|
|
|
285 |
sqlite3)</literal></listitem>
|
|
|
286 |
</itemizedlist>
|
|
|
287 |
</para>
|
264 |
|
288 |
|
|
|
289 |
<para>&MYSQL; support is managed by
|
265 |
<para>The <filename>Makefile</filename> in the &SQLSC; directory
|
290 |
the <filename>Makefile</filename> in the &SQLSC;
|
266 |
only supports &MYSQL; internally. For using
|
291 |
directory. You can disable &MYSQL; support (and the need to
|
|
|
292 |
install the client library) by using
|
|
|
293 |
option <literal>--disable-mysql</literal> to
|
|
|
294 |
the <command>configure</command> script.</para>
|
|
|
295 |
|
|
|
296 |
<para>For &SQLITE;, just install the &SQLITE; TCL package (which
|
|
|
297 |
may be named something
|
|
|
298 |
like <literal>libsqlite3-tcl</literal>).</para>
|
|
|
299 |
|
|
|
300 |
<para>For <application>ODBC</application>, you should first
|
|
|
301 |
install the driver manager, the driver(s) you need and the
|
|
|
302 |
tclodbc TCL extension. Follow the instructions in each
|
|
|
303 |
package.</para>
|
|
|
304 |
|
267 |
<application>isqltcl</application> and INFORMIX, follow the
|
305 |
<para>For using <application>isqltcl</application> and INFORMIX,
|
268 |
installation instructions inside the
|
306 |
follow the installation instructions inside
|
269 |
<application>isqltcl</application> package to generate the
|
307 |
the <application>isqltcl</application> package to generate the
|
270 |
interpreter.</para>
|
308 |
interpreter.</para>
|
271 |
|
|
|
272 |
<para>For ODBC, you should first install the driver manager, the
|
|
|
273 |
driver(s) you need and the tclodbc TCL extension. Follow the
|
|
|
274 |
instructions in each package.</para>
|
|
|
275 |
|
309 |
|
276 |
<sect2>
|
310 |
<sect2>
|
277 |
<title>Generating a wish interpreter with &MYSQL; support:</title>
|
311 |
<title>Generating a wish interpreter with &MYSQL; support:</title>
|
278 |
|
312 |
|
|
|
313 |
<para>You do not need this if you are working with &SQLITE;
|
|
|
314 |
only. Just give a <literal>--disable-mysql</literal>
|
|
|
315 |
argument to <command>configure</command>.</para>
|
|
|
316 |
|
279 |
<para>Both the static and dynamic load methods are supported by
|
317 |
<para>Both the static and dynamic load methods are supported by
|
280 |
the &SQLSC; build tools. Only Linux, SOLARIS,
|
318 |
the &SQLSC; build tools. Only Linux, SOLARIS,
|
281 |
and FreeBSD have been tested, things are not guaranteed to work on
|
319 |
and FreeBSD have been tested, things are not guaranteed to work on
|
282 |
other systems. The Makefile generated by configure is small, it
|
320 |
other systems. The Makefile generated by configure is small, it
|
283 |
should be easy to adjust if needed.</para>
|
321 |
should be easy to adjust if needed.</para>
|
284 |
|
322 |
|
285 |
<para>The configuration script only looks for the &MYSQL; library in
|
323 |
<para>The configuration script use
|
286 |
<filename>/usr/local/mysql/lib</filename>,
|
324 |
the <command>mysql_config</command> command to locate the
|
287 |
<filename>/usr/local/lib/mysql</filename>,
|
325 |
&MYSQL; client library and include files. It should be
|
288 |
<filename>/usr/lib/mysql</filename>, and
|
326 |
accessible in your <literal>PATH</literal>.</para>
|
289 |
<filename>/usr/lib</filename>.
|
|
|
290 |
If your installation is different, please make symbolic
|
|
|
291 |
links or modify the script.</para>
|
|
|
292 |
|
327 |
|
293 |
<para>When you are ready:</para>
|
328 |
<para>When you are ready:</para>
|
294 |
|
329 |
|
295 |
<orderedlist>
|
330 |
<orderedlist>
|
296 |
<listitem>
|
331 |
<listitem>
|
|
... |
|
... |
337 |
your <filename>Makefile</filename> to link with
|
372 |
your <filename>Makefile</filename> to link with
|
338 |
<filename>mysqltcl.o</filename>. You have probably been
|
373 |
<filename>mysqltcl.o</filename>. You have probably been
|
339 |
through this already. Have a look at the included
|
374 |
through this already. Have a look at the included
|
340 |
<filename>tkAppinit.c</filename></para>
|
375 |
<filename>tkAppinit.c</filename></para>
|
341 |
|
376 |
|
342 |
<para>Because the dynamic version is sometimes a pain to build,
|
|
|
343 |
the sample scripts are now set up to be executed by
|
|
|
344 |
<command>mysqlwish</command> by
|
|
|
345 |
default (for &MYSQL;). If you managed to get the dynamic version to
|
|
|
346 |
build, you will certainly find it easy to change the first line in
|
|
|
347 |
the scripts...</para>
|
|
|
348 |
</sect2>
|
377 |
</sect2>
|
349 |
</sect1>
|
378 |
</sect1>
|
350 |
</chapter>
|
379 |
</chapter>
|
351 |
|
380 |
|
352 |
<chapter id="sqlsc.using">
|
381 |
<chapter id="USING">
|
353 |
<title>Using &SQLSC;</title>
|
382 |
<title>Using &SQLSC;</title>
|
354 |
|
383 |
|
355 |
<para>The following is organized more like a reference manual, there
|
384 |
<para>The following is organized more like a reference manual, there
|
356 |
is little tutorial material. You may want to look at the
|
385 |
is little tutorial material. You may want to look at the
|
357 |
<link linkend="sqlsc.samples">sample scripts</link>
|
386 |
<link linkend="SAMPLES">sample scripts</link>
|
358 |
|
387 |
|
359 |
to get a quick idea.</para>
|
388 |
to get a quick idea.</para>
|
360 |
|
389 |
|
361 |
<sect1 id="sqlsc.using.envir">
|
390 |
<sect1 id="USING.ENVIR">
|
362 |
<title>Environment variables</title>
|
391 |
<title>Environment variables</title>
|
363 |
|
392 |
|
364 |
<para>The <literal>SQLDBTYPE</literal> environment variable
|
393 |
<para>The <literal>SQLDBTYPE</literal> environment variable
|
365 |
decides what database code is going to be used. It has several
|
394 |
decides what database code is going to be used. It has several
|
366 |
possible values:</para>
|
395 |
possible values:</para>
|
367 |
|
396 |
|
368 |
<itemizedlist>
|
397 |
<itemizedlist>
|
369 |
<listitem>
|
398 |
<listitem>
|
370 |
<para><literal>MYSQL</literal> to access a &MYSQL; database.</para>
|
399 |
<para><literal>MYSQL</literal> to access a &MYSQL; database.</para>
|
371 |
</listitem>
|
400 |
</listitem>
|
|
|
401 |
<listitem>
|
|
|
402 |
<para><literal>SQLITE3</literal> to access a &SQLITE; database.</para>
|
|
|
403 |
</listitem>
|
|
|
404 |
|
|
|
405 |
<listitem>
|
|
|
406 |
<para><literal>ODBC</literal> to use an ODBC driver manager.</para>
|
|
|
407 |
</listitem>
|
372 |
|
408 |
|
373 |
<listitem>
|
409 |
<listitem>
|
374 |
<para><literal>INFORMIX</literal> to access an INFORMIX
|
410 |
<para><literal>INFORMIX</literal> to access an INFORMIX
|
375 |
database.</para>
|
411 |
database.</para>
|
376 |
</listitem>
|
412 |
</listitem>
|
377 |
|
413 |
|
378 |
<listitem>
|
414 |
<listitem>
|
379 |
<para><literal>MSQL</literal> to access an MSQL database.</para>
|
415 |
<para><literal>MSQL</literal> to access an MSQL database.</para>
|
380 |
</listitem>
|
416 |
</listitem>
|
381 |
|
417 |
|
382 |
<listitem>
|
|
|
383 |
<para><literal>ODBC</literal> to use an ODBC driver manager.</para>
|
|
|
384 |
</listitem>
|
|
|
385 |
</itemizedlist>
|
418 |
</itemizedlist>
|
386 |
|
419 |
|
387 |
<para>The default if the variable is not set is to use &MYSQL;. Don't
|
420 |
<para>The default if the variable is not set is to use &MYSQL;. Don't
|
388 |
depend on it.</para>
|
421 |
depend on it.</para>
|
389 |
|
422 |
|
|
... |
|
... |
391 |
first call to <function>sqlscreen</function>. (It is set to
|
424 |
first call to <function>sqlscreen</function>. (It is set to
|
392 |
<literal>MYSQL</literal>
|
425 |
<literal>MYSQL</literal>
|
393 |
inside the sample scripts). Of course, the value of this
|
426 |
inside the sample scripts). Of course, the value of this
|
394 |
variable must be consistent with what extensions are available
|
427 |
variable must be consistent with what extensions are available
|
395 |
to the TCL interpreter (See <link
|
428 |
to the TCL interpreter (See <link
|
396 |
linkend="sqlsc.installation">installation</link>).</para>
|
429 |
linkend="INSTALLATION">installation</link>).</para>
|
397 |
|
430 |
|
398 |
<para>The <literal>SQLSCLOG</literal> environment variable can
|
431 |
<para>The <literal>SQLSCLOG</literal> environment variable can
|
399 |
be set to the name of a file where &SQLSC; will log the SQL
|
432 |
be set to the name of a file where &SQLSC; will log the SQL
|
400 |
statements it executes. The default is to log to stdout.</para>
|
433 |
statements it executes. The default is to log to stdout.</para>
|
401 |
|
434 |
|
|
... |
|
... |
459 |
<term>Add</term>
|
492 |
<term>Add</term>
|
460 |
|
493 |
|
461 |
<listitem>
|
494 |
<listitem>
|
462 |
<para>inserts the current values. There is special handling
|
495 |
<para>inserts the current values. There is special handling
|
463 |
for auto_increment fields, see
|
496 |
for auto_increment fields, see
|
464 |
<link linkend="sqlsc.sqlgeneration">SQL generation</link>
|
497 |
<link linkend="SQLGENERATION">SQL generation</link>
|
465 |
</para>
|
498 |
</para>
|
466 |
</listitem>
|
499 |
</listitem>
|
467 |
</varlistentry>
|
500 |
</varlistentry>
|
468 |
|
501 |
|
469 |
<varlistentry>
|
502 |
<varlistentry>
|
470 |
<term>Update</term>
|
503 |
<term>Update</term>
|
471 |
|
504 |
|
472 |
<listitem>
|
505 |
<listitem>
|
473 |
<para>updates the row according to the current values (how the
|
506 |
<para>updates the row according to the current values (how the
|
474 |
WHERE clause is built is described later, see
|
507 |
WHERE clause is built is described later, see
|
475 |
<link linkend="sqlsc.programming.arrayentries.fattributes.updateindex">updateindex</link>
|
508 |
<link linkend="PROGRAMMING.ARRAYENTRIES.FATTRIBUTES.UPDATEINDEX">
|
|
|
509 |
updateindex</link>
|
476 |
and
|
510 |
and
|
477 |
<link linkend="sqlsc.sqlgeneration">Sql generation</link>).</para>
|
511 |
<link linkend="SQLGENERATION">Sql generation</link>).</para>
|
478 |
</listitem>
|
512 |
</listitem>
|
479 |
</varlistentry>
|
513 |
</varlistentry>
|
480 |
|
514 |
|
481 |
<varlistentry>
|
515 |
<varlistentry>
|
482 |
<term>Delete</term>
|
516 |
<term>Delete</term>
|
|
... |
|
... |
491 |
|
525 |
|
492 |
<para>The Update and Add buttons may not exist on all screens (some
|
526 |
<para>The Update and Add buttons may not exist on all screens (some
|
493 |
screens may be set up only for querying).</para>
|
527 |
screens may be set up only for querying).</para>
|
494 |
|
528 |
|
495 |
<para>Delete is not created by default (See
|
529 |
<para>Delete is not created by default (See
|
496 |
<link linkend="sqlsc.programming.arrayentries.sattributes.allowdelete">allowdelete</link>
|
530 |
<link linkend="PROGRAMMING.ARRAYENTRIES.SATTRIBUTES.ALLOWDELETE">
|
|
|
531 |
allowdelete</link>
|
497 |
|
532 |
|
498 |
).</para>
|
533 |
).</para>
|
499 |
|
534 |
|
500 |
<para>The
|
535 |
<para>The
|
501 |
<link linkend="sqlsc.sqlgeneration">SQL generation</link>
|
536 |
<link linkend="SQLGENERATION">SQL generation</link>
|
502 |
|
537 |
|
503 |
section describes how the SQL statements are generated for the
|
538 |
section describes how the SQL statements are generated for the
|
504 |
different actions.</para>
|
539 |
different actions.</para>
|
505 |
</sect1>
|
540 |
</sect1>
|
506 |
|
541 |
|
|
... |
|
... |
586 |
<literal>quantity</literal>, a <literal>quantity >
|
621 |
<literal>quantity</literal>, a <literal>quantity >
|
587 |
10</literal> condition
|
622 |
10</literal> condition
|
588 |
will be inserted in the WHERE clause. You could also enter
|
623 |
will be inserted in the WHERE clause. You could also enter
|
589 |
<literal>>10 AND quantity < 20</literal>, or whatever
|
624 |
<literal>>10 AND quantity < 20</literal>, or whatever
|
590 |
condition you need. (See also
|
625 |
condition you need. (See also
|
591 |
<link linkend="sqlsc.sqlgeneration">the paragraph about SQL
|
626 |
<link linkend="SQLGENERATION">the paragraph about SQL
|
592 |
generation</link>
|
627 |
generation</link>
|
593 |
|
628 |
|
594 |
).</para>
|
629 |
).</para>
|
595 |
</sect1>
|
630 |
</sect1>
|
596 |
</chapter>
|
631 |
</chapter>
|
597 |
|
632 |
|
598 |
<chapter id="sqlsc.programming">
|
633 |
<chapter id="PROGRAMMING">
|
599 |
<title>Programming Interface</title>
|
634 |
<title>Programming Interface</title>
|
600 |
|
635 |
|
601 |
<sect1 id="sqlsc.programming.overview">
|
636 |
<sect1 id="PROGRAMMING.OVERVIEW">
|
602 |
<title>Overview</title>
|
637 |
<title>Overview</title>
|
603 |
|
638 |
|
604 |
<para>All exchanges between the package and the user application are
|
639 |
<para>All exchanges between the package and the user application are
|
605 |
made through TCL arrays that hold all data and parameters. There is
|
640 |
made through TCL arrays that hold all data and parameters. There is
|
606 |
one such array for every screen. The array name is not significant
|
641 |
one such array for every screen. The array name is not significant
|
|
... |
|
... |
676 |
instead. <function>sqlscreendelete</function> is mostly useful in case you want to
|
711 |
instead. <function>sqlscreendelete</function> is mostly useful in case you want to
|
677 |
recreate the screen with different options (most options can't be
|
712 |
recreate the screen with different options (most options can't be
|
678 |
changed once a screen is created).</para>
|
713 |
changed once a screen is created).</para>
|
679 |
</sect1>
|
714 |
</sect1>
|
680 |
|
715 |
|
681 |
<sect1 id="sqlsc.programming.init">
|
716 |
<sect1 id="PROGRAMMING.INIT">
|
682 |
<title>Initialization and termination</title>
|
717 |
<title>Initialization and termination</title>
|
683 |
|
718 |
|
684 |
<sect2>
|
719 |
<sect2>
|
685 |
<title>sqlscreen</title>
|
720 |
<title>sqlscreen</title>
|
686 |
|
721 |
|
687 |
<para>To create a screen, you set values inside a TCL array
|
722 |
<para>To create a screen, you set values inside a TCL array
|
688 |
(See the following section:
|
723 |
(See the following section:
|
689 |
<link linkend="sqlsc.programming.arrayentries">Interface array entries</link>
|
724 |
<link linkend="PROGRAMMING.ARRAYENTRIES">Interface array entries</link>
|
690 |
|
725 |
|
691 |
), then perform creation as follows:</para>
|
726 |
), then perform creation as follows:</para>
|
692 |
|
727 |
|
693 |
<programlisting>
|
728 |
<programlisting>
|
694 |
sqlscreen yourarrayname
|
729 |
sqlscreen yourarrayname
|
|
... |
|
... |
713 |
|
748 |
|
714 |
<para><function>sqlscreen</function> optionally takes a
|
749 |
<para><function>sqlscreen</function> optionally takes a
|
715 |
second parameter. If the value is <literal>h</literal>, the
|
750 |
second parameter. If the value is <literal>h</literal>, the
|
716 |
fields will be arranged horizontally instead of
|
751 |
fields will be arranged horizontally instead of
|
717 |
vertically. There are other ways to do this(see
|
752 |
vertically. There are other ways to do this(see
|
718 |
<link linkend="sqlsc.programming.arrayentries.general.columns">columns</link>),
|
753 |
<link linkend="PROGRAMMING.ARRAYENTRIES.GENERAL.COLUMNS">columns</link>),
|
719 |
but it can still be useful in some cases.</para>
|
754 |
but it can still be useful in some cases.</para>
|
720 |
</sect2>
|
755 |
</sect2>
|
721 |
|
756 |
|
722 |
<sect2>
|
757 |
<sect2>
|
723 |
<title>sqlscreendelete</title>
|
758 |
<title>sqlscreendelete</title>
|
|
... |
|
... |
729 |
<programlisting>
|
764 |
<programlisting>
|
730 |
sqlscreendelete arrayname
|
765 |
sqlscreendelete arrayname
|
731 |
</programlisting>
|
766 |
</programlisting>
|
732 |
</sect2>
|
767 |
</sect2>
|
733 |
|
768 |
|
734 |
<sect2 id="sqlsc.programming.init.font">
|
769 |
<sect2 id="PROGRAMMING.INIT.FONT">
|
735 |
<title>Setting fonts for &SQLSC; applications</title>
|
770 |
<title>Setting fonts for &SQLSC; applications</title>
|
736 |
|
771 |
|
737 |
<para>The font used by the screen can be set by
|
772 |
<para>The font used by the screen can be set by
|
738 |
<link linkend="sqlsc.programming.arrayentries.sattributes.font">
|
773 |
<link linkend="PROGRAMMING.ARRAYENTRIES.SATTRIBUTES.FONT">
|
739 |
setting the <literal>font</literal> array entry</link>. This
|
774 |
setting the <literal>font</literal> array entry</link>. This
|
740 |
will only adjust the font for the specific screen. It may
|
775 |
will only adjust the font for the specific screen. It may
|
741 |
be more convenient to set the font at the start of the
|
776 |
be more convenient to set the font at the start of the
|
742 |
application script, with a variation on the following example:</para>
|
777 |
application script, with a variation on the following example:</para>
|
743 |
<programlisting>
|
778 |
<programlisting>
|
|
... |
|
... |
762 |
|
797 |
|
763 |
</sect1>
|
798 |
</sect1>
|
764 |
|
799 |
|
765 |
|
800 |
|
766 |
|
801 |
|
767 |
<sect1 id="sqlsc.programming.arrayentries">
|
802 |
<sect1 id="PROGRAMMING.ARRAYENTRIES">
|
768 |
<title>Interface array entries</title>
|
803 |
<title>Interface array entries</title>
|
769 |
|
804 |
|
770 |
<sect2 id="sqlsc.programming.arrayentries.general">
|
805 |
<sect2 id="PROGRAMMING.ARRAYENTRIES.GENERAL">
|
771 |
<title>General parameters</title>
|
806 |
<title>General parameters</title>
|
772 |
|
807 |
|
773 |
<sect3>
|
808 |
<sect3>
|
774 |
<title>window</title>
|
809 |
<title>window</title>
|
775 |
|
810 |
|
|
... |
|
... |
833 |
clause (see the following paragraph), and you will not be able
|
868 |
clause (see the following paragraph), and you will not be able
|
834 |
to modify data through the screen. (You CAN update several
|
869 |
to modify data through the screen. (You CAN update several
|
835 |
tables in one application, but each table will need a separate
|
870 |
tables in one application, but each table will need a separate
|
836 |
screen, and the screen links will be through cascaded queries,
|
871 |
screen, and the screen links will be through cascaded queries,
|
837 |
not join clauses - See
|
872 |
not join clauses - See
|
838 |
<link linkend="sqlsc.programming.linking">Linking screens</link>
|
873 |
<link linkend="PROGRAMMING.LINKING">Linking screens</link>
|
839 |
|
874 |
|
840 |
).</para>
|
875 |
).</para>
|
841 |
</sect3>
|
876 |
</sect3>
|
842 |
|
877 |
|
843 |
<sect3>
|
878 |
<sect3>
|
|
... |
|
... |
851 |
<programlisting>
|
886 |
<programlisting>
|
852 |
set custorder(joinclause) {customers.custid = orders.ordercustid}
|
887 |
set custorder(joinclause) {customers.custid = orders.ordercustid}
|
853 |
</programlisting>
|
888 |
</programlisting>
|
854 |
</sect3>
|
889 |
</sect3>
|
855 |
|
890 |
|
856 |
<sect3 id="sqlsc.programming.arrayentries.general.columns">
|
891 |
<sect3 id="PROGRAMMING.ARRAYENTRIES.GENERAL.COLUMNS">
|
857 |
<title>columns</title>
|
892 |
<title>columns</title>
|
858 |
|
893 |
|
859 |
<para>This is a list to define the columns that you want
|
894 |
<para>This is a list to define the columns that you want
|
860 |
included. If it is not set, sqlscreen will query the database
|
895 |
included. If it is not set, sqlscreen will query the database
|
861 |
for all the column names in the table, and build the screen with
|
896 |
for all the column names in the table, and build the screen with
|
|
... |
|
... |
897 |
last) spans the remaining columns. You will probably need several
|
932 |
last) spans the remaining columns. You will probably need several
|
898 |
tries to get it right (at least I usually do).</para>
|
933 |
tries to get it right (at least I usually do).</para>
|
899 |
</sect3>
|
934 |
</sect3>
|
900 |
</sect2>
|
935 |
</sect2>
|
901 |
|
936 |
|
902 |
<sect2 id="sqlsc.programming.arrayentries.sattributes">
|
937 |
<sect2 id="PROGRAMMING.ARRAYENTRIES.SATTRIBUTES">
|
903 |
<title>Screen attributes</title>
|
938 |
<title>Screen attributes</title>
|
904 |
|
939 |
|
905 |
<sect3>
|
940 |
<sect3>
|
906 |
<title>queryonly</title>
|
941 |
<title>queryonly</title>
|
907 |
|
942 |
|
|
... |
|
... |
916 |
<para>The value has no importance, just setting the array entry
|
951 |
<para>The value has no importance, just setting the array entry
|
917 |
(even to <literal>no</literal>) creates a screen for query
|
952 |
(even to <literal>no</literal>) creates a screen for query
|
918 |
only.</para>
|
953 |
only.</para>
|
919 |
</sect3>
|
954 |
</sect3>
|
920 |
|
955 |
|
921 |
<sect3 id="sqlsc.programming.arrayentries.sattributes.allowdelete">
|
956 |
<sect3 id="PROGRAMMING.ARRAYENTRIES.SATTRIBUTES.ALLOWDELETE">
|
922 |
<title>allowdelete</title>
|
957 |
<title>allowdelete</title>
|
923 |
|
958 |
|
924 |
<para>If this entry is set, and <literal>queryonly</literal>
|
959 |
<para>If this entry is set, and <literal>queryonly</literal>
|
925 |
is not set a <guilabel>Delete</guilabel> button will be
|
960 |
is not set a <guilabel>Delete</guilabel> button will be
|
926 |
created.</para>
|
961 |
created.</para>
|
927 |
</sect3>
|
962 |
</sect3>
|
928 |
|
963 |
|
929 |
<sect3 id="sqlsc.programming.arrayentries.sattributes.font">
|
964 |
<sect3 id="PROGRAMMING.ARRAYENTRIES.SATTRIBUTES.FONT">
|
930 |
<title>font</title>
|
965 |
<title>font</title>
|
931 |
|
966 |
|
932 |
<para>If this entry is set, the value will be used as a font
|
967 |
<para>If this entry is set, the value will be used as a font
|
933 |
definition for the screen elements. Any TK font definition
|
968 |
definition for the screen elements. Any TK font definition
|
934 |
can be used. There are <link
|
969 |
can be used. There are <link
|
935 |
linkend="sqlsc.programming.init.font">several other
|
970 |
linkend="PROGRAMMING.INIT.FONT">several other
|
936 |
ways</link> to set the application font.</para>
|
971 |
ways</link> to set the application font.</para>
|
937 |
|
972 |
|
938 |
</sect3>
|
973 |
</sect3>
|
939 |
|
974 |
|
940 |
<sect3>
|
975 |
<sect3>
|
|
... |
|
... |
960 |
package is available, the buttons will be created with icons
|
995 |
package is available, the buttons will be created with icons
|
961 |
instead of textual labels.</para>
|
996 |
instead of textual labels.</para>
|
962 |
</sect3>
|
997 |
</sect3>
|
963 |
</sect2>
|
998 |
</sect2>
|
964 |
|
999 |
|
965 |
<sect2 id="sqlsc.programming.arrayentries.fattributes">
|
1000 |
<sect2 id="PROGRAMMING.ARRAYENTRIES.FATTRIBUTES">
|
966 |
<title>Field attributes</title>
|
1001 |
<title>Field attributes</title>
|
967 |
|
1002 |
|
968 |
<sect3>
|
1003 |
<sect3>
|
969 |
<title>Column type and length</title>
|
1004 |
<title>Column type and length</title>
|
970 |
|
1005 |
|
|
... |
|
... |
1135 |
set customer(ordercols) "custid desc, custname"
|
1170 |
set customer(ordercols) "custid desc, custname"
|
1136 |
</programlisting>
|
1171 |
</programlisting>
|
1137 |
|
1172 |
|
1138 |
</sect3>
|
1173 |
</sect3>
|
1139 |
|
1174 |
|
1140 |
<sect3 id="sqlsc.programming.arrayentries.fattributes.updateindex">
|
1175 |
<sect3 id="PROGRAMMING.ARRAYENTRIES.FATTRIBUTES.UPDATEINDEX">
|
1141 |
<title>updateindex</title>
|
1176 |
<title>updateindex</title>
|
1142 |
|
1177 |
|
1143 |
<para>This defines a column name (or a list of column names)
|
1178 |
<para>This defines a column name (or a list of column names)
|
1144 |
that will be used in the WHERE clause of an UPDATE statement. It
|
1179 |
that will be used in the WHERE clause of an UPDATE statement. It
|
1145 |
should provide a way to uniquely identify a row.</para>
|
1180 |
should provide a way to uniquely identify a row.</para>
|
|
... |
|
... |
1163 |
<para>If no <literal>updateindex</literal> list finally
|
1198 |
<para>If no <literal>updateindex</literal> list finally
|
1164 |
exists, the screen will have no <guilabel>Update</guilabel>
|
1199 |
exists, the screen will have no <guilabel>Update</guilabel>
|
1165 |
button.</para>
|
1200 |
button.</para>
|
1166 |
|
1201 |
|
1167 |
<para>See
|
1202 |
<para>See
|
1168 |
<link linkend="sqlsc.sqlgeneration">Sql generation</link>
|
1203 |
<link linkend="SQLGENERATION">Sql generation</link>
|
1169 |
|
1204 |
|
1170 |
for a more complete discussion of update row selection.</para>
|
1205 |
for a more complete discussion of update row selection.</para>
|
1171 |
</sect3>
|
1206 |
</sect3>
|
1172 |
|
1207 |
|
1173 |
<sect3>
|
1208 |
<sect3>
|
|
... |
|
... |
1223 |
display the corresponding row in the main screen.</para>
|
1258 |
display the corresponding row in the main screen.</para>
|
1224 |
|
1259 |
|
1225 |
<para>This capability will only be available if an
|
1260 |
<para>This capability will only be available if an
|
1226 |
<literal>updateindex</literal> list has been defined for the
|
1261 |
<literal>updateindex</literal> list has been defined for the
|
1227 |
screen (either implicitely or explicitely), see <link
|
1262 |
screen (either implicitely or explicitely), see <link
|
1228 |
linkend="sqlsc.programming.arrayentries.fattributes.updateindex">the
|
1263 |
linkend="PROGRAMMING.ARRAYENTRIES.FATTRIBUTES.UPDATEINDEX">the
|
1229 |
updateindex section</link>. The
|
1264 |
updateindex section</link>. The
|
1230 |
<literal>updateindex</literal> columns must be part of
|
1265 |
<literal>updateindex</literal> columns must be part of
|
1231 |
<literal>list_columns</literal>, so that we can uniquely
|
1266 |
<literal>list_columns</literal>, so that we can uniquely
|
1232 |
link back from the list to the detail screen.</para>
|
1267 |
link back from the list to the detail screen.</para>
|
1233 |
|
1268 |
|
|
... |
|
... |
1362 |
<title>sqlsc_colname_valsaved</title>
|
1397 |
<title>sqlsc_colname_valsaved</title>
|
1363 |
|
1398 |
|
1364 |
<para>The package uses these entries to save the database values
|
1399 |
<para>The package uses these entries to save the database values
|
1365 |
when a query is performed. This is used to compute the UPDATE
|
1400 |
when a query is performed. This is used to compute the UPDATE
|
1366 |
statements (See the
|
1401 |
statements (See the
|
1367 |
<link linkend="sqlsc.sqlgeneration">Sql generation</link>
|
1402 |
<link linkend="SQLGENERATION">Sql generation</link>
|
1368 |
|
1403 |
|
1369 |
section).</para>
|
1404 |
section).</para>
|
1370 |
</sect3>
|
1405 |
</sect3>
|
1371 |
</sect2>
|
1406 |
</sect2>
|
1372 |
</sect1>
|
1407 |
</sect1>
|
|
... |
|
... |
1389 |
when the end of a query is reached. The sound can become quite
|
1424 |
when the end of a query is reached. The sound can become quite
|
1390 |
ennoying...</para>
|
1425 |
ennoying...</para>
|
1391 |
</sect2>
|
1426 |
</sect2>
|
1392 |
</sect1>
|
1427 |
</sect1>
|
1393 |
|
1428 |
|
1394 |
<sect1 id="sqlsc.programming.linking">
|
1429 |
<sect1 id="PROGRAMMING.LINKING">
|
1395 |
<title>Linking screens</title>
|
1430 |
<title>Linking screens</title>
|
1396 |
|
1431 |
|
1397 |
<para>It is possible to link two screens so that a change in one
|
1432 |
<para>It is possible to link two screens so that a change in one
|
1398 |
screen will update the other one. This can be done in two
|
1433 |
screen will update the other one. This can be done in two
|
1399 |
ways.</para>
|
1434 |
ways.</para>
|
|
... |
|
... |
1613 |
</listitem>
|
1648 |
</listitem>
|
1614 |
</itemizedlist>
|
1649 |
</itemizedlist>
|
1615 |
</sect1>
|
1650 |
</sect1>
|
1616 |
</chapter>
|
1651 |
</chapter>
|
1617 |
|
1652 |
|
1618 |
<chapter id="sqlsc.sqlgeneration">
|
1653 |
<chapter id="SQLGENERATION">
|
1619 |
<title>SQL generation</title>
|
1654 |
<title>SQL generation</title>
|
1620 |
|
1655 |
|
1621 |
<para>Every time the user presses a button like query or update, the
|
1656 |
<para>Every time the user presses a button like query or update, the
|
1622 |
program will generate a SQL statement to perform the appropriate
|
1657 |
program will generate a SQL statement to perform the appropriate
|
1623 |
operation on the database. The following paragraphs describe how the
|
1658 |
operation on the database. The following paragraphs describe how the
|
|
... |
|
... |
1989 |
exit 0
|
2024 |
exit 0
|
1990 |
</programlisting>
|
2025 |
</programlisting>
|
1991 |
</sect1>
|
2026 |
</sect1>
|
1992 |
</chapter>
|
2027 |
</chapter>
|
1993 |
|
2028 |
|
1994 |
<chapter id="sqlsc.samples">
|
2029 |
<chapter id="SAMPLES">
|
1995 |
<title>Sample scripts</title>
|
2030 |
<title>Sample scripts</title>
|
1996 |
|
2031 |
|
1997 |
<para>Three sample scripts are provided with the package (in the
|
2032 |
<para>Three sample scripts are provided with the package (in the
|
1998 |
samples directory). These are not real applications. For example you
|
2033 |
samples directory). These are not real applications. For example you
|
1999 |
have to set the password in the environment or edit the scripts to
|
2034 |
have to set the password in the environment or edit the scripts to
|