Does Moodle's DB api have a way to bulk update existing and non-existing items with different values? For example, I receive a bunch of values from an REST API and want to update the Moodle DB table with these values.
id=1 val=4
id=2 val=20
id=3 val=24
...
I'm doing it through a loop right now with "$DB->update_record()" or "$DB->insert_record()". I saw that there is a "bulk" value you can pass, but it looks like it's not even implemented in the mysql DB implementation. I was thinking of doing a DB->exec() with something like:
INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6) ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);
But I don't think that works for Ansi or even Oracle and I don't want to restrict for specific DBMS's
Are there any examples or APIs that I should use instead?
Thanks
Bryan