Skip to content

Commit aede2e9

Browse files
committed
document how notes can be ignored + test
fixes #235
1 parent b44cac6 commit aede2e9

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ Valid Values: true, false
187187
Default: false
188188
```
189189

190-
`strict=true` enables strict mode. MySQL warnings are treated as errors.
190+
`strict=true` enables the strict mode in which MySQL warnings are treated as errors.
191+
192+
By default MySQL also treats notes as warnings. Use [`sql_notes=false`](http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_sql_notes) to ignore notes. See the [examples](#examples) for an DSN example.
191193

192194

193195
##### `timeout`
@@ -234,6 +236,11 @@ root:pw@unix(/tmp/mysql.sock)/myDatabase?loc=Local
234236
user:password@tcp(localhost:5555)/dbname?tls=skip-verify&autocommit=true
235237
```
236238

239+
Use the [strict mode](#strict) but ignore notes:
240+
```
241+
user:password@/dbname?strict=true&sql_notes=false
242+
```
243+
237244
TCP via IPv6:
238245
```
239246
user:password@tcp([de:ad:be:ef::ca:fe]:80)/dbname?timeout=90s

errors_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ func TestSetLogger(t *testing.T) {
2828
t.Errorf("expected %q, got %q", expected, actual)
2929
}
3030
}
31+
32+
func TestErrorsStrictIgnoreNotes(t *testing.T) {
33+
runTests(t, dsn+"&sql_notes=false", func(dbt *DBTest) {
34+
dbt.mustExec("DROP TABLE IF EXISTS does_not_exist")
35+
})
36+
}

0 commit comments

Comments
 (0)