[odb-users] Update multiple rows with an Object and/or View

Lukas Obermann obermann.lukas at gmail.com
Fri Oct 6 11:52:22 EDT 2017


Hello,

is it possible to update multiple rows via a object or view?

I am migrating a query which looks like this:
UPDATE table SET some_value = 0 WHERE path = ‚something‘;

It can also be that there are multiple joins in there to determine which ones to update, those are set at runtime.

I know I can do it without joins something like this:
db.execute(
        "UPDATE "+odb::object_traits<MyTable, odb::database_id::id_mysql>::table_name+
        " SET "+ MyTable::m_myValue+" = 0 WHERE "+MyTable::m_path+“ = ’something’“);

Can this be done directly with an object, similar to how delete works. And can this be done with a view, so I can handle the joins and where clauses?

Thanks,
Lukas



More information about the odb-users mailing list