Hi,
How to get massive sql in Aurelius?
By massive operations I mean SQL statements like " DELETE FROM table_name WHERE condition;" but the condition is not the primary key (only one record) but a set of records identified by another key with duplicates?
(e.g. Delete from Details where masterkey = 1000).
The same thing also applies to Update, of course.
In short, how can we update the DB without necessarily having to load an objectlist on which to apply the .remove or .update (very slow operation)?
I hope I was clear :-)
Delete from Details where masterkey in
(Select distinct detail_key from subitems where color = 'periwinkle')
Hi Tim,
An AURELIUS, ORM way, not SQL.
Or how and where to inject that code into Aurelius syntax, using Aurelius classes and entities.
(if possible...)
I found this post on the argument:
Following clarifications in the other post, I will reformulate my question:
If I create a new entity (MyCustomer:=TCustomer.create), assign it only the unique key (Mycustomer.id = 200) and then delete the entity (Manager.remove(Mycustomer)), I get the record deleted from the DB ?
Thanks
No, you have to fill the primary key of the entity to get it deleted.
But Manager.Update(Mycustomer) works if I assign the ID (Mycustomer.id = 200), and set only another property (a patch method).
Why not also with Manager.Remove?
In practice what I want to avoid is the select from the database before performing the delete, if I don't care whether the record to be deleted already exists or not. It's a question of optimization (especially when we use cached update operation on server).
Can we request it as an improvement?
Thanks a lot
Because it's a totally different operation. You said yourself, you still have to set the primary key so that Manager.Update
finds the record and then changes the other fields.