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 Harald Kirsch <Ha...@raytion.com> on 2013/05/17 14:03:44 UTC
DbRecord.update() without prior reading the record
Hi,
I have a table that has a surrogate, autoincremented primary key, a
unique key from the modeled domain and some data columns, like
ID - INTEGER, primary
name, CHAR(10), unique
info, TEXT, NotNull
completed, BOOL
At some point in the program I know the name and I would like to update
the completed column. I thought to use something like
DBRecord rec = new DBRecord();
dbrecord.create(myTable);
dbrecord.setValue(nameColumn, name);
dbrecord.setValue(completed, true);
rec.update()
This throws an exception complaining about info not allowed to be null.
Looking at the source code of empire db it seems like I just can't use
it for an update without the primary key.
Is there another way of directly updating a column by using select,
without first reading the record and then changing it. I see that
DBCommand has a getUpdate(), but I don't see how to set the columns
values to update?
Thanks,
Harald.
--
Harald Kirsch
Raytion GmbH
Kaiser-Friedrich-Ring 74
40547 Duesseldorf
Fon +49-211-550266-0
Fax +49-211-550266-19
http://www.raytion.com