瀏覽代碼

README: Clarify strict mode (#500)


The strict mode may not be confused with the server-side strict mode
set via the sql_mode system variable.
Fixes #376

* README: Set strict mode via sql_mode in DSN example
Julien Schmidt 9 年之前
父節點
當前提交
68ea39f373
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      README.md

+ 6 - 4
README.md

@@ -263,9 +263,11 @@ Valid Values:   true, false
 Default:        false
 ```
 
-`strict=true` enables the strict mode in which MySQL warnings are treated as errors.
+`strict=true` enables a driver-side strict mode in which MySQL warnings are treated as errors. This mode should not be used in production as it may lead to data corruption in certain situations.
 
-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.
+A server-side strict mode, which is safe for production use, can be set via the [`sql_mode`](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html) system variable.
+
+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.
 
 
 ##### `timeout`
@@ -331,9 +333,9 @@ root:pw@unix(/tmp/mysql.sock)/myDatabase?loc=Local
 user:password@tcp(localhost:5555)/dbname?tls=skip-verify&autocommit=true
 ```
 
-Use the [strict mode](#strict) but ignore notes:
+Treat warnings as errors by setting the system variable [`sql_mode`](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html):
 ```
-user:password@/dbname?strict=true&sql_notes=false
+user:password@/dbname?sql_mode=TRADITIONAL
 ```
 
 TCP via IPv6: