Skip to content

Commit

Permalink
guide: note about param binding on strings, not arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
cebe committed Jun 7, 2017
1 parent 3dc8f42 commit a3501ed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/guide/db-dao.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ Notice that you bind the placeholder to the `$id` variable before the execution,
before each subsequent execution (this is often done with loops). Executing queries in this manner can be vastly
more efficient than running a new query for every different parameter value.

> Info: Parameter binding is only used in places where values need to be inserted into strings that contain plain SQL.
> In many places in higher abstraction layers like [query builder](db-query-builder.md) and [active record](db-active-record.md)
> you often specify an array of values which will be transformed into SQL. In these places parameter binding is done by Yii
> internally, so there is no need to specify params manually.

### Executing Non-SELECT Queries <span id="non-select-queries"></span>

Expand Down Expand Up @@ -381,7 +386,7 @@ Yii provides four constants for the most common isolation levels:
- [[\yii\db\Transaction::SERIALIZABLE]] - the strongest level, avoids all of the above named problems.

Besides using the above constants to specify isolation levels, you may also use strings with a valid syntax supported
by the DBMS that you are using. For example, in PostgreSQL, you may use `SERIALIZABLE READ ONLY DEFERRABLE`.
by the DBMS that you are using. For example, in PostgreSQL, you may use `"SERIALIZABLE READ ONLY DEFERRABLE"`.

Note that some DBMS allow setting the isolation level only for the whole connection. Any subsequent transactions
will get the same isolation level even if you do not specify any. When using this feature
Expand Down

0 comments on commit a3501ed

Please sign in to comment.