agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
Subject: [Pljava-dev] SPI Updatable recordset
Date: Sat, 24 Jun 2006 15:25:05 +0200
Message-ID: <449D3D31.4030403@tada.se> (raw)
In-Reply-To: <449C5EB2.6030200@gmail.com>
References: <7426fe270606021225p74d767a6kccaafd303f24436c@mail.gmail.com>
	<4480929B.4070806@tada.se>
	<7426fe270606021257y7e6c9402jd84fc9b543571d28@mail.gmail.com>
	<44809B38.9010803@tada.se>
	<7426fe270606030704t55a6d732y3a0073f6cfc7ad16@mail.gmail.com>
	<448738E7.5060200@tada.se>
	<7426fe270606090957q4e5cba22k42e47783e7b453d@mail.gmail.com>
	<449C5EB2.6030200@gmail.com>

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





view thread (4+ messages)

Message-ID: <449D3D31.4030403@tada.se>
Permalink:  ../449D3D31.4030403@tada.se/
Also on:    postgresql.org/message-id/449D3D31.4030403@tada.se

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pljava-dev@postgresql.org
  Subject: Re: [Pljava-dev] SPI Updatable recordset
  In-Reply-To: <449D3D31.4030403@tada.se>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox