[Pljava-dev] SPI Updatable recordset

From: thomas at tada(dot)se (Thomas Hallgren)
To:
Subject: [Pljava-dev] SPI Updatable recordset
Date: 2006-06-24 13:25:05
Message-ID: 449D3D31.4030403@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Eric E wrote:
>
> 1) SPIResultSet extends ResultSetBase which extends
> ReadOnlyResultSet. For simplicity I am just subclassing SPIResultSet
> with UpdateableSPIResultSet, and overriding the methods in
> ReadOnlyResultSet which throw exceptions when you attempt to update.
> Is this the preferred way for me to do it, or I should I update
> somewhere else in the class hierarchy? Naturally, this also requires
> me to make several of SPIResultSet's field variables protected instead
> of private.
>
The inheritance sound OK but I'm not in favor of protected fields.
Please use getters (and setters where applicable). It's just as fast.
Any JVM worth its name will inline such methods more or less
immediately. Sometimes the use of private fields will yield better
performance since it's easier for the optimizer to track changes etc.

> 2) The update functions in the standard JDBC driver update the row
> buffer that backs the ResultSet when executing an update, presumably
> to avoid hitting the database again to get the copy fresh. The row
> buffer is a byte array that pulls out of a Vector of tuples. Offhand
> it does not look like I can write into the Tuple m_current_row in the
> same way - is this true? Any good ideas for how to refresh the row
> with minimal load?
You'll have to replace the m_currentRow with a new Tuple that you create
using TupleDesc.formTuple(Object[]). I think the overhead of doing that
is very low.

Regards,
Thomas Hallgren

In response to

Browse pljava-dev by date

  From Date Subject
Next Message EsSaid Kharrazen 2006-06-25 14:49:57 [Pljava-dev] Tests fails
Previous Message Thomas Hallgren 2006-06-24 11:38:20 [Pljava-dev] How to load a jar with the postmaster