瀏覽代碼

Add interpolateParams document to README

INADA Naoki 11 年之前
父節點
當前提交
6c8484b12c
共有 1 個文件被更改,包括 12 次插入0 次删除
  1. 12 0
      README.md

+ 12 - 0
README.md

@@ -182,6 +182,18 @@ SELECT u.id FROM users as u
 
 will return `u.id` instead of just `id` if `columnsWithAlias=true`.
 
+##### `interpolateParams`
+
+```
+Type:           bool
+Valid Values:   true, false
+Default:        false
+```
+
+When `interpolateParams` is true, calls to `sql.Db.Query()` and `sql.Db.Exec()` with params interpolates placeholders (`?`) with given params. This reduces roundtrips to database compared with `interpolateParams=false` since it uses prapre, exec and close to support parameters.
+
+NOTE: It make SQL injection vulnerability when connection encoding is not utf8.
+
 ##### `loc`
 
 ```