tdbc_mysql.n 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. '\"
  2. .\" tdbc_mysql.n --
  3. .\"
  4. .\" Copyright (c) 2008 by Kevin B. Kenny.
  5. .\"
  6. .\" See the file "license.terms" for information on usage and redistribution of
  7. .\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
  8. .TH "tdbc::mysql" n 8.6 Tcl "Tcl Database Connectivity"
  9. .\" .so man.macros
  10. .if t .wh -1.3i ^B
  11. .nr ^l \n(.l
  12. .ad b
  13. .\" # BS - start boxed text
  14. .\" # ^y = starting y location
  15. .\" # ^b = 1
  16. .de BS
  17. .br
  18. .mk ^y
  19. .nr ^b 1u
  20. .if n .nf
  21. .if n .ti 0
  22. .if n \l'\\n(.lu\(ul'
  23. .if n .fi
  24. ..
  25. .\" # BE - end boxed text (draw box now)
  26. .de BE
  27. .nf
  28. .ti 0
  29. .mk ^t
  30. .ie n \l'\\n(^lu\(ul'
  31. .el \{\
  32. .\" Draw four-sided box normally, but don't draw top of
  33. .\" box if the box started on an earlier page.
  34. .ie !\\n(^b-1 \{\
  35. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  36. .\}
  37. .el \}\
  38. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  39. .\}
  40. .\}
  41. .fi
  42. .br
  43. .nr ^b 0
  44. ..
  45. .\" # CS - begin code excerpt
  46. .de CS
  47. .RS
  48. .nf
  49. .ta .25i .5i .75i 1i
  50. ..
  51. .\" # CE - end code excerpt
  52. .de CE
  53. .fi
  54. .RE
  55. ..
  56. .BS
  57. .SH "NAME"
  58. tdbc::mysql \- TDBC-MYSQL bridge
  59. .SH "SYNOPSIS"
  60. package require \fBtdbc::mysql 1.0\fR
  61. .sp
  62. \fBtdbc::mysql::connection create\fR \fIdb\fR ?\fI-option value...\fR?
  63. .br
  64. \fBtdbc::mysql::connection new\fR ?\fI-option value...\fR?
  65. .sp
  66. \fBtdbc::mysql::datasources\fR ?\fB-system\fR|\fB-user\fR?
  67. .sp
  68. \fBtdbc::mysql::drivers\fR
  69. .sp
  70. \fBtdbc::mysql::datasource\fR \fIcommand\fR \fIdriverName\fR ?\fIkeyword\fR-\fIvalue\fR?...
  71. .BE
  72. .SH "DESCRIPTION"
  73. .PP
  74. The \fBtdbc::mysql\fR driver provides a database interface that conforms
  75. to Tcl DataBase Connectivity (TDBC) and allows a Tcl script to connect
  76. to a MySQL database.
  77. .PP
  78. Connection to an MYSQL database is established by invoking
  79. \fBtdbc::mysql::connection create\fR, passing it the name to give the
  80. database handle and a set of \fI-option-value\fR pairs. The available
  81. options are enumerated under CONNECTION OPTIONS below.
  82. As an alternative, \fBtdbc::mysql::connection new\fR may be used to create
  83. a database connection with an automatically assigned name. The return value
  84. from \fBtdbc::mysql::connection new\fR is the name that was chosen for the
  85. connection handle.
  86. .PP
  87. The side effect of \fBtdbc::mysql::connection create\fR is to create a
  88. new database connection.. See \fBtdbc::connection(n)\fR for the
  89. details of how to use the connection to manipulate a database.
  90. .SH "CONNECTION OPTIONS"
  91. .PP
  92. The \fBtdbc::mysql::connection create\fR object command supports the
  93. \fB-encoding\fR, \fB-isolation\fR, \fB-readonly\fR and \fB-timeout\fR
  94. options common to all TDBC drivers. The \fB-encoding\fR option will
  95. always fail unless the encoding is \fButf-8\fR; the database connection
  96. always uses UTF-8 encoding to be able to transfer arbitrary Unicode
  97. characters. The \fB-readonly\fR option must be \fB0\fR, because
  98. MySQL does not offer read-only connections.
  99. .PP
  100. In addition, the following options are recognized:
  101. .IP "\fB-host\fR \fIhostname\fR"
  102. Connects to the host specified by \fIhostname\fR. This option must be
  103. set on the initial creation of the connection; it cannot be changed
  104. after connecting. Default is to connect to the local host.
  105. .IP "\fB-port\fR \fInumber\fR"
  106. Connects to a MySQL server listening on the port specified by \fInumber\fR.
  107. This option may not be changed after connecting. It is used only when
  108. \fIhost\fR is specified and is not \fBlocalhost\fR.
  109. .IP "\fB-socket\fR \fIpath\fR"
  110. Connects to a MySQL server listening on the Unix socket or named
  111. pipe specified by \fIpath\fR . This option may not be changed after connecting.
  112. It is used only when \fI-host\fR is not specified or is \fBlocalhost\fR.
  113. .IP "\fB-user\fR \fIname\fR"
  114. Presents \fIname\fR as the user name to the MySQL server. Default is the
  115. current user ID.
  116. .IP "\fB-passwd\fR \fIpassword\fR"
  117. .IP "\fB-password\fR \fIpassword\fR"
  118. These two options are synonymous. They present the given \fIpassword\fR as
  119. the user's password to the MySQL server. Default is not to present a password.
  120. .IP "\fB-database\fR \fIname\fR"
  121. .IP "\fB-db\fR \fIname\fR"
  122. These two options are synonymous. They present the given \fIname\fR as the
  123. name of the default database to use in MySQL queries. If not specified,
  124. the default database for the current user is used.
  125. .IP "\fB-interactive\fR \fIflag\fR"
  126. The \fIflag\fR value must be a Boolean value. If it is \fBtrue\fR (or
  127. any equivalent), the default timeout is set for an interactive user,
  128. otherwise, the default timeout is set for a batch user. This option
  129. is meaningful only on initial connection. When using the \fBconfigure\fR
  130. method on a MySQL connection use the \fB-timeout\fR option to set the
  131. timeout desired.
  132. .IP \fB-ssl_ca\fR \fIstring\fR
  133. .IP \fB-ssl_capath\fR \fIstring\fR
  134. .IP \fB-ssl_cert\fR \fIstring\fR
  135. .IP \fB-ssl_cipher\fR \fIstring\fR
  136. .IP \fB-ssl_key\fR \fIstring\fR
  137. These five options set the certificate authority, certificate authority
  138. search path, SSL certificate, transfer cipher, and SSL key to the
  139. given \fIstring\fR arguments. These options may be specified only
  140. on initial connection to a database, not in the \fBconfigure\fR method
  141. of an existing connection. Default is not to use SSL.
  142. .SH EXAMPLES
  143. .PP
  144. .CS
  145. tdbc::mysql::connection -user joe -passwd sesame -db joes_database
  146. .CE
  147. Connects to the MySQL server on the local host using the default
  148. connection method, presenting user ID 'joe' and password 'sesame'.
  149. Uses 'joes_database' as the default database name.
  150. .SH "ADDITIONAL CONNECTION METHODS"
  151. In addition to the usual methods on the tdbc::connection(n) object,
  152. connections to a MySQL database support one additional method:
  153. .IP "\fI$connection\fR \fBevaldirect\fR \fIsqlStatement\fR"
  154. This method takes the given \fIsqlStatement\fR and interprets as
  155. MySQL native SQL code and evaluates it without preparing it. The
  156. statement may not contain variable substitutions. The result set
  157. is returned as a list of lists, with each sublist being the list
  158. of columns of a result row formatted as character strings. Note that
  159. the string formatting is done by MySQL and not by Tcl, so details
  160. like the appearance of floating point numbers may differ.
  161. \fIThis command is not recommended\fR for anything where the usual
  162. \fIprepare\fR or \fIpreparecall\fR methods work correctly. It is
  163. provided so that data management language statements that are
  164. not implemented in MySQL's prepared statement API, such as
  165. \fBCREATE DATABASE\fR or \fBCREATE PROCEDURE\fR, can be executed.
  166. .SH "SEE ALSO"
  167. tdbc(n), tdbc::connection(n), tdbc::resultset(n), tdbc::statement(n)
  168. .SH "KEYWORDS"
  169. TDBC, SQL, MySQL, database, connectivity, connection
  170. .SH "COPYRIGHT"
  171. Copyright (c) 2009 by Kevin B. Kenny.
  172. .\" Local Variables:
  173. .\" mode: nroff
  174. .\" End:
  175. .\"