yii2-debug icon indicating copy to clipboard operation
yii2-debug copied to clipboard

Quoted DB expression when used in param

Open yii-bot opened this issue 9 years ago • 0 comments

This issue has originally been reported by @klevron at https://github.com/yiisoft/yii2/issues/6382. Moved here by @cebe.


Hello

DB Expression is quoted when used in param, e.g.

MyModel::deleteAll("expire < :expire", [':expire' => new Expression('NOW()')]);

This will make the following query :

DELETE FROM `expire` WHERE expire < 'NOW()';

Be careful, debug tool will log the correct one :

DELETE FROM `expire` WHERE expire < NOW();

http://stackoverflow.com/questions/27312579/odd-behavior-of-now-and-db-expression-in-yii2-mysql

yii-bot avatar Jan 24 '16 15:01 yii-bot