fix curls detection of ssl on AROS. Adjust the used link libraries (linking ssl twice...
[AROS-Contrib.git] / sqlite3 / www / capi3ref.tcl
blob8e1562239a0e9681a8331f482ebdfd21928a5ab5
1 set rcsid {$Id: capi3ref.tcl,v 1.22 2005/06/12 22:12:39 drh Exp $}
2 source common.tcl
3 header {C/C++ Interface For SQLite Version 3}
4 puts {
5 <h2>C/C++ Interface For SQLite Version 3</h2>
8 proc api {name prototype desc {notused x}} {
9 global apilist
10 if {$name==""} {
11 regsub -all {sqlite3_[a-z0-9_]+\(} $prototype \
12 {[lappend name [string trimright & (]]} x1
13 subst $x1
15 lappend apilist [list $name $prototype $desc]
18 api {result-codes} {
19 #define SQLITE_OK 0 /* Successful result */
20 #define SQLITE_ERROR 1 /* SQL error or missing database */
21 #define SQLITE_INTERNAL 2 /* An internal logic error in SQLite */
22 #define SQLITE_PERM 3 /* Access permission denied */
23 #define SQLITE_ABORT 4 /* Callback routine requested an abort */
24 #define SQLITE_BUSY 5 /* The database file is locked */
25 #define SQLITE_LOCKED 6 /* A table in the database is locked */
26 #define SQLITE_NOMEM 7 /* A malloc() failed */
27 #define SQLITE_READONLY 8 /* Attempt to write a readonly database */
28 #define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite_interrupt() */
29 #define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */
30 #define SQLITE_CORRUPT 11 /* The database disk image is malformed */
31 #define SQLITE_NOTFOUND 12 /* (Internal Only) Table or record not found */
32 #define SQLITE_FULL 13 /* Insertion failed because database is full */
33 #define SQLITE_CANTOPEN 14 /* Unable to open the database file */
34 #define SQLITE_PROTOCOL 15 /* Database lock protocol error */
35 #define SQLITE_EMPTY 16 /* (Internal Only) Database table is empty */
36 #define SQLITE_SCHEMA 17 /* The database schema changed */
37 #define SQLITE_TOOBIG 18 /* Too much data for one row of a table */
38 #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
39 #define SQLITE_MISMATCH 20 /* Data type mismatch */
40 #define SQLITE_MISUSE 21 /* Library used incorrectly */
41 #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
42 #define SQLITE_AUTH 23 /* Authorization denied */
43 #define SQLITE_ROW 100 /* sqlite_step() has another row ready */
44 #define SQLITE_DONE 101 /* sqlite_step() has finished executing */
45 } {
46 Many SQLite functions return an integer result code from the set shown
47 above in order to indicates success or failure.
50 api {} {
51 const char *sqlite3_libversion(void);
52 } {
53 Return a pointer to a string which contains the version number of
54 the library. The same string is available in the global
55 variable named "sqlite3_version". This interface is provided since
56 windows is unable to access global variables in DLLs.
59 api {} {
60 void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
61 } {
62 Aggregate functions use this routine to allocate
63 a structure for storing their state. The first time this routine
64 is called for a particular aggregate, a new structure of size nBytes
65 is allocated, zeroed, and returned. On subsequent calls (for the
66 same aggregate instance) the same buffer is returned. The implementation
67 of the aggregate can use the returned buffer to accumulate data.
69 The buffer allocated is freed automatically by SQLite.
72 api {} {
73 int sqlite3_aggregate_count(sqlite3_context*);
74 } {
75 The next routine returns the number of calls to xStep for a particular
76 aggregate function instance. The current call to xStep counts so this
77 routine always returns at least 1.
80 api {} {
81 int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
82 int sqlite3_bind_double(sqlite3_stmt*, int, double);
83 int sqlite3_bind_int(sqlite3_stmt*, int, int);
84 int sqlite3_bind_int64(sqlite3_stmt*, int, long long int);
85 int sqlite3_bind_null(sqlite3_stmt*, int);
86 int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));
87 int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
88 #define SQLITE_STATIC ((void(*)(void *))0)
89 #define SQLITE_TRANSIENT ((void(*)(void *))-1)
90 } {
91 In the SQL strings input to sqlite3_prepare() and sqlite3_prepare16(),
92 one or more literals can be replace by a parameter "?" or ":AAA" or "\$VVV"
93 where AAA is an alphanumeric identifier and VVV is a variable name according
94 to the syntax rules of the TCL programming language.
95 The values of these parameters (also called "host parameter names")
96 can be set using the sqlite3_bind_*() routines.
98 The first argument to the sqlite3_bind_*() routines always is a pointer
99 to the sqlite3_stmt structure returned from sqlite3_prepare(). The second
100 argument is the index of the parameter to be set. The first parameter has
101 an index of 1. When the same named parameter is used more than once, second
102 and subsequent
103 occurrences have the same index as the first occurrence. The index for
104 named parameters can be looked up using the
105 sqlite3_bind_parameter_name() API if desired.
107 The third argument is the value to bind to the parameter.
109 In those
110 routines that have a fourth argument, its value is the number of bytes
111 in the parameter. This is the number of characters for UTF-8 strings
112 and the number of bytes for UTF-16 strings and blobs. The number
113 of bytes does not include the zero-terminator at the end of strings.
114 If the fourth parameter is negative, the length of the string is
115 computed using strlen().
117 The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and
118 sqlite3_bind_text16() is a destructor used to dispose of the BLOB or
119 text after SQLite has finished with it. If the fifth argument is the
120 special value SQLITE_STATIC, then the library assumes that the information
121 is in static, unmanaged space and does not need to be freed. If the
122 fifth argument has the value SQLITE_TRANSIENT, then SQLite makes its
123 own private copy of the data before returning.
125 The sqlite3_bind_*() routines must be called after
126 sqlite3_prepare() or sqlite3_reset() and before sqlite3_step().
127 Bindings are not cleared by the sqlite3_reset() routine.
128 Unbound parameters are interpreted as NULL.
131 api {} {
132 int sqlite3_bind_parameter_count(sqlite3_stmt*);
134 Return the number of parameters in the precompiled statement given as
135 the argument.
138 api {} {
139 const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int n);
141 Return the name of the n-th parameter in the precompiled statement.
142 Parameters of the form ":AAA" or "\$VVV" have a name which is the
143 string ":AAA" or "\$VVV". In other words, the initial ":" or "$"
144 is included as part of the name.
145 Parameters of the form "?" have no name.
147 If the value n is out of range or if the n-th parameter is nameless,
148 then NULL is returned. The returned string is always in the
149 UTF-8 encoding.
152 api {} {
153 int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
155 Return the index of the parameter with the given name.
156 The name must match exactly.
157 If there is no parameter with the given name, return 0.
158 The string zName is always in the UTF-8 encoding.
161 api {} {
162 int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
164 This routine identifies a callback function that might be invoked
165 whenever an attempt is made to open a database table
166 that another thread or process has locked.
167 If the busy callback is NULL, then SQLITE_BUSY is returned immediately
168 upon encountering the lock.
169 If the busy callback is not NULL, then the
170 callback might invoked with two arguments. The
171 second argument is the number of prior calls to the busy callback
172 for the same lock. If the
173 busy callback returns 0, then no additional attempts are made to
174 access the database and SQLITE_BUSY is returned.
175 If the callback returns non-zero, then another attempt is made to open the
176 database for reading and the cycle repeats.
178 The presence of a busy handler does not guarantee that
179 it will be invoked when there is lock contention.
180 If SQLite determines that invoking the busy handler could result in
181 a deadlock, it will return SQLITE_BUSY instead.
182 Consider a scenario where one process is holding a read lock that
183 it is trying to promote to a reserved lock and
184 a second process is holding a reserved lock that it is trying
185 to promote to an exclusive lock. The first process cannot proceed
186 because it is blocked by the second and the second process cannot
187 proceed because it is blocked by the first. If both processes
188 invoke the busy handlers, neither will make any progress. Therefore,
189 SQLite returns SQLITE_BUSY for the first process, hoping that this
190 will induce the first process to release its read lock and allow
191 the second process to proceed.
193 The default busy callback is NULL.
195 Sqlite is re-entrant, so the busy handler may start a new query.
196 (It is not clear why anyone would every want to do this, but it
197 is allowed, in theory.) But the busy handler may not close the
198 database. Closing the database from a busy handler will delete
199 data structures out from under the executing query and will
200 probably result in a coredump.
203 api {} {
204 int sqlite3_busy_timeout(sqlite3*, int ms);
206 This routine sets a busy handler that sleeps for a while when a
207 table is locked. The handler will sleep multiple times until
208 at least "ms" milliseconds of sleeping have been done. After
209 "ms" milliseconds of sleeping, the handler returns 0 which
210 causes sqlite3_exec() to return SQLITE_BUSY.
212 Calling this routine with an argument less than or equal to zero
213 turns off all busy handlers.
216 api {} {
217 int sqlite3_changes(sqlite3*);
219 This function returns the number of database rows that were changed
220 (or inserted or deleted) by the most recently completed
221 INSERT, UPDATE, or DELETE
222 statement. Only changes that are directly specified by the INSERT,
223 UPDATE, or DELETE statement are counted. Auxiliary changes caused by
224 triggers are not counted. Use the sqlite3_total_changes() function
225 to find the total number of changes including changes caused by triggers.
227 Within the body of a trigger, the sqlite3_changes() function does work
228 to report the number of rows that were changed for the most recently
229 completed INSERT, UPDATE, or DELETE statement within the trigger body.
231 SQLite implements the command "DELETE FROM table" without a WHERE clause
232 by dropping and recreating the table. (This is much faster than going
233 through and deleting individual elements from the table.) Because of
234 this optimization, the change count for "DELETE FROM table" will be
235 zero regardless of the number of elements that were originally in the
236 table. To get an accurate count of the number of rows deleted, use
237 "DELETE FROM table WHERE 1" instead.
240 api {} {
241 int sqlite3_total_changes(sqlite3*);
243 This function returns the total number of database rows that have
244 be modified, inserted, or deleted since the database connection was
245 created using sqlite3_open(). All changes are counted, including
246 changes by triggers and changes to TEMP and auxiliary databases.
247 Except, changes to the SQLITE_MASTER table (caused by statements
248 such as CREATE TABLE) are not counted. Nor are changes counted when
249 an entire table is deleted using DROP TABLE.
251 See also the sqlite3_changes() API.
253 SQLite implements the command "DELETE FROM table" without a WHERE clause
254 by dropping and recreating the table. (This is much faster than going
255 through and deleting individual elements form the table.) Because of
256 this optimization, the change count for "DELETE FROM table" will be
257 zero regardless of the number of elements that were originally in the
258 table. To get an accurate count of the number of rows deleted, use
259 "DELETE FROM table WHERE 1" instead.
262 api {} {
263 int sqlite3_close(sqlite3*);
265 Call this function with a pointer to a structure that was previously
266 returned from sqlite3_open() or sqlite3_open16()
267 and the corresponding database will by closed.
269 SQLITE_OK is returned if the close is successful. If there are
270 prepared statements that have not been finalized, then SQLITE_BUSY
271 is returned. SQLITE_ERROR might be returned if the argument is not
272 a valid connection pointer returned by sqlite3_open() or if the connection
273 pointer has been closed previously.
276 api {} {
277 const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
278 int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
279 int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
280 double sqlite3_column_double(sqlite3_stmt*, int iCol);
281 int sqlite3_column_int(sqlite3_stmt*, int iCol);
282 long long int sqlite3_column_int64(sqlite3_stmt*, int iCol);
283 const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
284 const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
285 int sqlite3_column_type(sqlite3_stmt*, int iCol);
286 #define SQLITE_INTEGER 1
287 #define SQLITE_FLOAT 2
288 #define SQLITE_TEXT 3
289 #define SQLITE_BLOB 4
290 #define SQLITE_NULL 5
292 These routines return information about the information
293 in a single column of the current result row of a query. In every
294 case the first argument is a pointer to the SQL statement that is being
295 executed (the sqlite_stmt* that was returned from sqlite3_prepare()) and
296 the second argument is the index of the column for which information
297 should be returned. iCol is zero-indexed. The left-most column has an
298 index of 0.
300 If the SQL statement is not currently point to a valid row, or if the
301 the column index is out of range, the result is undefined.
303 If the result is a BLOB then the sqlite3_column_bytes() routine returns
304 the number of bytes in that BLOB. No type conversions occur.
305 If the result is a string (or a number since a number can be converted
306 into a string) then sqlite3_column_bytes() converts
307 the value into a UTF-8 string and returns
308 the number of bytes in the resulting string. The value returned does
309 not include the \\000 terminator at the end of the string. The
310 sqlite3_column_bytes16() routine converts the value into a UTF-16
311 encoding and returns the number of bytes (not characters) in the
312 resulting string. The \\u0000 terminator is not included in this count.
314 These routines attempt to convert the value where appropriate. For
315 example, if the internal representation is FLOAT and a text result
316 is requested, sprintf() is used internally to do the conversion
317 automatically. The following table details the conversions that
318 are applied:
320 <blockquote>
321 <table border="1">
322 <tr><th>Internal Type</th><th>Requested Type</th><th>Conversion</th></tr>
323 <tr><td> NULL </td><td> INTEGER</td><td>Result is 0</td></tr>
324 <tr><td> NULL </td><td> FLOAT </td><td> Result is 0.0</td></tr>
325 <tr><td> NULL </td><td> TEXT </td><td> Result is an empty string</td></tr>
326 <tr><td> NULL </td><td> BLOB </td><td> Result is a zero-length BLOB</td></tr>
327 <tr><td> INTEGER </td><td> FLOAT </td><td> Convert from integer to float</td></tr>
328 <tr><td> INTEGER </td><td> TEXT </td><td> ASCII rendering of the integer</td></tr>
329 <tr><td> INTEGER </td><td> BLOB </td><td> Same as for INTEGER->TEXT</td></tr>
330 <tr><td> FLOAT </td><td> INTEGER</td><td>Convert from float to integer</td></tr>
331 <tr><td> FLOAT </td><td> TEXT </td><td> ASCII rendering of the float</td></tr>
332 <tr><td> FLOAT </td><td> BLOB </td><td> Same as FLOAT->TEXT</td></tr>
333 <tr><td> TEXT </td><td> INTEGER</td><td>Use atoi()</td></tr>
334 <tr><td> TEXT </td><td> FLOAT </td><td> Use atof()</td></tr>
335 <tr><td> TEXT </td><td> BLOB </td><td> No change</td></tr>
336 <tr><td> BLOB </td><td> INTEGER</td><td>Convert to TEXT then use atoi()</td></tr>
337 <tr><td> BLOB </td><td> FLOAT </td><td> Convert to TEXT then use atof()</td></tr>
338 <tr><td> BLOB </td><td> TEXT </td><td> Add a \\000 terminator if needed</td></tr>
339 </table>
340 </blockquote>
343 api {} {
344 int sqlite3_column_count(sqlite3_stmt *pStmt);
346 Return the number of columns in the result set returned by the prepared
347 SQL statement. This routine returns 0 if pStmt is an SQL statement
348 that does not return data (for example an UPDATE).
350 See also sqlite3_data_count().
353 api {} {
354 const char *sqlite3_column_decltype(sqlite3_stmt *, int i);
355 const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
357 The first argument is a prepared SQL statement. If this statement
358 is a SELECT statement, the Nth column of the returned result set
359 of the SELECT is a table column then the declared type of the table
360 column is returned. If the Nth column of the result set is not at table
361 column, then a NULL pointer is returned. The returned string is
362 UTF-8 encoded for sqlite3_column_decltype() and UTF-16 encoded
363 for sqlite3_column_decltype16().
364 For example, in the database schema:
366 <blockquote><pre>
367 CREATE TABLE t1(c1 INTEGER);
368 </pre></blockquote>
370 And the following statement compiled:
372 <blockquote><pre>
373 SELECT c1 + 1, 0 FROM t1;
374 </pre></blockquote>
376 Then this routine would return the string "INTEGER" for the second
377 result column (i==1), and a NULL pointer for the first result column
378 (i==0).
381 api {} {
382 const char *sqlite3_column_name(sqlite3_stmt*,int);
383 const void *sqlite3_column_name16(sqlite3_stmt*,int);
385 The first argument is a prepared SQL statement. This function returns
386 the column heading for the Nth column of that statement, where N is the
387 second function argument. The string returned is UTF-8 for
388 sqlite3_column_name() and UTF-16 for sqlite3_column_name16().
391 api {} {
392 void *sqlite3_commit_hook(sqlite3*, int(*xCallback)(void*), void *pArg);
394 <i>Experimental</i>
396 Register a callback function to be invoked whenever a new transaction
397 is committed. The pArg argument is passed through to the callback.
398 callback. If the callback function returns non-zero, then the commit
399 is converted into a rollback.
401 If another function was previously registered, its pArg value is returned.
402 Otherwise NULL is returned.
404 Registering a NULL function disables the callback. Only a single commit
405 hook callback can be registered at a time.
408 api {} {
409 int sqlite3_complete(const char *sql);
410 int sqlite3_complete16(const void *sql);
412 These functions return true if the given input string comprises
413 one or more complete SQL statements.
414 The argument must be a nul-terminated UTF-8 string for sqlite3_complete()
415 and a nul-terminated UTF-16 string for sqlite3_complete16().
416 } {}
418 api {} {
419 int sqlite3_create_collation(
420 sqlite3*,
421 const char *zName,
422 int pref16,
423 void*,
424 int(*xCompare)(void*,int,const void*,int,const void*)
426 int sqlite3_create_collation16(
427 sqlite3*,
428 const char *zName,
429 int pref16,
430 void*,
431 int(*xCompare)(void*,int,const void*,int,const void*)
433 #define SQLITE_UTF8 1
434 #define SQLITE_UTF16BE 2
435 #define SQLITE_UTF16LE 3
436 #define SQLITE_UTF16 4
438 These two functions are used to add new collation sequences to the
439 sqlite3 handle specified as the first argument.
441 The name of the new collation sequence is specified as a UTF-8 string
442 for sqlite3_create_collation() and a UTF-16 string for
443 sqlite3_create_collation16(). In both cases the name is passed as the
444 second function argument.
446 The third argument must be one of the constants SQLITE_UTF8,
447 SQLITE_UTF16LE or SQLITE_UTF16BE, indicating that the user-supplied
448 routine expects to be passed pointers to strings encoded using UTF-8,
449 UTF-16 little-endian or UTF-16 big-endian respectively. The
450 SQLITE_UTF16 constant indicates that text strings are expected in
451 UTF-16 in the native byte order of the host machine.
453 A pointer to the user supplied routine must be passed as the fifth
454 argument. If it is NULL, this is the same as deleting the collation
455 sequence (so that SQLite cannot call it anymore). Each time the user
456 supplied function is invoked, it is passed a copy of the void* passed as
457 the fourth argument to sqlite3_create_collation() or
458 sqlite3_create_collation16() as its first argument.
460 The remaining arguments to the user-supplied routine are two strings,
461 each represented by a [length, data] pair and encoded in the encoding
462 that was passed as the third argument when the collation sequence was
463 registered. The user routine should return negative, zero or positive if
464 the first string is less than, equal to, or greater than the second
465 string. i.e. (STRING1 - STRING2).
468 api {} {
469 int sqlite3_collation_needed(
470 sqlite3*,
471 void*,
472 void(*)(void*,sqlite3*,int eTextRep,const char*)
474 int sqlite3_collation_needed16(
475 sqlite3*,
476 void*,
477 void(*)(void*,sqlite3*,int eTextRep,const void*)
480 To avoid having to register all collation sequences before a database
481 can be used, a single callback function may be registered with the
482 database handle to be called whenever an undefined collation sequence is
483 required.
485 If the function is registered using the sqlite3_collation_needed() API,
486 then it is passed the names of undefined collation sequences as strings
487 encoded in UTF-8. If sqlite3_collation_needed16() is used, the names
488 are passed as UTF-16 in machine native byte order. A call to either
489 function replaces any existing callback.
491 When the user-function is invoked, the first argument passed is a copy
492 of the second argument to sqlite3_collation_needed() or
493 sqlite3_collation_needed16(). The second argument is the database
494 handle. The third argument is one of SQLITE_UTF8, SQLITE_UTF16BE or
495 SQLITE_UTF16LE, indicating the most desirable form of the collation
496 sequence function required. The fourth argument is the name of the
497 required collation sequence.
499 The collation sequence is returned to SQLite by a collation-needed
500 callback using the sqlite3_create_collation() or
501 sqlite3_create_collation16() APIs, described above.
504 api {} {
505 int sqlite3_create_function(
506 sqlite3 *,
507 const char *zFunctionName,
508 int nArg,
509 int eTextRep,
510 void *pUserData,
511 void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
512 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
513 void (*xFinal)(sqlite3_context*)
515 int sqlite3_create_function16(
516 sqlite3*,
517 const void *zFunctionName,
518 int nArg,
519 int eTextRep,
520 void *pUserData,
521 void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
522 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
523 void (*xFinal)(sqlite3_context*)
525 #define SQLITE_UTF8 1
526 #define SQLITE_UTF16 2
527 #define SQLITE_UTF16BE 3
528 #define SQLITE_UTF16LE 4
529 #define SQLITE_ANY 5
531 These two functions are used to add SQL functions or aggregates
532 implemented in C. The
533 only difference between these two routines is that the second argument, the
534 name of the (scalar) function or aggregate, is encoded in UTF-8 for
535 sqlite3_create_function() and UTF-16 for sqlite3_create_function16().
537 The first argument is the database handle that the new function or
538 aggregate is to be added to. If a single program uses more than one
539 database handle internally, then user functions or aggregates must
540 be added individually to each database handle with which they will be
541 used.
543 The third argument is the number of arguments that the function or
544 aggregate takes. If this argument is -1 then the function or
545 aggregate may take any number of arguments.
547 The fourth argument, eTextRep, specifies what type of text arguments
548 this function prefers to receive. Any function should be able to work
549 work with UTF-8, UTF-16le, or UTF-16be. But some implementations may be
550 more efficient with one representation than another. Users are allowed
551 to specify separate implementations for the same function which are called
552 depending on the text representation of the arguments. The the implementation
553 which provides the best match is used. If there is only a single
554 implementation which does not care what text representation is used,
555 then the fourth argument should be SQLITE_ANY.
557 The fifth argument is an arbitrary pointer. The function implementations
558 can gain access to this pointer using the sqlite_user_data() API.
560 The sixth, seventh and eighth argumens, xFunc, xStep and xFinal, are
561 pointers to user implemented C functions that implement the user
562 function or aggregate. A scalar function requires an implementation of
563 the xFunc callback only, NULL pointers should be passed as the xStep
564 and xFinal arguments. An aggregate function requires an implementation
565 of xStep and xFinal, and NULL should be passed for xFunc. To delete an
566 existing user function or aggregate, pass NULL for all three function
567 callbacks. Specifying an inconstant set of callback values, such as an
568 xFunc and an xFinal, or an xStep but no xFinal, results in an SQLITE_ERROR
569 return.
572 api {} {
573 int sqlite3_data_count(sqlite3_stmt *pStmt);
575 Return the number of values in the current row of the result set.
577 After a call to sqlite3_step() that returns SQLITE_ROW, this routine
578 will return the same value as the sqlite3_column_count() function.
579 After sqlite3_step() has returned an SQLITE_DONE, SQLITE_BUSY or
580 error code, or before sqlite3_step() has been called on a
581 prepared SQL statement, this routine returns zero.
584 api {} {
585 int sqlite3_errcode(sqlite3 *db);
587 Return the error code for the most recent failed sqlite3_* API call associated
588 with sqlite3 handle 'db'. If a prior API call failed but the most recent
589 API call succeeded, the return value from this routine is undefined.
591 Calls to many sqlite3_* functions set the error code and string returned
592 by sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16()
593 (overwriting the previous values). Note that calls to sqlite3_errcode(),
594 sqlite3_errmsg() and sqlite3_errmsg16() themselves do not affect the
595 results of future invocations. Calls to API routines that do not return
596 an error code (examples: sqlite3_data_count() or sqlite3_mprintf()) do
597 not change the error code returned by this routine.
599 Assuming no other intervening sqlite3_* API calls are made, the error
600 code returned by this function is associated with the same error as
601 the strings returned by sqlite3_errmsg() and sqlite3_errmsg16().
602 } {}
604 api {} {
605 const char *sqlite3_errmsg(sqlite3*);
606 const void *sqlite3_errmsg16(sqlite3*);
608 Return a pointer to a UTF-8 encoded string (sqlite3_errmsg)
609 or a UTF-16 encoded string (sqlite3_errmsg16) describing in English the
610 error condition for the most recent sqlite3_* API call. The returned
611 string is always terminated by an 0x00 byte.
613 The string "not an error" is returned when the most recent API call was
614 successful.
617 api {} {
618 int sqlite3_exec(
619 sqlite3*, /* An open database */
620 const char *sql, /* SQL to be executed */
621 sqlite_callback, /* Callback function */
622 void *, /* 1st argument to callback function */
623 char **errmsg /* Error msg written here */
626 A function to executes one or more statements of SQL.
628 If one or more of the SQL statements are queries, then
629 the callback function specified by the 3rd argument is
630 invoked once for each row of the query result. This callback
631 should normally return 0. If the callback returns a non-zero
632 value then the query is aborted, all subsequent SQL statements
633 are skipped and the sqlite3_exec() function returns the SQLITE_ABORT.
635 The 4th argument is an arbitrary pointer that is passed
636 to the callback function as its first argument.
638 The 2nd argument to the callback function is the number of
639 columns in the query result. The 3rd argument to the callback
640 is an array of strings holding the values for each column.
641 The 4th argument to the callback is an array of strings holding
642 the names of each column.
644 The callback function may be NULL, even for queries. A NULL
645 callback is not an error. It just means that no callback
646 will be invoked.
648 If an error occurs while parsing or evaluating the SQL (but
649 not while executing the callback) then an appropriate error
650 message is written into memory obtained from malloc() and
651 *errmsg is made to point to that message. The calling function
652 is responsible for freeing the memory that holds the error
653 message. Use sqlite3_free() for this. If errmsg==NULL,
654 then no error message is ever written.
656 The return value is is SQLITE_OK if there are no errors and
657 some other return code if there is an error. The particular
658 return value depends on the type of error.
660 If the query could not be executed because a database file is
661 locked or busy, then this function returns SQLITE_BUSY. (This
662 behavior can be modified somewhat using the sqlite3_busy_handler()
663 and sqlite3_busy_timeout() functions.)
664 } {}
666 api {} {
667 int sqlite3_finalize(sqlite3_stmt *pStmt);
669 The sqlite3_finalize() function is called to delete a prepared
670 SQL statement obtained by a previous call to sqlite3_prepare()
671 or sqlite3_prepare16(). If the statement was executed successfully, or
672 not executed at all, then SQLITE_OK is returned. If execution of the
673 statement failed then an error code is returned.
675 All prepared statements must finalized before sqlite3_close() is
676 called or else the close will fail with a return code of SQLITE_BUSY.
678 This routine can be called at any point during the execution of the
679 virtual machine. If the virtual machine has not completed execution
680 when this routine is called, that is like encountering an error or
681 an interrupt. (See sqlite3_interrupt().) Incomplete updates may be
682 rolled back and transactions canceled, depending on the circumstances,
683 and the result code returned will be SQLITE_ABORT.
686 api {} {
687 void sqlite3_free(char *z);
689 Use this routine to free memory obtained from
690 sqlite3_mprintf() or sqlite3_vmprintf().
693 api {} {
694 int sqlite3_get_table(
695 sqlite3*, /* An open database */
696 const char *sql, /* SQL to be executed */
697 char ***resultp, /* Result written to a char *[] that this points to */
698 int *nrow, /* Number of result rows written here */
699 int *ncolumn, /* Number of result columns written here */
700 char **errmsg /* Error msg written here */
702 void sqlite3_free_table(char **result);
704 This next routine is really just a wrapper around sqlite3_exec().
705 Instead of invoking a user-supplied callback for each row of the
706 result, this routine remembers each row of the result in memory
707 obtained from malloc(), then returns all of the result after the
708 query has finished.
710 As an example, suppose the query result where this table:
712 <pre>
713 Name | Age
714 -----------------------
715 Alice | 43
716 Bob | 28
717 Cindy | 21
718 </pre>
720 If the 3rd argument were &azResult then after the function returns
721 azResult will contain the following data:
723 <pre>
724 azResult[0] = "Name";
725 azResult[1] = "Age";
726 azResult[2] = "Alice";
727 azResult[3] = "43";
728 azResult[4] = "Bob";
729 azResult[5] = "28";
730 azResult[6] = "Cindy";
731 azResult[7] = "21";
732 </pre>
734 Notice that there is an extra row of data containing the column
735 headers. But the *nrow return value is still 3. *ncolumn is
736 set to 2. In general, the number of values inserted into azResult
737 will be ((*nrow) + 1)*(*ncolumn).
739 After the calling function has finished using the result, it should
740 pass the result data pointer to sqlite3_free_table() in order to
741 release the memory that was malloc-ed. Because of the way the
742 malloc() happens, the calling function must not try to call
743 malloc() directly. Only sqlite3_free_table() is able to release
744 the memory properly and safely.
746 The return value of this routine is the same as from sqlite3_exec().
749 api {sqlite3_interrupt} {
750 void sqlite3_interrupt(sqlite3*);
752 This function causes any pending database operation to abort and
753 return at its earliest opportunity. This routine is typically
754 called in response to a user action such as pressing "Cancel"
755 or Ctrl-C where the user wants a long query operation to halt
756 immediately.
757 } {}
759 api {} {
760 long long int sqlite3_last_insert_rowid(sqlite3*);
762 Each entry in an SQLite table has a unique integer key. (The key is
763 the value of the INTEGER PRIMARY KEY column if there is such a column,
764 otherwise the key is generated at random. The unique key is always
765 available as the ROWID, OID, or _ROWID_ column.) This routine
766 returns the integer key of the most recent insert in the database.
768 This function is similar to the mysql_insert_id() function from MySQL.
769 } {}
771 api {} {
772 char *sqlite3_mprintf(const char*,...);
773 char *sqlite3_vmprintf(const char*, va_list);
775 These routines are variants of the "sprintf()" from the
776 standard C library. The resulting string is written into memory
777 obtained from malloc() so that there is never a possibility of buffer
778 overflow. These routines also implement some additional formatting
779 options that are useful for constructing SQL statements.
781 The strings returned by these routines should be freed by calling
782 sqlite3_free().
784 All of the usual printf formatting options apply. In addition, there
785 is a "%q" option. %q works like %s in that it substitutes a null-terminated
786 string from the argument list. But %q also doubles every '\\'' character.
787 %q is designed for use inside a string literal. By doubling each '\\''
788 character it escapes that character and allows it to be inserted into
789 the string.
791 For example, so some string variable contains text as follows:
793 <blockquote><pre>
794 char *zText = "It's a happy day!";
795 </pre></blockquote>
797 One can use this text in an SQL statement as follows:
799 <blockquote><pre>
800 sqlite3_exec_printf(db, "INSERT INTO table VALUES('%q')",
801 callback1, 0, 0, zText);
802 </pre></blockquote>
804 Because the %q format string is used, the '\\'' character in zText
805 is escaped and the SQL generated is as follows:
807 <blockquote><pre>
808 INSERT INTO table1 VALUES('It''s a happy day!')
809 </pre></blockquote>
811 This is correct. Had we used %s instead of %q, the generated SQL
812 would have looked like this:
814 <blockquote><pre>
815 INSERT INTO table1 VALUES('It's a happy day!');
816 </pre></blockquote>
818 This second example is an SQL syntax error. As a general rule you
819 should always use %q instead of %s when inserting text into a string
820 literal.
821 } {}
823 api {} {
824 int sqlite3_open(
825 const char *filename, /* Database filename (UTF-8) */
826 sqlite3 **ppDb /* OUT: SQLite db handle */
828 int sqlite3_open16(
829 const void *filename, /* Database filename (UTF-16) */
830 sqlite3 **ppDb /* OUT: SQLite db handle */
833 Open the sqlite database file "filename". The "filename" is UTF-8
834 encoded for sqlite3_open() and UTF-16 encoded in the native byte order
835 for sqlite3_open16(). An sqlite3* handle is returned in *ppDb, even
836 if an error occurs. If the database is opened (or created) successfully,
837 then SQLITE_OK is returned. Otherwise an error code is returned. The
838 sqlite3_errmsg() or sqlite3_errmsg16() routines can be used to obtain
839 an English language description of the error.
841 If the database file does not exist, then a new database will be created
842 as needed.
843 The encoding for the database will be UTF-8 if sqlite3_open() is called and
844 UTF-16 if sqlite3_open16 is used.
846 Whether or not an error occurs when it is opened, resources associated
847 with the sqlite3* handle should be released by passing it to
848 sqlite3_close() when it is no longer required.
851 api {} {
852 int sqlite3_prepare(
853 sqlite3 *db, /* Database handle */
854 const char *zSql, /* SQL statement, UTF-8 encoded */
855 int nBytes, /* Length of zSql in bytes. */
856 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
857 const char **pzTail /* OUT: Pointer to unused portion of zSql */
859 int sqlite3_prepare16(
860 sqlite3 *db, /* Database handle */
861 const void *zSql, /* SQL statement, UTF-16 encoded */
862 int nBytes, /* Length of zSql in bytes. */
863 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
864 const void **pzTail /* OUT: Pointer to unused portion of zSql */
867 To execute an SQL query, it must first be compiled into a byte-code
868 program using one of the following routines. The only difference between
869 them is that the second argument, specifying the SQL statement to
870 compile, is assumed to be encoded in UTF-8 for the sqlite3_prepare()
871 function and UTF-16 for sqlite3_prepare16().
873 The first argument "db" is an SQLite database handle. The second
874 argument "zSql" is the statement to be compiled, encoded as either
875 UTF-8 or UTF-16 (see above). If the next argument, "nBytes", is less
876 than zero, then zSql is read up to the first nul terminator. If
877 "nBytes" is not less than zero, then it is the length of the string zSql
878 in bytes (not characters).
880 *pzTail is made to point to the first byte past the end of the first
881 SQL statement in zSql. This routine only compiles the first statement
882 in zSql, so *pzTail is left pointing to what remains uncompiled.
884 *ppStmt is left pointing to a compiled SQL statement that can be
885 executed using sqlite3_step(). Or if there is an error, *ppStmt may be
886 set to NULL. If the input text contained no SQL (if the input is and
887 empty string or a comment) then *ppStmt is set to NULL. The calling
888 procedure is responsible for deleting this compiled SQL statement
889 using sqlite3_finalize() after it has finished with it.
891 On success, SQLITE_OK is returned. Otherwise an error code is returned.
894 api {} {
895 void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
897 <i>Experimental</i>
899 This routine configures a callback function - the progress callback - that
900 is invoked periodically during long running calls to sqlite3_exec(),
901 sqlite3_step() and sqlite3_get_table().
902 An example use for this API is to keep
903 a GUI updated during a large query.
905 The progress callback is invoked once for every N virtual machine opcodes,
906 where N is the second argument to this function. The progress callback
907 itself is identified by the third argument to this function. The fourth
908 argument to this function is a void pointer passed to the progress callback
909 function each time it is invoked.
911 If a call to sqlite3_exec(), sqlite3_step() or sqlite3_get_table() results
912 in less than N opcodes being executed, then the progress callback is not
913 invoked.
915 To remove the progress callback altogether, pass NULL as the third
916 argument to this function.
918 If the progress callback returns a result other than 0, then the current
919 query is immediately terminated and any database changes rolled back. If the
920 query was part of a larger transaction, then the transaction is not rolled
921 back and remains active. The sqlite3_exec() call returns SQLITE_ABORT.
925 api {} {
926 int sqlite3_reset(sqlite3_stmt *pStmt);
928 The sqlite3_reset() function is called to reset a prepared SQL
929 statement obtained by a previous call to sqlite3_prepare() or
930 sqlite3_prepare16() back to it's initial state, ready to be re-executed.
931 Any SQL statement variables that had values bound to them using
932 the sqlite3_bind_*() API retain their values.
935 api {} {
936 void sqlite3_result_blob(sqlite3_context*, const void*, int n, void(*)(void*));
937 void sqlite3_result_double(sqlite3_context*, double);
938 void sqlite3_result_error(sqlite3_context*, const char*, int);
939 void sqlite3_result_error16(sqlite3_context*, const void*, int);
940 void sqlite3_result_int(sqlite3_context*, int);
941 void sqlite3_result_int64(sqlite3_context*, long long int);
942 void sqlite3_result_null(sqlite3_context*);
943 void sqlite3_result_text(sqlite3_context*, const char*, int n, void(*)(void*));
944 void sqlite3_result_text16(sqlite3_context*, const void*, int n, void(*)(void*));
945 void sqlite3_result_text16be(sqlite3_context*, const void*, int n, void(*)(void*));
946 void sqlite3_result_text16le(sqlite3_context*, const void*, int n, void(*)(void*));
947 void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
949 User-defined functions invoke these routines in order to
950 set their return value. The sqlite3_result_value() routine is used
951 to return an exact copy of one of the arguments to the function.
953 The operation of these routines is very similar to the operation of
954 sqlite3_bind_blob() and its cousins. Refer to the documentation there
955 for additional information.
958 api {} {
959 int sqlite3_set_authorizer(
960 sqlite3*,
961 int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
962 void *pUserData
964 #define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */
965 #define SQLITE_CREATE_TABLE 2 /* Table Name NULL */
966 #define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */
967 #define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */
968 #define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */
969 #define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */
970 #define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */
971 #define SQLITE_CREATE_VIEW 8 /* View Name NULL */
972 #define SQLITE_DELETE 9 /* Table Name NULL */
973 #define SQLITE_DROP_INDEX 10 /* Index Name Table Name */
974 #define SQLITE_DROP_TABLE 11 /* Table Name NULL */
975 #define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */
976 #define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */
977 #define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */
978 #define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */
979 #define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */
980 #define SQLITE_DROP_VIEW 17 /* View Name NULL */
981 #define SQLITE_INSERT 18 /* Table Name NULL */
982 #define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */
983 #define SQLITE_READ 20 /* Table Name Column Name */
984 #define SQLITE_SELECT 21 /* NULL NULL */
985 #define SQLITE_TRANSACTION 22 /* NULL NULL */
986 #define SQLITE_UPDATE 23 /* Table Name Column Name */
987 #define SQLITE_ATTACH 24 /* Filename NULL */
988 #define SQLITE_DETACH 25 /* Database Name NULL */
990 #define SQLITE_DENY 1 /* Abort the SQL statement with an error */
991 #define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */
993 This routine registers a callback with the SQLite library. The
994 callback is invoked (at compile-time, not at run-time) for each
995 attempt to access a column of a table in the database. The callback should
996 return SQLITE_OK if access is allowed, SQLITE_DENY if the entire
997 SQL statement should be aborted with an error and SQLITE_IGNORE
998 if the column should be treated as a NULL value.
1000 The second argument to the access authorization function will be one
1001 of the defined constants shown. These values signify what kind of operation
1002 is to be authorized. The 3rd and 4th arguments to the authorization
1003 function will be arguments or NULL depending on which of the following
1004 codes is used as the second argument. The 5th argument is the name
1005 of the database ("main", "temp", etc.) if applicable. The 6th argument
1006 is the name of the inner-most trigger or view that is responsible for
1007 the access attempt or NULL if this access attempt is directly from
1008 input SQL code.
1010 The return value of the authorization function should be one of the
1011 constants SQLITE_OK, SQLITE_DENY, or SQLITE_IGNORE.
1013 The intent of this routine is to allow applications to safely execute
1014 user-entered SQL. An appropriate callback can deny the user-entered
1015 SQL access certain operations (ex: anything that changes the database)
1016 or to deny access to certain tables or columns within the database.
1019 api {} {
1020 int sqlite3_step(sqlite3_stmt*);
1022 After an SQL query has been prepared with a call to either
1023 sqlite3_prepare() or sqlite3_prepare16(), then this function must be
1024 called one or more times to execute the statement.
1026 The return value will be either SQLITE_BUSY, SQLITE_DONE,
1027 SQLITE_ROW, SQLITE_ERROR, or SQLITE_MISUSE.
1029 SQLITE_BUSY means that the database engine attempted to open
1030 a locked database and there is no busy callback registered.
1031 Call sqlite3_step() again to retry the open.
1033 SQLITE_DONE means that the statement has finished executing
1034 successfully. sqlite3_step() should not be called again on this virtual
1035 machine without first calling sqlite3_reset() to reset the virtual
1036 machine back to its initial state.
1038 If the SQL statement being executed returns any data, then
1039 SQLITE_ROW is returned each time a new row of data is ready
1040 for processing by the caller. The values may be accessed using
1041 the sqlite3_column_*() functions. sqlite3_step()
1042 is called again to retrieve the next row of data.
1044 SQLITE_ERROR means that a run-time error (such as a constraint
1045 violation) has occurred. sqlite3_step() should not be called again on
1046 the VM. More information may be found by calling sqlite3_errmsg().
1048 SQLITE_MISUSE means that the this routine was called inappropriately.
1049 Perhaps it was called on a virtual machine that had already been
1050 finalized or on one that had previously returned SQLITE_ERROR or
1051 SQLITE_DONE. Or it could be the case the the same database connection
1052 is being used simultaneously by two or more threads.
1055 api {} {
1056 void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
1058 Register a function that is called each time an SQL statement is evaluated.
1059 The callback function is invoked on the first call to sqlite3_step() after
1060 calls to sqlite3_prepare() or sqlite3_reset().
1061 This function can be used (for example) to generate
1062 a log file of all SQL executed against a database. This can be
1063 useful when debugging an application that uses SQLite.
1066 api {} {
1067 void *sqlite3_user_data(sqlite3_context*);
1069 The pUserData argument to the sqlite3_create_function() and
1070 sqlite3_create_function16() routines used to register user functions
1071 is available to the implementation of the function using this
1072 call.
1075 api {} {
1076 const void *sqlite3_value_blob(sqlite3_value*);
1077 int sqlite3_value_bytes(sqlite3_value*);
1078 int sqlite3_value_bytes16(sqlite3_value*);
1079 double sqlite3_value_double(sqlite3_value*);
1080 int sqlite3_value_int(sqlite3_value*);
1081 long long int sqlite3_value_int64(sqlite3_value*);
1082 const unsigned char *sqlite3_value_text(sqlite3_value*);
1083 const void *sqlite3_value_text16(sqlite3_value*);
1084 const void *sqlite3_value_text16be(sqlite3_value*);
1085 const void *sqlite3_value_text16le(sqlite3_value*);
1086 int sqlite3_value_type(sqlite3_value*);
1088 This group of routines returns information about arguments to
1089 a user-defined function. Function implementations use these routines
1090 to access their arguments. These routines are the same as the
1091 sqlite3_column_... routines except that these routines take a single
1092 sqlite3_value* pointer instead of an sqlite3_stmt* and an integer
1093 column number.
1095 See the documentation under sqlite3_column_blob for additional
1096 information.
1099 api {} {
1100 int sqlite3_sleep(int);
1102 Sleep for a little while. The second parameter is the number of
1103 miliseconds to sleep for.
1105 If the operating system does not support sleep requests with
1106 milisecond time resolution, then the time will be rounded up to
1107 the nearest second. The number of miliseconds of sleep actually
1108 requested from the operating system is returned.
1111 api {} {
1112 int sqlite3_expired(sqlite3_stmt*);
1114 Return TRUE (non-zero) if the statement supplied as an argument needs
1115 to be recompiled. A statement needs to be recompiled whenever the
1116 execution environment changes in a way that would alter the program
1117 that sqlite3_prepare() generates. For example, if new functions or
1118 collating sequences are registered or if an authorizer function is
1119 added or changed.
1122 api {} {
1123 int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
1125 Move all bindings from the first prepared statement over to the second.
1126 This routine is useful, for example, if the first prepared statement
1127 fails with an SQLITE_SCHEMA error. The same SQL can be prepared into
1128 the second prepared statement then all of the bindings transfered over
1129 to the second statement before the first statement is finalized.
1132 api {} {
1133 int sqlite3_global_recover();
1135 This function is called to recover from a malloc() failure that occured
1136 within the SQLite library. Normally, after a single malloc() fails the
1137 library refuses to function (all major calls return SQLITE_NOMEM).
1138 This function restores the library state so that it can be used again.
1140 All existing statements (sqlite3_stmt pointers) must be finalized or
1141 reset before this call is made. Otherwise, SQLITE_BUSY is returned.
1142 If any in-memory databases are in use, either as a main or TEMP
1143 database, SQLITE_ERROR is returned. In either of these cases, the
1144 library is not reset and remains unusable.
1146 This function is *not* threadsafe. Calling this from within a threaded
1147 application when threads other than the caller have used SQLite is
1148 dangerous and will almost certainly result in malfunctions.
1150 This functionality can be omitted from a build by defining the
1151 SQLITE_OMIT_GLOBALRECOVER at compile time.
1154 api {} {
1155 int sqlite3_get_autocommit(sqlite3*);
1157 Test to see whether or not the database connection is in autocommit
1158 mode. Return TRUE if it is and FALSE if not. Autocommit mode is on
1159 by default. Autocommit is disabled by a BEGIN statement and reenabled
1160 by the next COMMIT or ROLLBACK.
1163 api {} {
1164 int sqlite3_clear_bindings(sqlite3_stmt*);
1166 Set all the parameters in the compiled SQL statement back to NULL.
1169 api {} {
1170 int sqlite3_db_handle(sqlite3_stmt*);
1172 Return the sqlite3* database handle to which the prepared statement given
1173 in the argument belongs. This is the same database handle that was
1174 the first argument to the sqlite3_prepare() that was used to create
1175 the statement in the first place.
1179 set n 0
1180 set i 0
1181 foreach item $apilist {
1182 set namelist [lindex $item 0]
1183 foreach name $namelist {
1184 set n_to_name($n) $name
1185 set n_to_idx($n) $i
1186 set name_to_idx($name) $i
1187 incr n
1189 incr i
1191 set i 0
1192 foreach name [lsort [array names name_to_idx]] {
1193 set sname($i) $name
1194 incr i
1196 puts {<table width="100%" cellpadding="5"><tr>}
1197 set nrow [expr {($n+2)/3}]
1198 set i 0
1199 for {set j 0} {$j<3} {incr j} {
1200 if {$j>0} {puts {<td width="10"></td>}}
1201 puts {<td valign="top">}
1202 set limit [expr {$i+$nrow}]
1203 puts {<ul>}
1204 while {$i<$limit && $i<$n} {
1205 set name $sname($i)
1206 if {[regexp {^sqlite} $name]} {set display $name} {set display <i>$name</i>}
1207 puts "<li><a href=\"#$name\">$display</a></li>"
1208 incr i
1210 puts {</ul></td>}
1212 puts "</table>"
1213 puts "<!-- $n entries. $nrow rows in 3 columns -->"
1215 proc resolve_name {ignore_list name} {
1216 global name_to_idx
1217 if {![info exists name_to_idx($name)] || [lsearch $ignore_list $name]>=0} {
1218 return $name
1219 } else {
1220 return "<a href=\"#$name\">$name</a>"
1224 foreach name [lsort [array names name_to_idx]] {
1225 set i $name_to_idx($name)
1226 if {[info exists done($i)]} continue
1227 set done($i) 1
1228 foreach {namelist prototype desc} [lindex $apilist $i] break
1229 foreach name $namelist {
1230 puts "<a name=\"$name\">"
1232 puts "<p><hr></p>"
1233 puts "<blockquote><pre>"
1234 regsub "^( *\n)+" $prototype {} p2
1235 regsub "(\n *)+\$" $p2 {} p3
1236 puts $p3
1237 puts "</pre></blockquote>"
1238 regsub -all {\[} $desc {\[} desc
1239 regsub -all {sqlite3_[a-z0-9_]+} $desc "\[resolve_name $name &\]" d2
1240 regsub -all "\n( *\n)+" [subst $d2] "</p>\n\n<p>" d3
1241 puts "<p>$d3</p>"
1244 footer $rcsid