dibi
dibi copied to clipboard
FOR UPDATE doesn't work if it's not added after limit
Version: 4.2.0
Bug Description
forUpdate doesn't work correct with fluent interface when after it we're calling fetch or fetchSingle. FOR UPDATE is added before limit and we get Sql exception
Steps To Reproduce
$db->select('whatever')->from('table)
->where('id = %i', $id)
->forUpdate()
->fetchSingle();
however this works:
$db->select('whatever')->from('table)
->where('id = %i', $id)
->limit(1)
->forUpdate()
->fetchSingle();
This would require change the limit() behavior in the Fluent, which would cause a BC break, so I don't want to deal with it at all…