File: utilref.htm

package info (click to toggle)
tclodbc 2.5-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 984 kB
  • ctags: 417
  • sloc: sh: 3,764; cpp: 2,035; tcl: 591; makefile: 250
file content (291 lines) | stat: -rw-r--r-- 7,089 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<HTML><BODY>
<h2>Tclodbc 2.1 Utility Procedure Reference</h2>
<p>
<A HREF="#ColTypes">ColTypes</A>
<A HREF="#DumpSchema">DumpSchema</A>
<A HREF="#DumpTable">DumpTable</A>
<A HREF="#FieldFormat">FieldFormat</A>
<A HREF="#Justification">Justification</A>
<A HREF="#LoadSchema">LoadSchema</A>
<A HREF="#LoadSql">LoadSql</A>
<A HREF="#LoadTable">LoadTable</A>
<A HREF="#SqlDelete">SqlDelete</A>
<A HREF="#SqlInsert">SqlInsert</A>
<A HREF="#SqlSelect">SqlSelect</A>
<A HREF="#SqlShell">SqlShell</A>
<A HREF="#SqlTimeToTclTime">SqlTimeToTclTime</A>
<A HREF="#SqlUpdate">SqlUpdate</A>
<A HREF="#TableDef">TableDef</A>
<A HREF="#TableDefToSql">TableDefToSql</A>
<A HREF="#TclTimeToSqlTime">TclTimeToSqlTime</A>
<A HREF="#TkTableInit">TkTableInit</A>
<A HREF="#TkTableRead">TkTableRead</A>
</p>
<HR>
<h2><A NAME="ColTypes">ColTypes</A></h2>
<p>
</p>
<p>
Return list of column types for given columns. This list can
be used as statement argument specification.
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>db         : database object</li>
<li>table      : table name</li>
<li>columns    : column names</li>
</ul>
<h2><A NAME="DumpSchema">DumpSchema</A></h2>
<p>
</p>
<p>
Dumps whole database schema to a named file.
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>db         : database object name</li>
<li>filename   : filename</li>
</ul>
<h2><A NAME="DumpTable">DumpTable</A></h2>
<p>
</p>
<p>
Dump the contents of a named table to a file.
The filename may be given explicitly, but if not,
a default name of the form $tablename.d is used.
</p>
<p>
The .d file format is the following:
1st line contains the data column names.
from 2rd line forward, the data in tcl list format.
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>db         : database object name</li>
<li>table      : database table name</li>
<li>?filename? : filename, optional</li>
</ul>
<h2><A NAME="FieldFormat">FieldFormat</A></h2>
<p>
</p>
<p>
Formats given list of fields for output
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>fielddef    : field defininition list, {coltype ?fieldlenght?}</li>
<li>?data?      : field data, if empty, return a delimiter row</li>
</ul>
<h2><A NAME="Justification">Justification</A></h2>
<p>
</p>
<p>
Returns default justification of a column, right, left or center
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>coltype    : column type description, as returned by "stmt columns type precision scale displaysize"</li>
</ul>
<h2><A NAME="LoadSchema">LoadSchema</A></h2>
<p>
</p>
<p>
Loads whole database schema from a named file.
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>db         : database object name</li>
<li>filename   : filename</li>
<li>verbose    : puts lines before executing, useful when debugging sql</li>
</ul>
<h2><A NAME="LoadSql">LoadSql</A></h2>
<p>
</p>
<p>
Loads sql from a file to a database.
The input file should contain one sql statement per line.
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>db         : database object name</li>
<li>filename   : filename</li>
</ul>
<h2><A NAME="LoadTable">LoadTable</A></h2>
<p>
</p>
<p>
Loads the contents of a named table from a file.
The filename may be given explicitly, but if not,
a default name of the form $tablename.d is used.
The file format is assumed to be of the form generated
by DumpData procedure, described above.
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>db         : database object name</li>
<li>table      : database table name</li>
<li>?filename? : filename, optional</li>
</ul>
<h2><A NAME="SqlDelete">SqlDelete</A></h2>
<p>
</p>
<p>
Create command for creating a delete statement for given table
and columns.
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>db         : database object</li>
<li>stmt       : statement name</li>
<li>table      : table name</li>
<li>keycols    : key column names</li>
<li>?mode?     : mode, default is eval</li>
</ul>
<h2><A NAME="SqlInsert">SqlInsert</A></h2>
<p>
</p>
<p>
Return command for creating a insert statement for given table
and columns. Mode determines the action for the command. Useful
modes are e.g. eval, return and puts.
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>db         : database object</li>
<li>stmt       : statement name</li>
<li>table      : table name</li>
<li>columns    : column names</li>
<li>?mode?     : mode, default is eval</li>
</ul>
<h2><A NAME="SqlSelect">SqlSelect</A></h2>
<p>
</p>
<p>
Return command for creating a select statement for given table
and columns. Mode determines the action for the command. Useful
modes are e.g. eval, return and puts.
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>db         : database object</li>
<li>stmt       : statement name</li>
<li>table      : table name</li>
<li>datacols   : data column names</li>
<li>keycols    : key column names</li>
<li>?mode?     : mode, default is eval</li>
</ul>
<h2><A NAME="SqlShell">SqlShell</A></h2>
<p>
</p>
<p>
Very simple sql shell. Execute given statements and return data
in columnar format.
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>db          : db connection object</li>
</ul>
<h2><A NAME="SqlTimeToTclTime">SqlTimeToTclTime</A></h2>
<p>
</p>
<p>
Returns tcl time in seconds
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>sqltime     : sql timestamp of the form YYYY-MM-DD ?HH:MM:SS?</li>
</ul>
<h2><A NAME="SqlUpdate">SqlUpdate</A></h2>
<p>
</p>
<p>
Return command for creating a update statement for given table
and columns. Mode determines the action for the command. Useful
modes are e.g. eval, return and puts.
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>db         : database object</li>
<li>stmt       : statement name</li>
<li>table      : table name</li>
<li>datacols   : data column names</li>
<li>keycols    : key column names</li>
<li>?mode?     : mode, default is eval</li>
</ul>
<h2><A NAME="TableDef">TableDef</A></h2>
<p>
</p>
<p>
Return the definition of a named database table.
The definition consist of a list {tablename coldefs indexdefs}
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>db         : database object name</li>
<li>table      : database table name</li>
</ul>
<h2><A NAME="TableDefToSql">TableDefToSql</A></h2>
<p>
</p>
<p>
Transforms a TableDef as returned by procedure TableDef to a list
of driver specific sql data definition statements.
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>db         : database object name</li>
<li>tabledef   : database table name</li>
</ul>
<h2><A NAME="TclTimeToSqlTime">TclTimeToSqlTime</A></h2>
<p>
</p>
<p>
Returns sql timestamp of the form YYYY-MM-DD HH:MM:SS
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>tcltime     : tcl time as returned by [clock seconds]</li>
</ul>
<h2><A NAME="TkTableInit">TkTableInit</A></h2>
<p>
</p>
<p>
Initialize tk table widget for a given result set
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>table      : tktable widget name</li>
<li>stmt       : the name of a statement object</li>
</ul>
<h2><A NAME="TkTableRead">TkTableRead</A></h2>
<p>
</p>
<p>
Display whole result set in a tk table widget. The statement object
should be executed before calling this
</p>
<p>
</p>
<h3>Parameters</h3><ul>
<li>stmt       : the name of a statement object</li>
<li>table      : tktable widget name</li>
</ul>
</BODY></HTML>