I exchanged a couple of emails with Moray who expressed an interest in studying the code with a view to help implement this feature. Here is what I thought needs doing. As these steps are in different areas of code, anyone who wants to help is welcome.
The steps are [with a few refinements]: - Support SELECT ... FOR UPDATE. This means checks are performed on the query _after_ compilation to ensure it does not contains constructs that are not allowed (e.g. sum(*)). The method to do this will be similar to org.hsqldb.Select.resolvAll() and the methods that are called from it. The check will simply throw if certain types of org.hsqldb.Expression are encountered - The Select object will have extra columns tagged to the end with primary key columns of all the tables involved. The columns are in org.hsqldb.Select.eColumn - A new type of org.hsqldb.Result is added, which is similar to ResultConstants.DATA. This will be used to read back the updated ResultSet. - Method definitions for org.hsqldb.jdbcResultSet.setXXX are added, similar to jdbcPreparedStatement.setXXX - A new method is added somewhere to use this result set to update the affected rows directly. This method will be similar to org.hsqldb.CompiledStatementExecutor.executeUpdateStatement() - Some additional flags and state variables will have to be added here and there to take care of transactions and cases where rows have changed between the creation of the ResultSet and the updates. - Maybe a bit more work on transactions than I mentioned above Fred ----- Original Message ----- From: "Moray Taylor" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: 13 October 2003 10:13 Subject: [Hsqldb-developers] Updatable resultsets Hi, Short Version: Are there any plans to implement updatable resultsets, i.e. insertRow(), updateObject()? Long Version: I am writing an application that is basicaly a database client, at the moment, it works with MySQL, PostGres, and DB2. I'd really like to add the option for an embedded DB, HSQLDB seems perfect for this, apart from one thing, I need updatable ResultSets. For insertRow(), I could work around it by doing it 'old school' with INSERTs, but it wouldn't be as nice. For updateObject()/updateString() etc.., I don't see a workaround. I am happy to contribute code, beta-testing etc... but I don't have much experience with writing JDBC interfaces, just using them, so I'm not sure if I'd be much use. Thanks Moray ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ hsqldb-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hsqldb-developers ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ hsqldb-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hsqldb-developers