Problem

How can I change the data in a table with a few instructions.


Solution

The method updateData (both server side and client side) updates the data in a table under a given condition. An example of usage is as follows:

//Server side
int cnt = dbSession.updateData("<package><table>", <columns>, <values>, "<condition>");

//Client side
int cnt = client.updateData(session, "<package><table>", <columns>, <values>, "<condition>");

the parameters are:
<package><table> Table name (full name with package)
<columns> Array of string which contains the names of the columns to update
<values> Array of objects which contains values to be assigned to columns
<condition> Condition of the record to update

method returns the number of records updated.

Published in Sun, 19 December 2010 00:15