Import Tcl 8.6.12

This commit is contained in:
Steve Dower
2021-11-08 17:30:58 +00:00
parent 1aadb2455c
commit 674867e7e6
608 changed files with 78089 additions and 60360 deletions

View File

@@ -0,0 +1,168 @@
'\"
'\" Copyright (c) 2009 by Kevin B. Kenny.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
.TH Tdbc_Init 3 8.6 Tcl "Tcl Database Connectivity"
'\" .so man.macros
'\" IGNORE
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
. ie !"\\$2"" .TP \\n()Cu
. el .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1 \\fI\\$2\\fP (\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1 \\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
.\" # define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
.\" # BS - start boxed text
.\" # ^y = starting y location
.\" # ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
.\" # BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\" Draw four-sided box normally, but don't draw top of
.\" box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
.\" # CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
.\" # CE - end code excerpt
.de CE
.fi
.RE
..
'\" END IGNORE
.BS
.SH "NAME"
Tdbc_Init, Tdbc_MapSqlState, Tdbc_TokenizeSql \- C procedures to facilitate writing TDBC drivers
.SH SYNOPSIS
.nf
\fB#include <tdbc.h>\fR
int
\fBTdbc_Init\fR(\fIinterp\fR)
Tcl_Obj *
\fBTdbc_TokenizeSql\fR(\fIinterp, sqlcode\fR)
const char *
\fBTdbc_MapSqlState\fR(\fIstate\fR)
.fi
.SH ARGUMENTS
.AS "Tcl_Interp" statement in/out
.AP Tcl_Interp *interp in/out
Pointer to a Tcl interpreter.
.AP "const char" *state in
Pointer to a character string containing a 'SQL state' from a database error.
.AP "const char" *sqlcode in
Pointer to a character string containing a SQL statement.
.BE
.SH DESCRIPTION
.PP
The TDBC library provides several C procedures that simplify writing a TDBC
driver. They include a procedure that tokenizes a SQL statement, locating
variables to be substituted, and a procedure that accepts a SQL state and
returns an error class for the interpreter error information.
.PP
\fBTdbc_Init\fR must be invoked prior to any other TDBC call. It accepts
a pointer to a Tcl interpreter, and arranges to load the TDBC library. It
returns \fBTCL_OK\fR if the Tcl library was loaded successfully, and
\fBTCL_ERROR\fR otherwise. If \fBTCL_ERROR\fR is returned, the
interpreter's result contains the error message.
.PP
\fBTdbc_TokenizeSql\fR accepts a pointer to a Tcl interpreter, and a
pointer to a character string containing one or more SQL
statements. It tokenizes the SQL statements, and returns a pointer to
a Tcl_Obj that contains a list of the tokens that make up the
statement. Concatenating the tokens together will yield the original
SQL code. The returned Tcl_Obj has a reference count of zero. The
caller is responsible for managing the reference count as needed.
See \fBTOKENS\fR below for a description of what may be in the
returned list of tokens.
.PP
\fBTdbc_MapSqlState\fR accepts a pointer to a string, usually five
characters long, that is the 'SQL state' that resulted from a database
error. It returns a character string that is suitable for inclusion as
the error class when constructing the error code for an error in a
TDBC driver. (By convention, the error code is a list having at least
four elements: "\fBTDBC\fR \fIerrorClass\fR \fIsqlstate\fR
\fIdriverName\fR \fIdetails...\fR".)
.SH TOKENS
Each token returned from \fBTdbc_TokenizeSql\fR may be one of the
following:
.IP [1]
A bound variable, which begins with one of the
characters '\fB:\fR', '\fB@\fR', or '\fB$\fR'. The
remainder of the string is the variable
name and will consist of alphanumeric characters and underscores. (The
leading character will be be non-numeric.)
.IP [2]
A semicolon that separates two SQL statements.
.IP [3]
Something else in a SQL statement. The tokenizer does not attempt to
parse SQL; it merely identifies bound variables (distinguishing them
from similar strings appearing inside quotes or comments) and
statement delimiters.
.SH "SEE ALSO"
tdbc(n), tdbc::mapSqlState(n), tdbc::tokenize(n)
.SH "KEYWORDS"
TDBC, SQL, database, tokenize
.SH "COPYRIGHT"
Copyright (c) 2009 by Kevin B. Kenny.
.\" Local Variables:
.\" mode: nroff
.\" End:
.\"

86
pkgs/tdbc1.1.3/doc/tdbc.n Normal file
View File

@@ -0,0 +1,86 @@
'\"
'\" tdbc.n --
'\"
'\" Copyright (c) 2008 by Kevin B. Kenny.
'\"
'\" See the file "license.terms" for information on usage and redistribution of
'\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
.TH "tdbc" n 8.6 Tcl "Tcl Database Connectivity"
'\" .so man.macros
'\" IGNORE
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\" # BS - start boxed text
'\" # ^y = starting y location
'\" # ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\" # BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
'\" Draw four-sided box normally, but don't draw top of
'\" box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\" END IGNORE
.BS
.SH "NAME"
tdbc \- Tcl Database Connectivity
.SH "SYNOPSIS"
.nf
package require \fBtdbc 1.0\fR
package require \fBtdbc::\fIdriver version\fR
\fBtdbc::\fIdriver\fB::connection create \fIdb\fR ?\fI\-option value\fR...?
.fi
.BE
.SH "DESCRIPTION"
.PP
Tcl Database Connectivity (TDBC) is a common interface for Tcl
programs to access SQL databases. It is implemented by a series of
database \fIdrivers\fR: separate modules, each of which adapts Tcl to
the interface of one particular database system. All of the drivers
implement a common series of commands for manipulating the database.
These commands are all named dynamically, since they all represent
objects in the database system. They include \fBconnections,\fR
which represent connections to a database; \fBstatements,\fR which
represent SQL statements, and \fBresult sets,\fR which represent
the sets of rows that result from executing statements. All of these
have manual pages of their own, listed under \fBSEE ALSO\fR.
.PP
In addition, TDBC itself has a few service procedures that are chiefly
of interest to driver writers. \fBSEE ALSO\fR also enumerates them.
.SH "SEE ALSO"
Tdbc_Init(3),
tdbc::connection(n), tdbc::mapSqlState(n),
tdbc::resultset(n), tdbc::statement(n), tdbc::tokenize(n),
tdbc::mysql(n), tdbc::odbc(n), tdbc::postgres(n), tdbc::sqlite3(n)
.SH "KEYWORDS"
TDBC, SQL, database, connectivity, connection, resultset, statement
.SH "COPYRIGHT"
Copyright (c) 2008 by Kevin B. Kenny.
'\" Local Variables:
'\" mode: nroff
'\" End:
'\"

View File

@@ -0,0 +1,376 @@
'\"
'\" tdbc::connection.n --
'\"
'\" Copyright (c) 2008 by Kevin B. Kenny.
'\"
'\" See the file "license.terms" for information on usage and redistribution of
'\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
.TH "tdbc::connection" n 8.6 Tcl "Tcl Database Connectivity"
'\" .so man.macros
'\" IGNORE
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\" # BS - start boxed text
'\" # ^y = starting y location
'\" # ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\" # BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
'\" Draw four-sided box normally, but don't draw top of
'\" box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\" END IGNORE
.BS
.SH "NAME"
tdbc::connection \- TDBC connection object
.SH "SYNOPSIS"
.nf
package require \fBtdbc 1.0\fR
package require \fBtdbc::\fIdriver version\fR
\fBtdbc::\fIdriver\fB::connection create \fIdb\fR ?\fI\-option value\fR...?
\fIdb \fBconfigure\fR ?\fI\-option value\fR...?
\fIdb \fBclose\fR
\fIdb \fBforeignkeys\fR ?\fI\-primary tableName\fR? ?\fI\-foreign tableName\fR?
\fIdb \fBprepare\fR \fIsql-code\fR
\fIdb \fBpreparecall\fR \fIcall\fR
\fIdb \fBprimarykeys\fR \fItableName\fR
\fIdb \fBstatements\fR
\fIdb \fBresultsets\fR
\fIdb \fBtables\fR ?\fIpattern\fR?
\fIdb \fBcolumns\fR \fItable\fR ?\fIpattern\fR?
\fIdb \fBbegintransaction\fR
\fIdb \fBcommit\fR
\fIdb \fBrollback\fR
\fIdb \fBtransaction\fR \fIscript\fR
.fi
.ad l
.in 14
.ti 7
\fIdb \fBallrows\fR ?\fB\-as lists\fR|\fBdicts\fR? ?\fB\-columnsvariable \fIname\fR? ?\fB\-\-\fR? \fIsql-code\fR ?\fIdictionary\fR?
.br
.ti 7
\fIdb \fBforeach\fR ?\fB\-as lists\fR|\fBdicts\fR? ?\fB\-columnsvariable \fIname\fR? ?\-\-? \fIvarName sqlcode\fR ?\fIdictionary\fR? \fIscript\fR
.ad b
.BE
.SH "DESCRIPTION"
.PP
Every database driver for TDBC (Tcl DataBase Connectivity) implements
a \fIconnection\fR object that represents a connection to a database.
By convention, this object is created by the command,
\fBtdbc::\fIdriver\fB::connection create\fR.
This command accepts the name of a Tcl command that will represent the
connection and a possible set of options (see \fBCONFIGURATION
OPTIONS\fR). It establishes a connection to the database and returns
the name of the newly-created Tcl command.
.PP
The \fBconfigure\fR object command on a database connection, if
presented with no arguments, returns a list of alternating keywords
and values representing the connection's current configuration. If
presented with a single argument \fI\-option\fR, it returns the
configured value of the given option. Otherwise, it must be given an
even number of arguments which are alternating options and values. The
specified options receive the specified values, and nothing is
returned.
.PP
The \fBclose\fR object command on a database connection closes the
connection. All active statements and result sets on the connection
are closed. Any uncommitted transaction is rolled back. The object
command is deleted.
.PP
The \fBprepare\fR object command on a database connection prepares a SQL
statement for execution. The \fIsql-code\fR argument must contain a
single SQL statement to be executed. Bound variables may be
included. The return value is a
newly-created Tcl command that represents the statement. See
\fBtdbc::statement\fR for more detailed discussion of the
SQL accepted by the \fBprepare\fR object command and the
interface accepted by a statement.
.PP
On a database connection where the underlying database and driver
support stored procedures, the \fBpreparecall\fR
object command prepares a call to a stored procedure for execution.
The syntax of the stored procedure call is:
.PP
.CS
?\fIresultvar\fR =? \fIprocname\fR(?\fIarg\fR ?, \fIarg\fR...?)
.CE
.PP
The return value is a
newly-created Tcl command that represents the statement. See
\fBtdbc::statement\fR for the interface accepted by a statement.
.PP
The \fBstatements\fR object command returns a list of statements
that have been created by \fBprepare\fR and \fBpreparecall\fR
statements against the given connection and have not yet been closed.
.PP
The \fBresultsets\fR object command returns a list of result sets
that have been obtained by executing statements prepared using the
given connection and not yet closed.
.PP
The \fBtables\fR object command allows the program to query the
connection for the names of tables that exist in the database.
The optional \fIpattern\fR parameter is a pattern to match the name of
a table. It may contain the SQL wild-card characters '\fB%\fR' and
'\fB_\fR'. The return value is a dictionary whose keys are table names
and whose values are subdictionaries. See the documentation for the
individual database driver for the interpretation of the values.
.PP
The \fBcolumns\fR object command allows the program to query the
connection for the names of columns that exist in a given table.
The optional \fBpattern\fR parameter is a pattern to match the name of
a column. It may contain the SQL wild-card characters '\fB%\fR' and
'\fB_\fR'. The return value is a dictionary whose keys are column names
and whose values are dictionaries. Each of the subdictionaries will
contain at least the following keys and values (and may contain others
whose usage is determined by a specific database driver).
.IP \fBtype\fR
Contains the data type of the column, and will generally be chosen
from the set,
\fBbigint\fR, \fBbinary\fR, \fBbit\fR, \fBchar\fR, \fBdate\fR,
\fBdecimal\fR, \fBdouble\fR, \fBfloat\fR, \fBinteger\fR,
\fBlongvarbinary\fR, \fBlongvarchar\fR, \fBnumeric\fR, \fBreal\fR,
\fBtime\fR, \fBtimestamp\fR, \fBsmallint\fR, \fBtinyint\fR,
\fBvarbinary\fR, and \fBvarchar\fR. (If the column has a type that
cannot be represented as one of the above, \fBtype\fR will contain
a driver-dependent description of the type.)
.IP \fBprecision\fR
Contains the precision of the column in bits, decimal digits, or the
width in characters, according to the type.
.IP \fBscale\fR
Contains the scale of the column (the number of digits after the radix
point), for types that support the concept.
.IP \fBnullable\fR
Contains 1 if the column can contain NULL values, and 0 otherwise.
.PP
The \fBprimarykeys\fR object command allows the program to query the
connection for the primary keys belonging to a given table. The
\fItableName\fR parameter identifies the table being interrogated. The result
is a list of dictionaries enumerating the keys (in a similar format to the
list returned by \fI$connection\fR \fBallrows -as dicts\fR). The keys of the
dictionary may include at least the following. Values that are NULL or
meaningless in a given database are omitted.
.IP \fBtableCatalog\fR
Name of the catalog in which the table appears.
.IP \fBtableSchema\fR
Name of the schema in which the table appears.
.IP \fBtableName\fR
Name of the table owning the primary key.
.IP \fBconstraintCatalog\fR
Name of the catalog in which the primary key constraint appears. In some
database systems, this may not be the same as the table's catalog.
.IP \fBconstraintSchema\fR
Name of the schema in which the primary key constraint appears. In some
database systems, this may not be the same as the table's schema.
.IP \fBconstraintName\fR
Name of the primary key constraint,
.IP \fBcolumnName\fR
Name of a column that is a member of the primary key.
.IP \fBordinalPosition\fR
Ordinal position of the column within the primary key.
.PP
To these columns may be added additional ones that are specific to
a particular database system.
.PP
The \fBforeignkeys\fR object command allows the program to query the
connection for foreign key relationships that apply to a particular table.
The relationships may be constrained to the keys that appear in a
particular table (\fB-foreign\fR \fItableName\fR), the keys that
refer to a particular table (\fB-primary\fR \fItableName\fR), or both.
At least one of \fB-primary\fR and \fB-foreign\fR should be specified,
although some drivers will enumerate all foreign keys in the current
catalog if both options are omitted. The result of the \fBforeignkeys\fR
object command is a list of dictionaries, with one list element per key
(in a similar format to the
list returned by \fI$connection\fR \fBallrows -as dicts\fR). The keys of the
dictionary may include at least the following. Values that are NULL or
meaningless in a given database are omitted.
.IP \fBforeignConstraintCatalog\fR
Catalog in which the foreign key constraint appears.
.IP \fBforeignConstraintSchema\fR
Schema in which the foreign key constraint appears.
.IP \fBforeignConstraintName\fR
Name of the foreign key constraint.
.IP \fBprimaryConstraintCatalog\fR
Catalog holding the primary key constraint (or unique key constraint) on the
column to which the foreign key refers.
.IP \fBprimaryConstraintSchema\fR
Schema holding the primary key constraint (or unique key constraint) on the
column to which the foreign key refers.
.IP \fBprimaryConstraintName\fR
Name of the primary key constraint (or unique key constraint) on the
column to which the foreign key refers.
.IP \fBupdateAction\fR
Action to take when an UPDATE statement invalidates the constraint.
The value will be \fBCASCADE\fR, \fBSET DEFAULT\fR, \fBSET NULL\fR,
\fBRESTRICT\fR, or \fBNO ACTION\fR.
.IP \fBdeleteAction\fR
Action to take when a DELETE statement invalidates the constraint.
The value will be \fBCASCADE\fR, \fBSET DEFAULT\fR, \fBSET NULL\fR,
\fBRESTRICT\fR, or \fBNO ACTION\fR.
.IP \fBprimaryCatalog\fR
Catalog name in which the primary table (the one to which the foreign key
refers) appears.
.IP \fBprimarySchema\fR
Schema name in which the primary table (the one to which the foreign key
refers) appears.
.PP
.IP \fBprimaryTable\fR
Table name of the primary table (the one to which the foreign key
refers).
.IP \fBprimaryColumn\fR
Name of the column to which the foreign key refers.
.IP \fBforeignCatalog\fR
Name of the catalog in which the table containing the foreign key appears.
.IP \fBforeignSchema\fR
Name of the schema in which the table containing the foreign key appears.
.IP \fBforeignTable\fR
Name of the table containing the foreign key.
.IP \fBforeignColumn\fR
Name of the column appearing in the foreign key.
.IP \fBordinalPosition\fR
Position of the column in the foreign key, if the key is a compound key.
.PP
The \fBbegintransaction\fR object command on a database connection
begins a transaction on the database. If the underlying database does
not support atomic, consistent, isolated, durable transactions, the
\fBbegintransaction\fR object command returns an error reporting the
fact. Similarly, if multiple \fBbegintransaction\fR commands are executed
withough an intervening \fBcommit\fR or \fBrollback\fR command, an
error is returned unless the underlying database supports nested
transactions.
.PP
The \fBcommit\fR object command on a database connection ends the most
recent transaction started by \fBbegintransaction\fR and commits
changes to the database.
.PP
The \fBrollback\fR object command on a database connection rolls back
the most recent transaction started by \fBbegintransaction\fR. The
state of the database is as if nothing happened during the
transaction.
.PP
The \fBtransaction\fR object command on a database connection
presents a simple way of bundling a database transaction. It begins a
transaction, and evaluates the supplied \fIscript\fR argument as a Tcl
script in the caller's scope. If \fIscript\fR terminates normally, or
by \fBbreak\fR, \fBcontinue\fR, or \fBreturn\fR, the transaction is
committed (and any action requested by \fBbreak\fR, \fBcontinue\fR, or
\fBreturn\fR takes place). If the commit fails for any reason,
the error in the commit is treated as an error in the \fIscript\fR.
In the case of an error in \fIscript\fR or in the commit,
the transaction is rolled back and the error is
rethrown. Any nonstandard return code from the script
causes the transaction to be rolled back and then is rethrown.
.PP
The \fBallrows\fR object command prepares a SQL statement (given by
the \fIsql-code\fR parameter) to execute against the database.
It then executes it (see \fBtdbc::statement\fR for details) with the
optional \fIdictionary\fR parameter giving bind variables. Finally,
it uses the \fIallrows\fR object command on the result set (see
\fBtdbc::resultset\fR) to construct a list of the results. Finally, both
result set and statement are closed. The return value is the list of
results.
.PP
The \fBforeach\fR object command prepares a SQL statement (given by
the \fIsql-code\fR parameter) to execute against the database.
It then executes it (see \fBtdbc::statement\fR for details) with the
optional \fIdictionary\fR parameter giving bind variables. Finally,
it uses the \fIforeach\fR object command on the result set (see
\fBtdbc::resultset\fR) to evaluate the given \fIscript\fR for each row of
the results. Finally, both result set and statement are closed, even
if the given \fIscript\fR results in a \fBreturn\fR, an error, or
an unusual return code.
.SH "CONFIGURATION OPTIONS"
The configuration options accepted when the connection is created and
on the connection's \fBconfigure\fR object command include the
following, and may include others specific to a database driver.
.IP "\fB\-encoding \fIname\fR"
Specifies the encoding to be used in connecting to the database.
The \fIname\fR should be one of the names accepted by the
\fBencoding\fR command. This option is usually unnecessary; most
database drivers can figure out the encoding in use by themselves.
.IP "\fB\-isolation \fIlevel\fR"
Specifies the transaction isolation level needed for transactions on
the database. The acceptable values for \fIlevel\fR are shown under
\fBTRANSACTION ISOLATION LEVELS\fR.
.IP "\fB\-timeout \fIms\fR"
Specifies the maximum time to wait for a an operation database engine before
reporting an error to the caller. The \fIms\fR argument gives the
maximum time in milliseconds. A value of zero (the default) specifies
that the calling process is to wait indefinitely for database
operations.
.IP "\fB\-readonly \fIflag\fR"
Specifies that the connection will not modify the database (if the
Boolean parameter \fIflag\fR is true), or that it may modify the
database (if \fIflag\fR is false). If \fIflag\fR is true, this option
may have the effect of raising the transaction isolation level to
\fIreadonly\fR.
.SS "TRANSACTION ISOLATION LEVELS"
The acceptable values for the \fB\-isolation\fR configuration option
are as follows:
.IP \fBreaduncommitted\fR
Allows the transaction to read "dirty", that is, uncommitted
data. This isolation level may compromise data integrity, does not
guarantee that foreign keys or uniqueness constraints are satisfied,
and in general does not guarantee data consistency.
.IP \fBreadcommitted\fR
Forbids the transaction from reading "dirty" data, but does not
guarantee repeatable reads; if a transaction reads a row of a database
at a given time, there is no guarantee that the same row will be
available at a later time in the same transaction.
.IP \fBrepeatableread\fR
Guarantees that any row of the database, once read, will have the same
values for the life of a transaction. Still permits "phantom reads"
(that is, newly-added rows appearing if a table is queried a second
time).
.IP \fBserializable\fR
The most restrictive (and most expensive) level of transaction isolation. Any query to the database, if repeated, will return precisely the same results for the life of the transaction, exactly as if the transaction is the only user of the database.
.IP \fBreadonly\fR
Behaves like \fBserializable\fR in that the only results visible to
the transaction are those that were committed prior to the start of
the transaction, but forbids the transaction from modifying the
database.
.PP
A database that does not implement one of these isolation levels
will instead use the next more restrictive isolation level. If the
given level of isolation cannot be obtained, the database interface
throws an error reporting the fact. The default isolation level
is \fBreadcommitted\fR.
.PP
A script should not the isolation level when a transaction is in
progress.
.SH "SEE ALSO"
encoding(n), tdbc(n), tdbc::resultset(n), tdbc::statement(n), tdbc::tokenize(n)
.SH "KEYWORDS"
TDBC, SQL, database, connectivity, connection, resultset, statement
.SH "COPYRIGHT"
Copyright (c) 2008 by Kevin B. Kenny.
'\" Local Variables:
'\" mode: nroff
'\" End:
'\"

View File

@@ -0,0 +1,93 @@
'\"
'\" tdbc_mapSqlState.n --
'\"
'\" Copyright (c) 2009 by Kevin B. Kenny.
'\"
'\" See the file "license.terms" for information on usage and redistribution of
'\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH "tdbc::mapSqlState" n 8.6 Tcl "Tcl Database Connectivity"
'\" .so man.macros
'\" IGNORE
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\" # BS - start boxed text
'\" # ^y = starting y location
'\" # ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\" # BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
'\" Draw four-sided box normally, but don't draw top of
'\" box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\" # CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\" # CE - end code excerpt
.de CE
.fi
.RE
..
'\" END IGNORE
.BS
.SH "NAME"
tdbc::mapSqlState \- Map SQLSTATE to error class
.SH "SYNOPSIS"
.nf
package require \fBtdbc 1.0\fR
\fBtdbc::mapSqlState\fR \fIsqlstate\fR
.fi
.BE
.SH "DESCRIPTION"
.PP
The \fBtdbc::mapSqlState\fR command accepts a string that is expected
to be a five-character 'SQL state' as returned from a SQL database when
an error occurs. It examines the first two characters of the string,
and returns an error class as a human- and machine-readable name (for example,
\fBFEATURE_NOT_SUPPORTED\fR, \fBDATA_EXCEPTION\fR or
\fBINVALID_CURSOR_STATE\fR).
.PP
The TDBC specification requires database drivers to return a description
of an error in the error code when an error occurs. The description is
a string that has at least four elements: "\fBTDBC\fR \fIerrorClass\fR
\fIsqlstate\fR \fIdriverName\fR \fIdetails...\fR". The \fBtdbc::mapSqlState\fR
command gives a convenient way for a TDBC driver to generate the
\fIerrorClass\fR element given the SQL state returned from a database.
.SH "SEE ALSO"
tdbc(n), tdbc::tokenize, tdbc::connection(n), tdbc::statement(n), tdbc::resultset(n)
.SH "KEYWORDS"
TDBC, SQL, database, state
.SH "COPYRIGHT"
Copyright (c) 2009 by Kevin B. Kenny.
'\" Local Variables:
'\" mode: nroff
'\" End:
'\"

View File

@@ -0,0 +1,191 @@
'\"
'\" tdbc_resultset.n --
'\"
'\" Copyright (c) 2008 by Kevin B. Kenny.
'\"
'\" See the file "license.terms" for information on usage and redistribution of
'\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH "tdbc::resultset" n 8.6 Tcl "Tcl Database Connectivity"
'\" .so man.macros
'\" IGNORE
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\" # BS - start boxed text
'\" # ^y = starting y location
'\" # ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\" # BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
'\" Draw four-sided box normally, but don't draw top of
'\" box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\" # CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\" # CE - end code excerpt
.de CE
.fi
.RE
..
'\" END IGNORE
.BS
.SH "NAME"
tdbc::resultset \- TDBC result set object
.SH "SYNOPSIS"
.nf
package require \fBtdbc 1.0\fR
package require \fBtdbc::\fR\fIdriver version\fR
\fBtdbc::\fR\fIdriver\fR\fB::connection create \fR\fIdb\fR \fI?\-option value\fR...?
\fBset\fR \fIstmt\fR \fB[\fR\fIdb\fR \fBprepare\fR \fIsql-code\fR\fB]\fR
\fBset\fR \fIresultset\fR \fB[\fR\fI$stmt\fR \fBexecute\fR ?\fIargs...\fR?\fB]\fR
\fI$resultset\fR \fBcolumns\fR
\fI$resultset\fR \fBrowcount\fR
\fI$resultset\fR \fBnextrow\fR ?\fB-as\fR \fBlists\fR|\fBdicts\fR? ?\fB--\fR? \fIvarname\fR
\fI$resultset\fR \fBnextlist\fR \fIvarname\fR
\fI$resultset\fR \fBnextdict\fR \fIvarname\fR
\fI$resultset\fR \fBnextresults\fR
.fi
.ad l
.in 14
.ti 7
\fI$resultset\fR \fBallrows\fR ?\fB-as lists|dicts\fR? ?\fB-columnsvariable\fR \fIname\fR? ?\fB--\fR?
.br
.ti 7
\fI$resultset\fR \fBforeach\fR ?\fB-as lists|dicts\fR? ?\fB-columnsvariable\fR \fIname\fR? ?\fB--\fR? \fIvarname\fR \fIscript\fR
.br
.ti 7
\fI$resultset\fR \fBclose\fR
.ad b
.BE
.SH "DESCRIPTION"
.PP
Every database driver for TDBC (Tcl DataBase Connectivity) implements
a \fIresult set\fR object that represents a the results returned from
executing SQL statement in a database. Instances of this object are created
by executing the \fBexecute\fR object command on a statement object.
.PP
The \fBcolumns\fR object command returns a list of the names of the columns
in the result set. The columns will appear in the same order as they appeared
in the SQL statement that performed the database query. If the SQL statement
does not return a set of columns (for instance, if it is an INSERT,
UPDATE, or DELETE statement), the \fBcolumns\fR command will return an empty
list.
.PP
The \fBrowcount\fR object command returns the number of rows in the database
that were affected by the execution of an INSERT, UPDATE or DELETE statement.
For a SELECT statement, the row count is unspecified.
.PP
The \fBnextlist\fR object command sets the variable given by \fIvarname\fR
in the caller's scope to the next row of the results, expressed as a list
of column values. NULL values are replaced by empty strings. The
columns of the result row appear in the same order in which they
appeared on the SELECT statement. The
return of \fBnextlist\fR is \fB1\fR if the operation succeeded, and
\fB0\fR if the end of the result set was reached.
.PP
The \fBnextdict\fR object command sets the variable given by \fIvarname\fR
in the caller's scope to the next row of the results, expressed as a
dictionary. The dictionary's keys are column names, and the values are
the values of those columns in the row. If a column's value in the row
is NULL, its key is omitted from the dictionary.
The keys appear in the dictionary in the same order in which the
columns appeared on the SELECT statement. The
return of \fBnextdict\fR is \fB1\fR if the operation succeeded, and
\fB0\fR if the end of the result set was reached.
.PP
The \fBnextrow\fR object command is precisely equivalent to the
\fBnextdict\fR or \fBnextlist\fR object command, depending on whether
\fB-as dicts\fR (the default) or \fB-as lists\fR is specified.
.PP
Some databases support the idea of a single statement that returns multiple
sets of results. The \fBnextresults\fR object command is executed, typically
after the \fBnextlist\fR of \fBnextdict\fR object command has returned
\fB0\fR, to advance to the next result set. It returns \fB1\fR if there
is another result set to process, and \fB0\fR if the result set just
processed was the last. After calling \fBnextresults\fR and getting
the return value of \fB1\fR, the caller may once again call \fBcolumns\fR
to get the column descriptions of the next result set, and then return to
calling \fBnextdict\fR or \fBnextlist\fR to process the rows of the
next result set. It is an error to call \fBcolumns\fR, \fBnextdict\fR,
\fBnextlist\fR or \fBnextrow\fR after \fBnextresults\fR has returned \fB0\fR.
.PP
The \fBallrows\fR object command sets the variable designated by the
\fB-columnsvariable\fR option (if present) to the result of the \fBcolumns\fR
object command. It then executes the \fBnextrow\fR object command
repeatedly until the end of the result set is reached. If \fBnextresults\fR
returns a nonzero value, it executes the above two steps (\fBcolumns\fR
followed by iterated \fBnextrow\fR calls) as long as further results are
available. The rows returned by \fBnextrow\fR
are assembled into a Tcl list and become the return value of the
\fBallrows\fR command; the last value returned from \fBcolumns\fR is what
the application will see in \fB-columnsvariable\fR.
.PP
The \fBforeach\fR object command sets the variable designated by the
\fB-columnsvariable\fR option (if present) to the result of the \fBcolumns\fR
object command. It then executes the \fBnextrow\fR object command
repeatedly until the end of the result set is reached, storing the
successive rows in the variable designated by \fIvarName\fR. For each
row, it executes the given \fIscript\fR. If the script terminates with
an error, the error is reported by the \fBforeach\fR command, and
iteration stops. If the script performs a \fBbreak\fR operation, the
iteration terminates prematurely. If the script performs a
\fBcontinue\fR operation, the iteration recommences with the next row.
If the script performs a \fBreturn\fR, results are the same as if a
script outside the control of \fBforeach\fR had returned. Any other
unusual return code terminates the iteration and is reported from the
\fBforeach\fR.
.PP
Once \fBnextrow\fR returns \fB0\fR, the \fBforeach\fR object command
tries to advance to the next result set using \fBnextresults\fR. If
\fBnextresults\fR returns \fB1\fR, the above steps (\fBcolumns\fR and
\fBnextrow\fR, with script invocation) are repeated as long as more
result sets remain. The \fIscript\fR will always see the correct description
of the columns of the current result set in the variable designated
byt \fB-columnsvariable\fR. At the end of the call, the variable
designated by \fB-columnsvariable\fR will have the description of the
columns of the last result set.
.PP
The \fBclose\fR object command deletes the result set and frees any
associated system resources.
.SH "SEE ALSO"
encoding(n), tdbc(n), tdbc::connection(n), tdbc::statement(n), tdbc::tokenize(n)
.SH "KEYWORDS"
TDBC, SQL, database, connectivity, connection, resultset, statement,
bound variable, stored procedure, call
.SH "COPYRIGHT"
Copyright (c) 2008 by Kevin B. Kenny.
'\" Local Variables:
'\" mode: nroff
'\" End:
'\"

View File

@@ -0,0 +1,236 @@
'\"
'\" tdbc_statement.n --
'\"
'\" Copyright (c) 2008 by Kevin B. Kenny.
'\"
'\" See the file "license.terms" for information on usage and redistribution of
'\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
.TH "tdbc::statement" n 8.6 Tcl "Tcl Database Connectivity"
'\" .so man.macros
'\" IGNORE
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\" # BS - start boxed text
'\" # ^y = starting y location
'\" # ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\" # BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
'\" Draw four-sided box normally, but don't draw top of
'\" box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\" # CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\" # CE - end code excerpt
.de CE
.fi
.RE
..
'\" END IGNORE
.BS
.SH "NAME"
tdbc::statement \- TDBC statement object
.SH "SYNOPSIS"
.nf
package require \fBtdbc 1.0\fR
package require \fBtdbc::\fR\fIdriver version\fR
\fBtdbc::\fR\fIdriver\fR\fB::connection create \fR\fIdb\fR \fI?\-option value\fR...?
\fBset\fR \fIstmt\fR \fB[\fR\fIdb\fR \fBprepare\fR \fIsql-code\fR\fB]\fR
\fBset\fR \fIstmt\fR \fB[\fR\fIdb\fR \fBpreparecall\fR \fIcall\fR\fB]\fR
\fI$stmt\fR \fBparams\fR
\fI$stmt\fR \fBparamtype\fR ?\fIdirection\fR? \fItype\fR ?\fIprecision\fR? ?\fIscale\fR?
\fI$stmt\fR \fBexecute\fR ?\fIdict\fR?
\fI$stmt\fR \fBresultsets\fR
.fi
.ad l
.in 14
.ti 7
\fI$stmt\fR \fBallrows\fR ?\fB-as lists|dicts\fR? ?\fB-columnsvariable\fR \fIname\fR? ?\fB--\fR? ?\fIdict\fR
.br
.ti 7
\fI$stmt\fR \fBforeach\fR ?\fB-as lists|dicts\fR? ?\fB-columnsvariable\fR \fIname\fR? ?\fB--\fR? \fIvarName\fR ?\fIdict\fR? \fIscript\fR
.br
.ti 7
\fI$stmt\fR \fBclose\fR
.ad b
.BE
.SH "DESCRIPTION"
.PP
Every database driver for TDBC (Tcl DataBase Connectivity) implements
a \fIstatement\fR object that represents a SQL statement in a
database. Instances of this object are created by executing the
\fBprepare\fR or \fBpreparecall\fR object command on a database
connection.
.PP
The \fBprepare\fR object command against the connection
accepts arbitrary SQL code to be
executed against the database. The SQL code may contain \fIbound
variables\fR, which are strings of alphanumeric characters or
underscores (the first character of the string may not be numeric),
prefixed with a colon (\fB:\fR). If a bound variable appears in the
SQL statement, and is not in a string set off by single or double
quotes, nor in a comment introduced by \fB--\fR, it becomes a value
that is substituted when the statement is executed. A bound variable
becomes a single value (string or numeric) in the resulting
statement. \fIDrivers are responsible for ensuring that the mechanism
for binding variables prevents SQL injection.\fR
.PP
The \fBpreparecall\fR object command against the connection accepts a
stylized statement in the form:
.PP
.CS
\fIprocname\fR \fB(\fR?\fB:\fR\fIvarname\fR? ?\fB,:\fR\fIvarname\fR...?\fB)\fR
.CE
.PP
or
.PP
.CS
\fIvarname\fR \fB=\fR \fIprocname\fR \fB(\fR?\fB:\fR\fIvarname\fR? ?\fB,:\fR\fIvarname\fR...?\fB)\fR
.CE
.PP
This statement represents a call to a stored procedure \fIprocname\fR in the
database. The variable name to the left of the equal sign (if
present), and all variable names that are parameters inside
parentheses, become bound variables.
.PP
The \fBparams\fR method against a statement object enumerates the
bound variables that appear in the statement. The result returned from
the \fBparams\fR method is a dictionary whose keys are the names of
bound variables (listed in the order in which the variables first
appear in the statement), and whose values are dictionaries. The
subdictionaries include at least the following keys (database drivers
may add additional keys that are not in this list).
.IP \fBdirection\fR
Contains one of the keywords, \fBin\fR, \fBout\fR or \fBinout\fR
according to whether the variable is an input to or output from the
statement. Only stored procedure calls will have \fBout\fR or
\fBinout\fR parameters.
.IP \fBtype\fR
Contains the data type of the column, and will generally be chosen
from the set,
\fBbigint\fR, \fBbinary\fR, \fBbit\fR, \fBchar\fR, \fBdate\fR,
\fBdecimal\fR, \fBdouble\fR, \fBfloat\fR, \fBinteger\fR,
\fBlongvarbinary\fR, \fBlongvarchar\fR, \fBnumeric\fR, \fBreal\fR,
\fBtime\fR, \fBtimestamp\fR, \fBsmallint\fR, \fBtinyint\fR,
\fBvarbinary\fR, and \fBvarchar\fR. (If the variable has a type that
cannot be represented as one of the above, \fBtype\fR will contain
a driver-dependent description of the type.)
.IP \fBprecision\fR
Contains the precision of the column in bits, decimal digits, or the
width in characters, according to the type.
.IP \fBscale\fR
Contains the scale of the column (the number of digits after the radix
point), for types that support the concept.
.IP \fBnullable\fR
Contains 1 if the column can contain NULL values, and 0 otherwise.
.PP
The \fBparamtype\fR object command allows the script to specify the
type and direction of parameter transmission of a variable in a
statement. (Some databases provide no method to determine this
information automatically and place the burden on the caller to do
so.) The \fIdirection\fR, \fItype\fR, \fIprecision\fR, \fIscale\fR,
and \fInullable\fR arguments have the same meaning as the
corresponding dictionary values in the \fBparams\fR object command.
.PP
The \fBexecute\fR object command executes the statement. Prior to
executing the statement, values are provided for the bound variables
that appear in it. If the \fIdict\fR parameter is supplied, it is
searched for a key whose name matches the name of the bound
variable. If the key is present, its value becomes the substituted
variable. If not, the value of the substituted variable becomes a SQL
NULL. If the \fIdict\fR parameter is \fInot\fR supplied, the
\fBexecute\fR object command searches for a variable in the caller's
scope whose name matches the name of the bound variable. If one is
found, its value becomes the bound variable's value. If none is found,
the bound variable is assigned a SQL NULL as its value. Once
substitution is finished, the resulting statement is executed. The
return value is a result set object (see \fBtdbc::resultset\fR for
details).
.PP
The \fBresultsets\fR method returns a list of all the result sets that
have been returned by executing the statement and have not yet been
closed.
.PP
The \fBallrows\fR object command executes the statement as with the
\fBexecute\fR object command, accepting an
optional \fIdict\fR parameter giving bind variables. After executing
the statement,
it uses the \fIallrows\fR object command on the result set (see
\fBtdbc::resultset\fR) to construct a list of the results. Finally,
the result set is closed. The return value is the list of
results.
.PP
The \fBforeach\fR object command executes the statement as with the
\fBexecute\fR object command, accepting an
optional \fIdict\fR parameter giving bind variables. After executing
the statement,
it uses the \fIforeach\fR object command on the result set (see
\fBtdbc::resultset\fR) to evaluate the given \fIscript\fR for each row of
the results. Finally, the result set is closed, even
if the given \fIscript\fR results in a \fBreturn\fR, an error, or
an unusual return code.
.PP
The \fBclose\fR object command removes a statement and any result sets
that it has created. All system resources associated with the objects
are freed.
.SH "EXAMPLES"
The following code would look up a telephone number in a directory,
assuming an appropriate SQL schema:
.PP
.CS
package require tdbc::sqlite3
tdbc::sqlite3::connection create db phonebook.sqlite3
set statement [db prepare {
select phone_num from directory
where first_name = :firstname and last_name = :lastname
}]
set firstname Fred
set lastname Flintstone
$statement foreach row {
puts [dict get $row phone_num]
}
$statement close
db close
.CE
.SH "SEE ALSO"
encoding(n), tdbc(n), tdbc::connection(n), tdbc::resultset(n), tdbc::tokenize(n)
.SH "KEYWORDS"
TDBC, SQL, database, connectivity, connection, resultset, statement,
bound variable, stored procedure, call
.SH "COPYRIGHT"
Copyright (c) 2008 by Kevin B. Kenny.
'\" Local Variables:
'\" mode: nroff
'\" End:
'\"

View File

@@ -0,0 +1,101 @@
'\"
'\" tdbc_tokenize.n --
'\"
'\" Copyright (c) 2008 by Kevin B. Kenny.
'\"
'\" See the file "license.terms" for information on usage and redistribution of
'\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH "tdbc::tokenize" n 8.6 Tcl "Tcl Database Connectivity"
'\" .so man.macros
'\" IGNORE
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
'\" # BS - start boxed text
'\" # ^y = starting y location
'\" # ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
'\" # BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
'\" Draw four-sided box normally, but don't draw top of
'\" box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
'\" # CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
'\" # CE - end code excerpt
.de CE
.fi
.RE
..
'\" END IGNORE
.BS
.SH "NAME"
tdbc::tokenize \- TDBC SQL tokenizer
.SH "SYNOPSIS"
.nf
package require \fBtdbc 1.0\fR
\fBtdbc::tokenize\fR \fIstring\fR
.fi
.BE
.SH "DESCRIPTION"
.PP
As a convenience to database drivers, Tcl Database Connectivity (TDBC)
provides a command to break SQL code apart into tokens so that bound
variables can readily be identified and substituted.
.PP
The \fBtdbc::tokenize\fR command accepts as its parameter a string
that is expected to contain one or more SQL statements. It returns a
list of substrings; concatenating these substrings together will yield
the original string. Each substring is one of the following:
.IP [1]
A bound variable, which begins with one of the
characters '\fB:\fR', '\fB@\fR', or '\fB$\fR'. The
remainder of the string is the variable
name and will consist of alphanumeric characters and underscores. (The
leading character will be be non-numeric.)
.IP [2]
A semicolon that separates two SQL statements.
.IP [3]
Something else in a SQL statement. The tokenizer does not attempt to
parse SQL; it merely identifies bound variables (distinguishing them
from similar strings appearing inside quotes or comments) and
statement delimiters.
.SH "SEE ALSO"
tdbc(n), tdbc::connection(n), tdbc::statement(n), tdbc::resultset(n)
.SH "KEYWORDS"
TDBC, SQL, database, tokenize
.SH "COPYRIGHT"
Copyright (c) 2008 by Kevin B. Kenny.
'\" Local Variables:
'\" mode: nroff
'\" End:
'\"