You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Intelligent `LONG DATA` handling in prepared statements
36
36
* Secure `LOAD DATA LOCAL INFILE` support with file Whitelisting and `io.Reader` support
@@ -49,26 +49,24 @@ $ go get github.com/go-sql-driver/mysql
49
49
Make sure [Git is installed](http://git-scm.com/downloads) on your machine and in your system's `PATH`.
50
50
51
51
## Usage
52
-
_Go MySQL Driver_ is an implementation of Go's `database/sql/driver` interface, so all you need to do is to import the driver and open a new database connection with the given driver.
52
+
_Go MySQL Driver_ is an implementation of Go's `database/sql/driver` interface. You only need to import the driver and can use the full [`database/sql`](http://golang.org/pkg/database/sql) API then.
53
53
54
-
Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name) as `dataSourceName`
54
+
Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name) as `dataSourceName`:
All further methods are listed here: http://golang.org/pkg/database/sql
63
-
64
62
[Examples are available in our Wiki](https://github.com/go-sql-driver/mysql/wiki/Examples"Go-MySQL-Driver Examples").
65
63
66
64
67
65
### DSN (Data Source Name)
68
66
69
67
The Data Source Name has a common format, like e.g. [PEAR DB](http://pear.php.net/manual/en/package.database.db.intro-dsn.php) uses it, but without type-prefix (optional parts marked by squared brackets):
@@ -91,29 +89,27 @@ Passwords can consist of any character. Escaping is **not** necessary.
91
89
92
90
#### Protocol
93
91
See [net.Dial](http://golang.org/pkg/net/#Dial) for more information which networks are available.
94
-
In general you should use an Unix-socket if available and TCP otherwise for best performance.
92
+
In general you should use an Unix domain socket if available and TCP otherwise for best performance.
95
93
96
94
#### Address
97
95
For TCP and UDP networks, addresses have the form `host:port`.
98
96
If `host` is a literal IPv6 address, it must be enclosed in square brackets.
99
97
The functions [net.JoinHostPort](http://golang.org/pkg/net/#JoinHostPort) and [net.SplitHostPort](http://golang.org/pkg/net/#SplitHostPort) manipulate addresses in this form.
100
98
101
-
For Unix-sockets the address is the absolute path to the MySQL-Server-socket, e.g. `/var/run/mysqld/mysqld.sock` or `/tmp/mysql.sock`.
99
+
For Unix domain sockets the address is the absolute path to the MySQL-Server-socket, e.g. `/var/run/mysqld/mysqld.sock` or `/tmp/mysql.sock`.
102
100
103
101
#### Parameters
104
102
**Parameters are case-sensitive!**
105
103
106
104
Possible Parameters are:
107
105
*`timeout`: **Driver** side connection timeout. The value must be a string of decimal numbers, each with optional fraction and a unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*. To set a server side timeout, use the parameter [`wait_timeout`](http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_wait_timeout).
108
-
*`charset`: *"SET NAMES `value`"*. If multiple charsets are set (seperated by a comma), the following charset is used if setting the charset failes. This enables support for `utf8mb4` ([introduced in MySQL 5.5.3](http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html)) with fallback to `utf8` for older servers.
106
+
*`charset`: Sets the charset used for client-server interaction (*"SET NAMES `value`"*). If multiple charsets are set (seperated by a comma), the following charset is used if setting the charset failes. This enables support for `utf8mb4` ([introduced in MySQL 5.5.3](http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html)) with fallback to `utf8` for older servers (`charset=utf8mb4,utf8`).
109
107
*`allowAllFiles`: `allowAllFiles=true` disables the file Whitelist for `LOAD DATA LOCAL INFILE` and allows *all* files. *Might be insecure!*
110
-
*_(pending)_ <s>`tls`</s>: will enable SSL/TLS-Encryption
111
-
*_(pending)_ <s>`compress`</s>: will enable Compression
112
108
113
109
All other parameters are interpreted as system variables:
0 commit comments