catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.84k stars 1.15k forks source link

SQL Functions on update/insert broken. #575

Closed zenonuk closed 7 years ago

zenonuk commented 7 years ago

It appears that using the

'#column' => 'NOW()'

syntax for updating columns during an update/insert is broken.

For example:

        $medoo->insert('my_table', array(
                'name' => $name,
                'comment' => empty($description) ? '' : $description,
                '#created' => 'NOW()'
          ));

where the 'created' column is a datetime, NOW() is never executed and is instead bound as a string argument, resulting in an invalid assignment.

This regression appears to have been introduced as a result of moving to the bindValue approach, which cannot support SQL functions in bound parameters. The documentation stating this work on insert/update is still in place.

zenonuk commented 7 years ago

Noted now fixed in latest release.