Tcl8.6.10/Tk8.6.10 Documentation > tdbc::mysql Package Commands, version 1.1.1 > tdbc_mysql
Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API
- NAME
- tdbc::mysql — TDBC-MYSQL bridge
- SYNOPSIS
- DESCRIPTION
- CONNECTION OPTIONS
- EXAMPLES
- ADDITIONAL CONNECTION METHODS
- SEE ALSO
- KEYWORDS
- COPYRIGHT
NAME
tdbc::mysql — TDBC-MYSQL bridgeSYNOPSIS
package require tdbc::mysql 1.0tdbc::mysql::connection create db ?-option value...?
tdbc::mysql::connection new ?-option value...?
tdbc::mysql::datasources ?-system|-user?
tdbc::mysql::drivers
tdbc::mysql::datasource command driverName ?keyword-value?...
DESCRIPTION
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 connection handle.
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.
CONNECTION OPTIONS
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:
EXAMPLES
tdbc::mysql::connection -user joe -passwd sesame -db joes_databaseConnects to the MySQL server on the local host using the default connection method, presenting user ID 'joe' and password 'sesame'. Uses 'joes_database' as the default database name.
ADDITIONAL CONNECTION METHODS
In addition to the usual methods on the tdbc::connection(n) object, connections to a MySQL database support one additional method:
- $connection evaldirect sqlStatement
- 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.