Skip to content

Commit 2b7dffe

Browse files
dolmenjulienschmidt
authored andcommitted
README: document DSN system var quoting rules (mysqljs#502)
* README: document DSN system var quoting rules (mysqljs#405) Improve documentation of quoting rules for system var values in DSN. go-sql-driver/mysql#405 * Add myself to AUTHORS Fixes mysqljs#405
1 parent ce924a4 commit 2b7dffe

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Lucas Liu <extrafliu at gmail.com>
3838
Luke Scott <luke at webconnex.com>
3939
Michael Woolnough <michael.woolnough at gmail.com>
4040
Nicola Peduzzi <thenikso at gmail.com>
41+
Olivier Mengué <dolmen at cpan.org>
4142
Paul Bonser <misterpib at gmail.com>
4243
Runrioter Wung <runrioter at gmail.com>
4344
Soroush Pour <me at soroushjp.com>

README.md

+14-6
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,21 @@ I/O write timeout. The value must be a decimal number with an unit suffix ( *"ms
315315

316316
##### System Variables
317317

318-
All other parameters are interpreted as system variables:
319-
* `autocommit`: `"SET autocommit=<value>"`
320-
* [`time_zone`](https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html): `"SET time_zone=<value>"`
321-
* [`tx_isolation`](https://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_tx_isolation): `"SET tx_isolation=<value>"`
322-
* `param`: `"SET <param>=<value>"`
318+
Any other parameters are interpreted as system variables:
319+
* `<boolean_var>=<value>`: `SET <boolean_var>=<value>`
320+
* `<enum_var>=<value>`: `SET <enum_var>=<value>`
321+
* `<string_var>=%27<value>%27`: `SET <string_var>='<value>'`
322+
323+
Rules:
324+
* The values for string variables must be quoted with '
325+
* The values must also be [url.QueryEscape](http://golang.org/pkg/net/url/#QueryEscape)'ed!
326+
(which implies values of string variables must be wrapped with `%27`)
327+
328+
Examples:
329+
* `autocommit=1`: `SET autocommit=1`
330+
* [`time_zone=%27Europe%2FParis%27`](https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html): `SET time_zone='Europe/Paris'`
331+
* [`tx_isolation=%27REPEATABLE-READ%27`](https://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_tx_isolation): `SET tx_isolation='REPEATABLE-READ'`
323332

324-
*The values must be [url.QueryEscape](http://golang.org/pkg/net/url/#QueryEscape)'ed!*
325333

326334
#### Examples
327335
```

0 commit comments

Comments
 (0)