1 | #!/usr/local/bin/csi -script |
---|
2 | ; vim: ts=2:sw=2:et: |
---|
3 | ; eggdoc-mysql.scm,v 1.8 2005/08/05 00:27:02 tbutzon Exp |
---|
4 | |
---|
5 | (use eggdoc) |
---|
6 | |
---|
7 | (define license-text #<<END |
---|
8 | Copyright (c) 2005 Toby Butzon. |
---|
9 | |
---|
10 | Permission is hereby granted, free of charge, to any person obtaining a |
---|
11 | copy of this software and associated documentation files (the "Software"), |
---|
12 | to deal in the Software without restriction, including without limitation |
---|
13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, |
---|
14 | and/or sell copies of the Software, and to permit persons to whom the |
---|
15 | Software is furnished to do so, subject to the following conditions: |
---|
16 | |
---|
17 | The above copyright notice and this permission notice shall be included |
---|
18 | in all copies or substantial portions of the Software. |
---|
19 | |
---|
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
---|
23 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
---|
24 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
---|
25 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
---|
26 | OTHER DEALINGS IN THE SOFTWARE. |
---|
27 | END |
---|
28 | ) |
---|
29 | |
---|
30 | (define ex1-text #<<END |
---|
31 | (use mysql) |
---|
32 | |
---|
33 | (let [(db (mysql-connect host: "mysql.example.com" user: "example" |
---|
34 | passwd: "secret"))] |
---|
35 | (mysql-query db "SHOW DATABASES") |
---|
36 | (do [(row (mysql-fetch-row db) (mysql-fetch-row db))] |
---|
37 | [(not row)] |
---|
38 | (display (conc "Row " idx ": " (row "Database") "\n"))) |
---|
39 | (mysql-close db)) |
---|
40 | END |
---|
41 | ) |
---|
42 | |
---|
43 | (define ex2-text #<<END |
---|
44 | (use mysql) |
---|
45 | |
---|
46 | (let [(db (mysql-connect host: "mysql.example.com" user: "example" |
---|
47 | passwd: "secret"))] |
---|
48 | (mysql-query-foreach db "SHOW DATABASES" |
---|
49 | (lambda (row idx) |
---|
50 | (display (conc "Row " idx ": " (row "Database") "\n")))) |
---|
51 | (mysql-close db)) |
---|
52 | END |
---|
53 | ) |
---|
54 | |
---|
55 | (define doc `( |
---|
56 | (eggdoc:begin |
---|
57 | (name "mysql") |
---|
58 | (description (p "MySQL bindings for Chicken.")) |
---|
59 | (author (url "mailto:toby@butzon.com" "Toby Butzon")) |
---|
60 | (history |
---|
61 | (version "1.31" "Additional functions & special handling of binary column. [Kon Lovett]") |
---|
62 | (version "1.3" "Additional functions. [Kon Lovett]") |
---|
63 | (version "1.2" "Fix for ticket #297. [Mario Domenech Goulart]") |
---|
64 | (version "1.1" "Cross-platform compilation fixes, et al.") |
---|
65 | (version "1.0" "Initial release") ) |
---|
66 | (requires (span "MySQL client library (" (tt "-lmysqlclient") ")")) |
---|
67 | (usage) |
---|
68 | (download "mysql.egg") |
---|
69 | |
---|
70 | (documentation |
---|
71 | |
---|
72 | (p |
---|
73 | "The MySQL egg provides (most of) the functions offered by the MySQL C " |
---|
74 | "API (the " (tt "foreign-mysql-*") " functions). It also provides a " |
---|
75 | "set of slightly more convenient Scheme functions (the " (tt "mysql-*") " " |
---|
76 | "functions). Finally, a few extra functions are provided for easy of use.") |
---|
77 | |
---|
78 | (p |
---|
79 | "Only the most often used MySQL functions are described in this " |
---|
80 | "document. If you really want to see the full listing, consult the " |
---|
81 | (url "mysql-mole.html" "mole documentation") ".") |
---|
82 | |
---|
83 | (p |
---|
84 | "Please send bug reports and suggestions to " |
---|
85 | (url "mailto:toby@butzon.com" "toby@butzon.com") ".") |
---|
86 | |
---|
87 | (subsection "Exceptions" |
---|
88 | |
---|
89 | (p |
---|
90 | "Conditions of the kind " (code "(exn mysql)") " are signaled " |
---|
91 | "for error situations." |
---|
92 | (symbol-table "Properties" |
---|
93 | (describe location "Where the error occured - usually a procedure name.") |
---|
94 | (describe arguments "Values that contributed to the error.") |
---|
95 | (describe message "Error message.")) ) |
---|
96 | ) |
---|
97 | |
---|
98 | (subsection "Connections" |
---|
99 | |
---|
100 | (procedure "(mysql-connect [KEYWORDS])" |
---|
101 | (p |
---|
102 | "Connect to a MySQL server.") |
---|
103 | (p |
---|
104 | "Returns a MySQL connection object suitable for passing to " |
---|
105 | "the other MySQL functions. This object is referred to as " |
---|
106 | (tt "CONN") " when passed by all the other MySQL functions. " |
---|
107 | "Signals an exception when the connection fails.") |
---|
108 | (p |
---|
109 | "Any number of the following " (tt "KEYWORDS") " may be included:" |
---|
110 | (ul |
---|
111 | (li (tt "host")) |
---|
112 | (li (tt "user")) |
---|
113 | (li (tt "passwd")) |
---|
114 | (li (tt "db")) |
---|
115 | (li (tt "port")) |
---|
116 | (li (tt "unix-socket")) |
---|
117 | (li (tt "client-flag")) |
---|
118 | (li (tt "ssl") |
---|
119 | " - A " (code "mysql-ssl") " record object.") |
---|
120 | (li (tt "options") |
---|
121 | " - An association list of " (code "(<mysql-option> . <object>)") "."))) |
---|
122 | (p |
---|
123 | "Note that default values are available for all of these " |
---|
124 | "arguments. (Consult the " |
---|
125 | (url "http://dev.mysql.com/doc/mysql/en/c.html" "MySQL C API") " " |
---|
126 | "for details on how these defaults are determined.)") ) |
---|
127 | |
---|
128 | (procedure "(mysql-connection? OBJECT)" |
---|
129 | (p |
---|
130 | "Is the " (tt "OBJECT") " a " (code "mysql-connection") "? " |
---|
131 | "Referred to as a " (tt "CONN") ".") ) |
---|
132 | |
---|
133 | (procedure "(mysql-close CONN)" |
---|
134 | (p |
---|
135 | "Closes the connection to " (tt "CONN") ". This frees any remaining " |
---|
136 | "MySQL resources from memory, but invalidates the MySQL connection " |
---|
137 | "object (" (tt "CONN") ") so that it may no longer be used.") ) |
---|
138 | |
---|
139 | (subsubsection "Connect Parameter Constructors" |
---|
140 | |
---|
141 | (procedure "(make-mysql-options OPTION-FLAG OPTION-VALUE ...)" |
---|
142 | (p |
---|
143 | "Returns an object suitable as the " (tt "options") " parameter for " |
---|
144 | (code "mysql-connect") ".") |
---|
145 | (p |
---|
146 | "The type of the " (tt "OPTION-VALUE") " is dependent on the " |
---|
147 | (tt "OPTION-FLAG") ".") ) |
---|
148 | |
---|
149 | (procedure "(make-mysql-ssl [KEYWORD ...])" |
---|
150 | (p |
---|
151 | "Returns a " (code "mysql-ssl") " record.") |
---|
152 | (p |
---|
153 | "Any number of the following " (tt "KEYWORD ...") " may be included:" |
---|
154 | (ul |
---|
155 | (li (tt "key") " - pathname of key file.") |
---|
156 | (li (tt "certificate") " - pathname of certificate file.") |
---|
157 | (li (tt "certificate-authority") " - pathname of certificate authority file.") |
---|
158 | (li (tt "trusted-certificates") " - pathname of trusted certificates directory.") |
---|
159 | (li (tt "ciphers") |
---|
160 | " - See " (url "http://www.openssl.org/docs/apps/ciphers.html" |
---|
161 | "OpenSSL Ciphers Man Page")))) ) |
---|
162 | |
---|
163 | (procedure "(mysql-ssl? OBJECT)" |
---|
164 | (p |
---|
165 | "Is the " (tt "OBJECT") " an " (code "mysql-ssl") " record?") ) |
---|
166 | |
---|
167 | (procedure "(mysql-ssl-key-pathname MYSQL-SSL)" |
---|
168 | (p |
---|
169 | "Returns a " (code "string") ".") ) |
---|
170 | |
---|
171 | (procedure "(mysql-ssl-certificate-pathname MYSQL-SSL)" |
---|
172 | (p |
---|
173 | "Returns a " (code "string") ".") ) |
---|
174 | |
---|
175 | (procedure "(mysql-ssl-certificate-authority-pathname MYSQL-SSL)" |
---|
176 | (p |
---|
177 | "Returns a " (code "string") ".") ) |
---|
178 | |
---|
179 | (procedure "(mysql-ssl-trusted-certificates-pathname MYSQL-SSL)" |
---|
180 | (p |
---|
181 | "Returns a " (code "string") ".") ) |
---|
182 | |
---|
183 | (procedure "(mysql-ssl-ciphers MYSQL-SSL)" |
---|
184 | (p |
---|
185 | "Returns a " (code "string") ".") ) |
---|
186 | ) |
---|
187 | ) |
---|
188 | |
---|
189 | (subsection "Basic Query Operations" |
---|
190 | |
---|
191 | (procedure "(mysql-query CONN SQL-STRING)" |
---|
192 | (p |
---|
193 | "Executes " (tt "SQL-STRING") " on the MySQL server " |
---|
194 | "and stores the result in memory. Signals an exception " |
---|
195 | "if the query fails.") ) |
---|
196 | |
---|
197 | (procedure "(mysql-fetch-row CONN)" |
---|
198 | (p |
---|
199 | "Fetches a row from the result set returned by the " |
---|
200 | "most recent call to " (tt "mysql-query") ". If the " |
---|
201 | "last query failed, or if there are no more rows left " |
---|
202 | "in the result set, returns " (tt "#f") "; otherwise " |
---|
203 | "returns a row object.") |
---|
204 | (a (@ (" name='rowobj'"))) |
---|
205 | (p |
---|
206 | "A row object is defined as a function that " |
---|
207 | "takes a single argument. If the argument is a number, " |
---|
208 | "the function returns the value of the field for which " |
---|
209 | "that number is the index, or " (tt "#f") " if the " |
---|
210 | "index is out of range. Otherwise, the argument must " |
---|
211 | "be a symbol or string, in which case the function returns " |
---|
212 | "the value of the field for which that string (or symbol " |
---|
213 | "converted into a string) is the field/column name. If " |
---|
214 | "no such field exists, returns " (tt "#f") ".") ) |
---|
215 | |
---|
216 | (procedure "(mysql-field-count CONN)" |
---|
217 | (p |
---|
218 | "Returns the number of columns for the most recent query.") ) |
---|
219 | |
---|
220 | (procedure "(mysql-fetch-lengths CONN)" |
---|
221 | (p |
---|
222 | "Returns a " (code "u32vector") " of the lengths of the columns " |
---|
223 | "of the current row.") ) |
---|
224 | |
---|
225 | (procedure "(mysql-rewind CONN)" |
---|
226 | (p |
---|
227 | "Rewinds the result set; that is, resets the pointer used by " |
---|
228 | (tt "mysql-fetch-row") " so that the next call to it will " |
---|
229 | "return the first row of the result set. If there is no current " |
---|
230 | "result set, does nothing.") ) |
---|
231 | |
---|
232 | (procedure "(mysql-num-rows CONN)" |
---|
233 | (p |
---|
234 | "Returns the number of rows in the current result set. " |
---|
235 | "If no result set exists, returns " (tt "#f") ".") ) |
---|
236 | |
---|
237 | (procedure "(mysql-num-fields CONN)" |
---|
238 | (p |
---|
239 | "Returns the number of fields in the current result set. " |
---|
240 | "If no result set exists, returns " (tt "#f") ".") ) |
---|
241 | |
---|
242 | (procedure "(mysql-affected-rows CONN)" |
---|
243 | (p |
---|
244 | "Returns the number of rows affected by the current query.") ) |
---|
245 | ) |
---|
246 | |
---|
247 | (subsection "Row Mapping" |
---|
248 | |
---|
249 | (procedure "(mysql-row-fold CONN PROC INIT)" |
---|
250 | (p |
---|
251 | "Iterates over the entire result set (regardless of any rows that may " |
---|
252 | "have already been returned by " (tt "mysql-fetch-row") "), calling " |
---|
253 | (tt "PROC") " on each row.") |
---|
254 | (p |
---|
255 | "Returns the final accumulated value.") |
---|
256 | (p |
---|
257 | (tt "PROC") " must take three arguments: the row (as " |
---|
258 | (url "#rowobj" "described") ") for " (tt "mysql-fetch-row") ", " |
---|
259 | "the index of that row in the result set, starting with " (tt "1") " " |
---|
260 | "and ending with " (tt "(mysql-num-rows CONN)") ", and the " |
---|
261 | "current accumulated value (initially " (tt "INIT") ").") |
---|
262 | (p |
---|
263 | (tt "PROC") " must return a value.") ) |
---|
264 | |
---|
265 | (procedure "(mysql-row-for-each CONN PROC)" |
---|
266 | (p |
---|
267 | "Iterates over the entire result set (regardless of any rows that " |
---|
268 | "may have already been returned by " (tt "mysql-fetch-row") "), calling " |
---|
269 | (tt "PROC") " on each row.") |
---|
270 | (p |
---|
271 | (tt "PROC") " must take three arguments: the row (as " |
---|
272 | (url "#rowobj" "described") ") for " (tt "mysql-fetch-row") |
---|
273 | ", and the index of that row in the result set, starting with " |
---|
274 | (tt "1") " and ending with " (tt "(mysql-num-rows CONN)") ".") ) |
---|
275 | |
---|
276 | (procedure "(mysql-row-map CONN PROC)" |
---|
277 | (p |
---|
278 | "Iterates over the entire result set (regardless of any rows that " |
---|
279 | "may have already been returned by " (tt "mysql-fetch-row") "), " |
---|
280 | "calling " (tt "PROC") " on each row.") |
---|
281 | (p |
---|
282 | "Returns the list of results of the " (tt "PROC") " invocations.") |
---|
283 | (p |
---|
284 | (tt "PROC") " must take three arguments: the row (as " |
---|
285 | (url "#rowobj" "described") ") for " (tt "mysql-fetch-row") |
---|
286 | ", and the index of that row in the result set, starting " |
---|
287 | "with " (tt "1") " and ending with " (tt "(mysql-num-rows CONN)") ".") |
---|
288 | (p |
---|
289 | (tt "PROC") " must return a value.") ) |
---|
290 | |
---|
291 | (procedure "(mysql-query-fold CONN QUERY PROC INIT)" |
---|
292 | (p |
---|
293 | "Combines " (tt "mysql-query") " and " (tt "mysql-row-fold") ".") ) |
---|
294 | |
---|
295 | (procedure "(mysql-query-for-each CONN QUERY PROC)" |
---|
296 | (p |
---|
297 | "Combines " (tt "mysql-query") " and " (tt "mysql-row-for-each") ".") ) |
---|
298 | |
---|
299 | (procedure "(mysql-query-map CONN QUERY PROC)" |
---|
300 | (p |
---|
301 | "Combines " (tt "mysql-query") " and " (tt "mysql-row-map") ".") ) |
---|
302 | |
---|
303 | (procedure "(mysql-foreach-row CONN BODY)" |
---|
304 | (p |
---|
305 | "Synonym for " (code "mysql-row-for-each") ".") ) |
---|
306 | |
---|
307 | (procedure "(mysql-query-foreach CONN QUERY BODY)" |
---|
308 | (p |
---|
309 | "Synonym for " (code "mysql-query-for-each") ".") ) |
---|
310 | ) |
---|
311 | |
---|
312 | (subsection "MYSQL_FIELD Access" |
---|
313 | |
---|
314 | (procedure "(mysql-fetch-field CONN)" |
---|
315 | (p |
---|
316 | "Returns a " (code "mysql-field-ptr") " to the next field, or " (code "#f") ".") ) |
---|
317 | |
---|
318 | (procedure "(mysql-fetch-fields CONN)" |
---|
319 | (p |
---|
320 | "Returns a " (code "mysql-field-ptr") " to the first field, or " (code "#f") ".") ) |
---|
321 | |
---|
322 | (procedure "(mysql-fetch-field-direct CONN MYSQL-FIELD-NUMBER)" |
---|
323 | (p |
---|
324 | "Returns a " (code "mysql-field-ptr") " to a specific field, or " (code "#f") ".") ) |
---|
325 | |
---|
326 | (procedure "(mysql-field-slots MYSQL-FIELD-POINTER MYSQL-FIELD-GETTER ...)" |
---|
327 | (p |
---|
328 | "Returns a list of MYSQL_FIELD entry values, " |
---|
329 | "from each " (tt "MYSQL-FIELD-GETTER") ".") |
---|
330 | (p |
---|
331 | (tt "MYSQL-FIELD-POINTER") " is a pointer to a MYSQL_FIELD, or " |
---|
332 | (code "#f") ". " |
---|
333 | (tt "MYSQL-FIELD-GETTER") " is a " (code "mysql-field-*") " " |
---|
334 | "reference function.") ) |
---|
335 | |
---|
336 | (procedure "(mysql-fetch-field-slot-direct CONN FIELD-NUMBER MYSQL-FIELD-GETTER)" |
---|
337 | (p |
---|
338 | "Returns a field slot value. " |
---|
339 | "Combines " (code "mysql-fetch-field-direct") " and " |
---|
340 | (code "mysql-field-slots") ".") ) |
---|
341 | |
---|
342 | (procedure "(mysql-fetch-field-slot CONN MYSQL-FIELD-GETTER)" |
---|
343 | (p |
---|
344 | "Returns a field slot value. " |
---|
345 | "Combines " (code "mysql-fetch-field") " and " |
---|
346 | (code "mysql-field-slots") ".") ) |
---|
347 | |
---|
348 | (procedure "(mysql-fetch-field-slots-direct CONN FIELD-NUMBER MYSQL-FIELD-GETTER ...)" |
---|
349 | (p |
---|
350 | "Returns a list of field slot values. " |
---|
351 | "Combines " (code "mysql-fetch-field-direct") " and " |
---|
352 | (code "mysql-field-slots") ".") ) |
---|
353 | |
---|
354 | (procedure "(mysql-fetch-field-slots CONN MYSQL-FIELD-GETTER ...)" |
---|
355 | (p |
---|
356 | "Returns a list of field slot values. " |
---|
357 | "Combines " (code "mysql-fetch-field") " and " |
---|
358 | (code "mysql-field-slots") ".") ) |
---|
359 | |
---|
360 | (subsubsection "Slot Getters" |
---|
361 | |
---|
362 | (procedure "(mysql-field-org-name MYSQL-FIELD-POINTER)" |
---|
363 | (p |
---|
364 | "Returns " (code "string") ".") ) |
---|
365 | |
---|
366 | (procedure "(mysql-field-name MYSQL-FIELD-POINTER)" |
---|
367 | (p |
---|
368 | "Returns " (code "string") ".") ) |
---|
369 | |
---|
370 | (procedure "(mysql-field-org-table MYSQL-FIELD-POINTER)" |
---|
371 | (p |
---|
372 | "Returns " (code "string") ".") ) |
---|
373 | |
---|
374 | (procedure "(mysql-field-org-table MYSQL-FIELD-POINTER)" |
---|
375 | (p |
---|
376 | "Returns " (code "string") ".") ) |
---|
377 | |
---|
378 | (procedure "(mysql-field-db MYSQL-FIELD-POINTER)" |
---|
379 | (p |
---|
380 | "Returns " (code "string") ".") ) |
---|
381 | |
---|
382 | (procedure "(mysql-field-catalog MYSQL-FIELD-POINTER)" |
---|
383 | (p |
---|
384 | "Returns " (code "string") ".") ) |
---|
385 | |
---|
386 | (procedure "(mysql-field-def MYSQL-FIELD-POINTER)" |
---|
387 | (p |
---|
388 | "Returns " (code "string") ".") ) |
---|
389 | |
---|
390 | (procedure "(mysql-field-table MYSQL-FIELD-POINTER)" |
---|
391 | (p |
---|
392 | "Returns " (code "string") ".") ) |
---|
393 | |
---|
394 | (procedure "(mysql-field-type MYSQL-FIELD-POINTER)" |
---|
395 | (p |
---|
396 | "Returns " (code "enum enum_field_types value") ".") ) |
---|
397 | |
---|
398 | (procedure "(mysql-field-charsetnr MYSQL-FIELD-POINTER)" |
---|
399 | (p |
---|
400 | "Returns " (code "unsigned-integer") ".") ) |
---|
401 | |
---|
402 | (procedure "(mysql-field-flags MYSQL-FIELD-POINTER)" |
---|
403 | (p |
---|
404 | "Returns " (code "unsigned-integer") ".") ) |
---|
405 | |
---|
406 | (procedure "(mysql-field-decimals MYSQL-FIELD-POINTER)" |
---|
407 | (p |
---|
408 | "Returns " (code "unsigned-integer") ".") ) |
---|
409 | |
---|
410 | (procedure "(mysql-field-def-length MYSQL-FIELD-POINTER)" |
---|
411 | (p |
---|
412 | "Returns " (code "unsigned-integer") ".") ) |
---|
413 | |
---|
414 | (procedure "(mysql-field-catalog-length MYSQL-FIELD-POINTER)" |
---|
415 | (p |
---|
416 | "Returns " (code "unsigned-integer") ".") ) |
---|
417 | |
---|
418 | (procedure "(mysql-field-db-length MYSQL-FIELD-POINTER)" |
---|
419 | (p |
---|
420 | "Returns " (code "unsigned-integer") ".") ) |
---|
421 | |
---|
422 | (procedure "(mysql-field-org-table-length MYSQL-FIELD-POINTER)" |
---|
423 | (p |
---|
424 | "Returns " (code "unsigned-integer") ".") ) |
---|
425 | |
---|
426 | (procedure "(mysql-field-table-length MYSQL-FIELD-POINTER)" |
---|
427 | (p |
---|
428 | "Returns " (code "unsigned-integer") ".") ) |
---|
429 | |
---|
430 | (procedure "(mysql-field-org-name-length MYSQL-FIELD-POINTER)" |
---|
431 | (p |
---|
432 | "Returns " (code "unsigned-integer") ".") ) |
---|
433 | |
---|
434 | (procedure "(mysql-field-name-length MYSQL-FIELD-POINTER)" |
---|
435 | (p |
---|
436 | "Returns " (code "unsigned-integer") ".") ) |
---|
437 | |
---|
438 | (procedure "(mysql-field-max-length MYSQL-FIELD-POINTER)" |
---|
439 | (p |
---|
440 | "Returns " (code "unsigned-integer") ".") ) |
---|
441 | |
---|
442 | (procedure "(mysql-field-length MYSQL-FIELD-POINTER)" |
---|
443 | (p |
---|
444 | "Returns " (code "unsigned-integer") ".") ) |
---|
445 | ) |
---|
446 | ) |
---|
447 | |
---|
448 | (subsection "Field Flag Testing" |
---|
449 | |
---|
450 | (procedure "(mysql-field-flags-on? MYSQL-FIELD-POINTER MYSQL-FIELD-FLAG ...)" |
---|
451 | (p |
---|
452 | "Does the field, " (tt "MYSQL-FIELD-POINTER") ", have all of the " |
---|
453 | (tt "MYSQL-FIELD-FLAG ...") " set?") ) |
---|
454 | |
---|
455 | (procedure "(mysql-field-flags-off? MYSQL-FIELD-POINTER MYSQL-FIELD-FLAG ...)" |
---|
456 | (p |
---|
457 | "Does the field, " (tt "MYSQL-FIELD-POINTER") ", have all of the " |
---|
458 | (tt "MYSQL-FIELD-FLAG ...") " not set?") ) |
---|
459 | |
---|
460 | (procedure "(mysql-field-primary-key? MYSQL-FIELD-POINTER)" |
---|
461 | (p |
---|
462 | "Is the field, " (tt "MYSQL-FIELD-POINTER") ", a primary key?") ) |
---|
463 | |
---|
464 | (procedure "(mysql-field-not-null? MYSQL-FIELD-POINTER)" |
---|
465 | (p |
---|
466 | "Is the field, " (tt "MYSQL-FIELD-POINTER") ", not null?") ) |
---|
467 | |
---|
468 | (procedure "(mysql-field-binary? MYSQL-FIELD-POINTER)" |
---|
469 | (p |
---|
470 | "Is the field, " (tt "MYSQL-FIELD-POINTER") ", binary?") ) |
---|
471 | |
---|
472 | (procedure "(mysql-field-numeric? MYSQL-FIELD-POINTER)" |
---|
473 | (p |
---|
474 | "Is the field, " (tt "MYSQL-FIELD-POINTER") ", numeric?") ) |
---|
475 | ) |
---|
476 | |
---|
477 | (subsection "Field Type Testing" |
---|
478 | |
---|
479 | (procedure "(mysql-field-type-any? MYSQL-FIELD-POINTER MYSQL-TYPE ...)" |
---|
480 | (p |
---|
481 | "Is the field, " (tt "MYSQL-FIELD-POINTER") ", type any of " |
---|
482 | (tt "MYSQL-TYPE ...") "?") ) |
---|
483 | |
---|
484 | (procedure "(mysql-field-type=? MYSQL-FIELD-POINTER MYSQL-TYPE)" |
---|
485 | (p |
---|
486 | "Is the field, " (tt "MYSQL-FIELD-POINTER") ", " (tt "MYSQL-TYPE") "?") ) |
---|
487 | |
---|
488 | (procedure "(mysql-field-type-clock? MYSQL-FIELD-POINTER)" |
---|
489 | (p |
---|
490 | "Is the field, " (tt "MYSQL-FIELD-POINTER") ", type time or date related?") ) |
---|
491 | |
---|
492 | (procedure "(mysql-field-type-number? MYSQL-FIELD-POINTER)" |
---|
493 | (p |
---|
494 | "Is the field, " (tt "MYSQL-FIELD-POINTER") ", type a number?") ) |
---|
495 | |
---|
496 | (procedure "(mysql-field-type-blob? MYSQL-FIELD-POINTER)" |
---|
497 | (p |
---|
498 | "Is the field, " (tt "MYSQL-FIELD-POINTER") ", type some kind of blob?") ) |
---|
499 | |
---|
500 | (procedure "(mysql-field-type-string? MYSQL-FIELD-POINTER)" |
---|
501 | (p |
---|
502 | "Is the field, " (tt "MYSQL-FIELD-POINTER") ", type some kind of string?") ) |
---|
503 | |
---|
504 | (procedure "(mysql-field-type-magnitude? MYSQL-FIELD-POINTER)" |
---|
505 | (p |
---|
506 | "Is the field, " (tt "MYSQL-FIELD-POINTER") ", type some kind of number?") ) |
---|
507 | |
---|
508 | (procedure "(mysql-field-type-binary? MYSQL-FIELD-POINTER)" |
---|
509 | (p |
---|
510 | "Is the field, " (tt "MYSQL-FIELD-POINTER") ", type some kind of " |
---|
511 | "binary string or blob?") ) |
---|
512 | |
---|
513 | (procedure "(mysql-field-type-text? MYSQL-FIELD-POINTER)" |
---|
514 | (p |
---|
515 | "Is the field, " (tt "MYSQL-FIELD-POINTER") ", type some kind of " |
---|
516 | "non-binary string or blob?") ) |
---|
517 | ) |
---|
518 | |
---|
519 | (subsection "Character Set Access" |
---|
520 | |
---|
521 | (procedure "(mysql-set-character-set CONN CHARACTER-SET-NAME)" |
---|
522 | (p |
---|
523 | "Sets the current character set.") ) |
---|
524 | |
---|
525 | (procedure "(mysql-character-set-name CONN)" |
---|
526 | (p |
---|
527 | "Returns a " (tt "string") ".") ) |
---|
528 | |
---|
529 | (procedure "(mysql-get-character-set-info CONN)" |
---|
530 | (p |
---|
531 | "Returns a " (tt "MY-CHARSET-INFO-POINTER") ".") ) |
---|
532 | |
---|
533 | (subsubsection "Slot Getters" |
---|
534 | |
---|
535 | (procedure "(my-charset-info-name MY-CHARSET-INFO-POINTER)" |
---|
536 | (p |
---|
537 | "Return a " (code "string") ".") ) |
---|
538 | |
---|
539 | (procedure "(my-charset-info-csname MY-CHARSET-INFO-POINTER)" |
---|
540 | (p |
---|
541 | "Return a " (code "string") ".") ) |
---|
542 | |
---|
543 | (procedure "(my-charset-info-comment MY-CHARSET-INFO-POINTER)" |
---|
544 | (p |
---|
545 | "Return a " (code "string") ".") ) |
---|
546 | |
---|
547 | (procedure "(my-charset-info-dir MY-CHARSET-INFO-POINTER)" |
---|
548 | (p |
---|
549 | "Return a " (code "string") ".") ) |
---|
550 | |
---|
551 | (procedure "(my-charset-info-mbminlen MY-CHARSET-INFO-POINTER)" |
---|
552 | (p |
---|
553 | "Return a " (code "number") ".") ) |
---|
554 | |
---|
555 | (procedure "(my-charset-info-mbmaxlen MY-CHARSET-INFO-POINTER)" |
---|
556 | (p |
---|
557 | "Return a " (code "number") ".") ) |
---|
558 | ) |
---|
559 | ) |
---|
560 | |
---|
561 | (subsection "Miscellaneous Procedures" |
---|
562 | |
---|
563 | (procedure "(mysql-change-user CONN [KEYWORD ...])" |
---|
564 | (p |
---|
565 | "Changes the user identity.") |
---|
566 | (p |
---|
567 | "Any number of the following " (tt "KEYWORD ...") " may be included:" |
---|
568 | (ul |
---|
569 | (li (tt "user")) |
---|
570 | (li (tt "passwd")) |
---|
571 | (li (tt "db")))) ) |
---|
572 | |
---|
573 | (procedure "(mysql-debug DEBUG)" |
---|
574 | (p |
---|
575 | ".") ) |
---|
576 | |
---|
577 | (procedure "(mysql-dump-debug-info CONN)" |
---|
578 | (p |
---|
579 | ".") ) |
---|
580 | |
---|
581 | (procedure "(mysql-errno CONN)" |
---|
582 | (p |
---|
583 | ".") ) |
---|
584 | |
---|
585 | (procedure "(mysql-error CONN)" |
---|
586 | (p |
---|
587 | "Returns a string describing the last mysql error, or #f if no error has occurred.") ) |
---|
588 | |
---|
589 | (procedure "(mysql-escape-string CONN SQL)" |
---|
590 | (p |
---|
591 | "Returns an escape encoded form of the " (tt "SQL") " string.") ) |
---|
592 | |
---|
593 | (procedure "(mysql-free-result CONN)" |
---|
594 | (p |
---|
595 | ".") ) |
---|
596 | |
---|
597 | (procedure "(mysql-get-client-info)" |
---|
598 | (p |
---|
599 | ".") ) |
---|
600 | |
---|
601 | (procedure "(mysql-get-client-version)" |
---|
602 | (p |
---|
603 | ".") ) |
---|
604 | |
---|
605 | (procedure "(mysql-get-host-info CONN)" |
---|
606 | (p |
---|
607 | ".") ) |
---|
608 | |
---|
609 | (procedure "(mysql-get-proto-info CONN)" |
---|
610 | (p |
---|
611 | ".") ) |
---|
612 | |
---|
613 | (procedure "(mysql-get-server-info CONN)" |
---|
614 | (p |
---|
615 | ".") ) |
---|
616 | |
---|
617 | (procedure "(mysql-get-server-version CONN)" |
---|
618 | (p |
---|
619 | ".") ) |
---|
620 | |
---|
621 | (procedure "(mysql-info CONN)" |
---|
622 | (p |
---|
623 | ".") ) |
---|
624 | |
---|
625 | (procedure "(mysql-insert-id CONN)" |
---|
626 | (p |
---|
627 | ".") ) |
---|
628 | |
---|
629 | (procedure "(mysql-kill CONN PID)" |
---|
630 | (p |
---|
631 | ".") ) |
---|
632 | |
---|
633 | (procedure "(mysql-list-dbs CONN LIKE)" |
---|
634 | (p |
---|
635 | ".") ) |
---|
636 | |
---|
637 | (procedure "(mysql-list-fields CONN TABLE WILD)" |
---|
638 | (p |
---|
639 | ".") ) |
---|
640 | |
---|
641 | (procedure "(mysql-list-processes CONN)" |
---|
642 | (p |
---|
643 | ".") ) |
---|
644 | |
---|
645 | (procedure "(mysql-list-tables CONN WILD)" |
---|
646 | (p |
---|
647 | ".") ) |
---|
648 | |
---|
649 | (procedure "(mysql-num-fields CONN)" |
---|
650 | (p |
---|
651 | ".") ) |
---|
652 | |
---|
653 | (procedure "(mysql-num-rows CONN)" |
---|
654 | (p |
---|
655 | ".") ) |
---|
656 | |
---|
657 | (procedure "(mysql-ping CONN)" |
---|
658 | (p |
---|
659 | ".") ) |
---|
660 | |
---|
661 | (procedure "(mysql-select-db CONN DB)" |
---|
662 | (p |
---|
663 | "Returns " (code "#t") " if the select was successful, " |
---|
664 | "signals exception otherwise.") ) |
---|
665 | |
---|
666 | (procedure "(mysql-stat CONN)" |
---|
667 | (p |
---|
668 | ".") ) |
---|
669 | |
---|
670 | (procedure "(mysql-store-result CONN)" |
---|
671 | (p |
---|
672 | ".") ) |
---|
673 | |
---|
674 | (procedure "(mysql-thread-id CONN)" |
---|
675 | (p |
---|
676 | ".") ) |
---|
677 | ) |
---|
678 | |
---|
679 | (subsection "Enumerations & Flags" |
---|
680 | |
---|
681 | (subsubsection "Client Flags" |
---|
682 | |
---|
683 | (p |
---|
684 | (symbol-table "Symbolic Value" |
---|
685 | (describe client-compress "CLIENT_COMPRESS") |
---|
686 | (describe client-found-rows "CLIENT_FOUND_ROWS") |
---|
687 | (describe client-ignore-sigpipe "CLIENT_IGNORE_SIGPIPE") |
---|
688 | (describe client-ignore-space "CLIENT_IGNORE_SPACE") |
---|
689 | (describe client-interactive "CLIENT_INTERACTIVE") |
---|
690 | (describe client-local-files "CLIENT_LOCAL_FILES") |
---|
691 | (describe client-multi-results "CLIENT_MULTI_RESULTS") |
---|
692 | (describe client-multi-statements "CLIENT_MULTI_STATEMENTS") |
---|
693 | (describe client-no-schema "CLIENT_NO_SCHEMA") |
---|
694 | (describe client-odbc "CLIENT_ODBC") |
---|
695 | (describe client-ssl "CLIENT_SSL") ) ) |
---|
696 | |
---|
697 | (procedure "(mysql-client-flags-value SYMBOL ...)" |
---|
698 | (p |
---|
699 | "Returns the or'ed value of the " (tt "SYMBOL ...") " values.") ) |
---|
700 | |
---|
701 | (procedure "(mysql-client-flags-symbol NUMBER)" |
---|
702 | (p |
---|
703 | "Returns the symbol for the " (tt "NUMBER") ".") ) |
---|
704 | ) |
---|
705 | |
---|
706 | (subsubsection "enum enum_mysql_set_option" |
---|
707 | |
---|
708 | (p |
---|
709 | (symbol-table "Symbolic Value" |
---|
710 | (describe mysql-option-multi-statements-on "MYSQL_OPTION_MULTI_STATEMENTS_ON") |
---|
711 | (describe mysql-option-multi-statements-off "MYSQL_OPTION_MULTI_STATEMENTS_OFF") ) ) |
---|
712 | |
---|
713 | (procedure "(mysql-server-option-value SYMBOL ...)" |
---|
714 | (p |
---|
715 | "Returns the or'ed value of the " (tt "SYMBOL ...") " values.") ) |
---|
716 | |
---|
717 | (procedure "(mysql-server-option-symbol NUMBER)" |
---|
718 | (p |
---|
719 | "Returns the symbol for the " (tt "NUMBER") ".") ) |
---|
720 | ) |
---|
721 | |
---|
722 | (subsubsection "enum mysql_option" |
---|
723 | |
---|
724 | (p |
---|
725 | (symbol-table "Symbolic Value" |
---|
726 | (describe mysql-opt-connect-timeout "MYSQL_OPT_CONNECT_TIMEOUT") |
---|
727 | (describe mysql-opt-compress "MYSQL_OPT_COMPRESS") |
---|
728 | (describe mysql-opt-named-pipe "MYSQL_OPT_NAMED_PIPE") |
---|
729 | (describe mysql-init-command "MYSQL_INIT_COMMAND") |
---|
730 | (describe mysql-read-default-file "MYSQL_READ_DEFAULT_FILE") |
---|
731 | (describe mysql-read-default-group "MYSQL_READ_DEFAULT_GROUP") |
---|
732 | (describe mysql-set-charset-dir "MYSQL_SET_CHARSET_DIR") |
---|
733 | (describe mysql-set-charset-name "MYSQL_SET_CHARSET_NAME") |
---|
734 | (describe mysql-opt-local-infile "MYSQL_OPT_LOCAL_INFILE") |
---|
735 | (describe mysql-opt-protocol "MYSQL_OPT_PROTOCOL") |
---|
736 | (describe mysql-shared-memory-base-name "MYSQL_SHARED_MEMORY_BASE_NAME") |
---|
737 | (describe mysql-opt-read-timeout "MYSQL_OPT_READ_TIMEOUT") |
---|
738 | (describe mysql-opt-write-timeout "MYSQL_OPT_WRITE_TIMEOUT") |
---|
739 | (describe mysql-opt-use-result "MYSQL_OPT_USE_RESULT") |
---|
740 | (describe mysql-opt-use-remote-connection "MYSQL_OPT_USE_REMOTE_CONNECTION") |
---|
741 | (describe mysql-opt-use-embedded-connection "MYSQL_OPT_USE_EMBEDDED_CONNECTION") |
---|
742 | (describe mysql-opt-guess-connection "MYSQL_OPT_GUESS_CONNECTION") |
---|
743 | (describe mysql-set-client-ip "MYSQL_SET_CLIENT_IP") |
---|
744 | (describe mysql-secure-auth "MYSQL_SECURE_AUTH") |
---|
745 | (describe mysql-report-data-truncation "MYSQL_REPORT_DATA_TRUNCATION") ) ) |
---|
746 | |
---|
747 | (procedure "(mysql-option-value SYMBOL ...)" |
---|
748 | (p |
---|
749 | "Returns the or'ed value of the " (tt "SYMBOL ...") " values.") ) |
---|
750 | |
---|
751 | (procedure "(mysql-option-symbol NUMBER)" |
---|
752 | (p |
---|
753 | "Returns the symbol for the " (tt "NUMBER") ".") ) |
---|
754 | ) |
---|
755 | |
---|
756 | (subsubsection "enum enum_field_types" |
---|
757 | |
---|
758 | (p |
---|
759 | (symbol-table "Symbolic Value" |
---|
760 | (describe mysql-type-decimal "MYSQL_TYPE_DECIMAL") |
---|
761 | (describe mysql-type-tiny "MYSQL_TYPE_TINY") |
---|
762 | (describe mysql-type-short "MYSQL_TYPE_SHORT") |
---|
763 | (describe mysql-type-long "MYSQL_TYPE_LONG") |
---|
764 | (describe mysql-type-float "MYSQL_TYPE_FLOAT") |
---|
765 | (describe mysql-type-double "MYSQL_TYPE_DOUBLE") |
---|
766 | (describe mysql-type-null "MYSQL_TYPE_NULL") |
---|
767 | (describe mysql-type-timestamp "MYSQL_TYPE_TIMESTAMP") |
---|
768 | (describe mysql-type-longlong "MYSQL_TYPE_LONGLONG") |
---|
769 | (describe mysql-type-int24 "MYSQL_TYPE_INT24") |
---|
770 | (describe mysql-type-date "MYSQL_TYPE_DATE") |
---|
771 | (describe mysql-type-time "MYSQL_TYPE_TIME") |
---|
772 | (describe mysql-type-datetime "MYSQL_TYPE_DATETIME") |
---|
773 | (describe mysql-type-year "MYSQL_TYPE_YEAR") |
---|
774 | (describe mysql-type-newdate "MYSQL_TYPE_NEWDATE") |
---|
775 | (describe mysql-type-varchar "MYSQL_TYPE_VARCHAR") |
---|
776 | (describe mysql-type-bit "MYSQL_TYPE_BIT") |
---|
777 | (describe mysql-type-newdecimal "MYSQL_TYPE_NEWDECIMAL") |
---|
778 | (describe mysql-type-enum "MYSQL_TYPE_ENUM") |
---|
779 | (describe mysql-type-set "MYSQL_TYPE_SET") |
---|
780 | (describe mysql-type-tiny-blob "MYSQL_TYPE_TINY_BLOB") |
---|
781 | (describe mysql-type-medium-blob "MYSQL_TYPE_MEDIUM_BLOB") |
---|
782 | (describe mysql-type-long-blob "MYSQL_TYPE_LONG_BLOB") |
---|
783 | (describe mysql-type-blob "MYSQL_TYPE_BLOB") |
---|
784 | (describe mysql-type-var-string "MYSQL_TYPE_VAR_STRING") |
---|
785 | (describe mysql-type-string "MYSQL_TYPE_STRING") |
---|
786 | (describe mysql-type-geometry "MYSQL_TYPE_GEOMETRY") ) ) |
---|
787 | |
---|
788 | (procedure "(mysql-type-value SYMBOL ...)" |
---|
789 | (p |
---|
790 | "Returns the or'ed value of the " (tt "SYMBOL ...") " values.") ) |
---|
791 | |
---|
792 | (procedure "(mysql-type-symbol NUMBER)" |
---|
793 | (p |
---|
794 | "Returns the symbol for the " (tt "NUMBER") ".") ) |
---|
795 | ) |
---|
796 | |
---|
797 | (subsubsection "MYSQL_FIELD.flags Flags" |
---|
798 | |
---|
799 | (p |
---|
800 | (symbol-table "Symbolic Value" |
---|
801 | (describe not-null-flag "NOT-NULL-FLAG") |
---|
802 | (describe pri-key-flag "PRI-KEY-FLAG") |
---|
803 | (describe unique-key-flag "UNIQUE-KEY-FLAG") |
---|
804 | (describe multiple-key-flag "MULTIPLE-KEY-FLAG") |
---|
805 | (describe unsigned-flag "UNSIGNED-FLAG") |
---|
806 | (describe zerofill-flag "ZEROFILL-FLAG") |
---|
807 | (describe binary-flag "BINARY-FLAG") |
---|
808 | (describe auto-increment-flag "AUTO-INCREMENT-FLAG") |
---|
809 | (describe no-default-value-flag "NO-DEFAULT-VALUE-FLAG") ) ) |
---|
810 | |
---|
811 | (procedure "(mysql-field-flags-value SYMBOL ...)" |
---|
812 | (p |
---|
813 | "Returns the or'ed value of the " (tt "SYMBOL ...") " values.") ) |
---|
814 | |
---|
815 | (procedure "(mysql-field-flags-symbol NUMBER)" |
---|
816 | (p |
---|
817 | "Returns the symbol for the " (tt "NUMBER") ".") ) |
---|
818 | ) |
---|
819 | ) |
---|
820 | ) ; documentation |
---|
821 | |
---|
822 | (examples |
---|
823 | (p |
---|
824 | "A bulky usage might look like:" |
---|
825 | (pre ,ex1-text) ) |
---|
826 | (p |
---|
827 | "A slightly more compact version that does the same thing:" |
---|
828 | (pre ,ex2-text) ) |
---|
829 | ) ; examples |
---|
830 | |
---|
831 | (section "Data Type Conversion" |
---|
832 | (p |
---|
833 | "All MySQL result data (except NULL) are returned as Scheme strings.") |
---|
834 | (p |
---|
835 | "The NULL value is represented by " (tt "#f") ".") |
---|
836 | (p "Booleans are expressed " |
---|
837 | "as the Scheme strings " (tt "\"1\"") " and " (tt "\"0\"") ".") |
---|
838 | (p "All remaining " |
---|
839 | "types, including numeric types, blobs, and strings are returned as Scheme " |
---|
840 | "strings.") |
---|
841 | ) ; section "Data Type Conversion" |
---|
842 | |
---|
843 | (section "Bugs" |
---|
844 | (p |
---|
845 | "No prepared statement support.") |
---|
846 | (p |
---|
847 | "This is alpha quality software. Only very basic functionality " |
---|
848 | "has been tested so far. I look forward to providing a more complete " |
---|
849 | "test suite (and probably a slew of bugfixes) with the next release.") |
---|
850 | (p |
---|
851 | (tt "mysql-escape-string") " is broken when it's used for binary data.") |
---|
852 | (p |
---|
853 | "I need to nail down the supported libmysqlclient versions. Right " |
---|
854 | "now there are some functions I've put off because they may or may " |
---|
855 | "not be supported in my target range. We'll see, soon...") |
---|
856 | ) ; section "Bugs" |
---|
857 | |
---|
858 | (license ,license-text) |
---|
859 | ) ; eggdoc:begin |
---|
860 | ) ) ; doc |
---|
861 | |
---|
862 | (eggdoc->html doc) |
---|