Hi Rainer, Thank you for your reply.
Could you please just give a short example on how to perform an UPDATE with a DBCommand? Regards, exxos. On Sun, Aug 15, 2010 at 11:04 PM, Rainer Döbele <[email protected]> wrote: > Hi exxos, > > > > In your update example the call to rec.read() will read the record from the > database by executing a corresponding SELECT statement. > > The UPDATE then only updates the changed fields. > > > > It is part of our design, that we don’t store connections since they are an > external resource that might be shared between threads or requests and hence > a connection must be supplied every time a database action is performed. But > you may add your own layer (e.g. by deriving a class from DBRecord) to > implement a connection handling that suits your purpose. > > > > If you don’t want to read before an update – e.g. if you know that the > value will change and don’t need the extra logic – then you should use a > DBCommand to update a record. > > > > Regards, > > Rainer > > > > > > *from:* exxos [mailto:[email protected]] > *to:* [email protected] > *re:* Why the connection is given two times in case of UPDATE? > > > > Hello, > > > > Sorry to spam the august's mailling list. ^__^ > > > > But, I need a clarification on the implementation for the INSERT and the > UPDATE methods. > > > > Accroding you tutorial, the following steps are needed: > > > > // INSERT > DBRecord rec = new DBRecord(); > rec.create(DBRowSet table); > rec.setValue(...) > rec.update(java.sql.Connection conn); > > > > // UPDATE > DBRecord rec = new DBRecord(); > rec.read(..., java.sql.Connection conn); > rec.setValue(...) > rec.update(java.sql.Connection conn); > > > Why in case of the UPDATE we have to give the Connection by two times? > > > > Thank to advise, > > Regards. > > > > >
