[odb-users] Looking for a database::update_query()
Boris Kolpackov
boris at codesynthesis.com
Thu Aug 22 04:35:08 EDT 2024
Javier Gutierrez <javier.gutierrez at web.de> writes:
> I again am in the need to run an UPDATE using a query.
>
> For such cases in my current code I use native SQL queries for each of the
> possible databases.
> This becomes difficult to test and maintain.
>
> I was wondering if there is a way in ODB to do this, similar to how
> database::erase_query() works?
No, currently there is no way other than with native queries. With
regards to erase_query(), that was easy to support since it only
needed the WHERE clause which we could reuse as-is from the SELECT
queries. With UPDATE we would also need to handle the SET clause
which currently has no analogs in ODB and so we would need to make
something from scratch. It is likely doable and I agree it would be
useful to have (we use native queries for this ourselves in a few
places), but it's not going to be easy and is not a high priority,
unless someone wants to fund this work.
More information about the odb-users
mailing list