Question

Apologize for the multiple questions on this topic. I am trying to update a column based on other columns in a table and so far nothing seems to be working. I tried updateWhere and then rawSQL with update (Ambiguous Type Error When Using RawSql Update) but both have issues.

updateWhere does not allow other columns names (only values) so that's ruled out.

I tried rawSQL with an Update but it is automatically expanding all the entity names which breaks the update. If there is a way to stop it from expanding column names (not putting ?? does not solve that problem), that will work perfectly. For example if I do: Update table SET X = Y - ? [input values] , it creates UPDATE table.f1, table.f2, etc. SET X = Y - ? [input values]

This is one of those queries that I want to run in the background as an admin so I don't care for type safety. If there is a way to blindly execute a SQL string, that will work as well.

All I want to do is : SET X = (Y - Constant). Any suggestions will be greatly appreciated.

Thanks you!

Was it helpful?

Solution

I haven't tried myself, but from reading the module documentation, I think rawExecute is what you are looking for.

You might also what to file a bug report for persistent. I don't think rawSql is supposed to do column name expansion for anything but ??. At the least, it's an omission in the documentation even if it's the desired behavior.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top