yiisoft / db

Yii Database Library
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
134 stars 35 forks source link

Needs to refactor `getRawSql()` #783

Closed Tigrov closed 10 months ago

Tigrov commented 1 year ago

Needs to refactor getRawSql() due to $params always has ParamInterface values

https://github.com/yiisoft/db/blob/8a3d81f815a15e7e1cbff6e7b53a5c0fc9144ede/src/Command/AbstractCommand.php#L116-L118

Also if improve, it will allow

$command
    ->setSql('INSERT INTO table (field) VALUES (:value)')
    ->bindValues(['value' => new Expression('LOWER(:val)', ['val' => 'String']))
    ->getRawSql();

// INSERT INTO table (field) VALUES (LOWER('String'))

Originally posted by @Tigrov in https://github.com/yiisoft/db/issues/759#issuecomment-1823863382