You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@empire-db.apache.org by Paolo Predonzani <pa...@manydesigns.com> on 2009/04/02 20:54:33 UTC

reading and updating records

Hi,
I'm starting to learn empire-db. I have a problem with the following
situation.
My goal is to:
1- Select some records from the database (e.g., all employees where
department = X)
2- Change some values on those records (e.g., add an amount to the salary)
3- Save those records back to the database

Step 2 is done interactively by the user, so I cannot do steps 1,2,3 in a
single UPDATE statement.

My question is: if I build the query using a DBCommand, how do I get its
results as a list of DBRecords?
I believe I need DBRecords in step 3 to run the update.

I see how:
- a DBReader can give me a list of beans, but not a list of DBRecords?
- a DBReader can return an iterator of DBRecordData, but I'm not sure I know
how to use that.
- I can wrap a DBCommand using a DBQuery, but from there I can only read
records of which I can provide the primary key (readRecord() method), which
I can't since I don't know what the result of my query contains.


Have I missed anything in the docs?

Thank you for any help
Regards


Paolo