Mysql substring function bug
thehovdev opened this issue · 1 comments
thehovdev commented
This is not working
Spec::SUBSTRING(Spec::field('last_name', 'pt'), 1, 1)
but this is working
Spec::SUBSTRING(Spec::field('last_name', 'pt'), new Value(1), 1)
peter-gribanov commented
Thanks for your report.
This is not quite a bug. The conversion of arguments was designed that way. It is not always possible to accurately determine where the Field operand should be and where the Value operand is. It is preferable to use operands in explicit form than to hope for implicit conversion.
By default, the first argument is converted to a Field operand, and the last to a Value operand. All intermediate arguments were not converted.