The tdbc::mysql driver provides a database interface that conforms
to Tcl DataBase Connectivity (TDBC) and allows a Tcl script to connect
to a MySQL database.
Connection to an MYSQL database is established by invoking
tdbc::mysql::connection create, passing it the name to give the
database handle and a set of -option-value pairs. The available
options are enumerated under CONNECTION OPTIONS below.
As an alternative, tdbc::mysql::connection new may be used to create
a database connection with an automatically assigned name. The return value
from tdbc::mysql::connection new is the name that was chosen for the
The side effect of tdbc::mysql::connection create is to create a
new database connection.. See tdbc::connection(n) for the
details of how to use the connection to manipulate a database.
The tdbc::mysql::connection create object command supports the
-encoding, -isolation, -readonly and -timeout
options common to all TDBC drivers. The -encoding option will
always fail unless the encoding is utf-8; the database connection
always uses UTF-8 encoding to be able to transfer arbitrary Unicode
characters. The -readonly option must be 0, because
MySQL does not offer read-only connections.
In addition, the following options are recognized:
The flag value must be a Boolean value. If it is true (or
any equivalent), the default timeout is set for an interactive user,
otherwise, the default timeout is set for a batch user. This option
is meaningful only on initial connection. When using the configure
method on a MySQL connection use the -timeout option to set the
These five options set the certificate authority, certificate authority
search path, SSL certificate, transfer cipher, and SSL key to the
given string arguments. These options may be specified only
on initial connection to a database, not in the configure method
of an existing connection. Default is not to use SSL.
This method takes the given sqlStatement and interprets as
MySQL native SQL code and evaluates it without preparing it. The
statement may not contain variable substitutions. The result set
is returned as a list of lists, with each sublist being the list
of columns of a result row formatted as character strings. Note that
the string formatting is done by MySQL and not by Tcl, so details
like the appearance of floating point numbers may differ.
This command is not recommended for anything where the usual
prepare or preparecall methods work correctly. It is
provided so that data management language statements that are
not implemented in MySQL's prepared statement API, such as
CREATE DATABASE or CREATE PROCEDURE, can be executed.