When attempting to delete a batch of records, only the odd rows are deleted!
val byUser = Orders.createFinderBy(_.userID)
byUser(id).mutate(_.delete)
If I instead print the record, I get the correct number of rows.
byUser(id).mutate{x => x.echo}
I worked around the issue like this, which generates the desired SQL.
(for{o <- Orders if o.userID is id.bind } yield o).delete
But, why or how does the mutate version affect only the odd rows?
I've had a dig around in the source code and it seems to be as @RexKerr says - an iterator is used to process the elements, applying the deletions as it iterates (the while loop in the mutate method here):
https://github.com/rjmac/scala-query/blob/master/src/main/scala/org/scalaquery/MutatingInvoker.scala
Interestingly there is a previousAfterDelete flag that can be used to force the iterator backwards after each deletion. This appears to be set to true for Access databases (see the AccessQueryInvoker class) but not others:
I would recommend downloading the sources and debugging the code. Perhaps this flag should be set for the database vendor you are using. I'd also consider filing a bug report:
http://scalaquery.org/community.html
PS. I know this is an old question but answered it just in case anyone else has had this problem