Subject | RE: [Firebird-Java] A suggestion |
---|---|
Author | Robert DiFalco |
Post date | 2003-10-22T20:13:07Z |
Actually, it doesn't look like this will work well for freeing data. I
think you will also need to override FBField's #setObject (and/or
#setNull) method in FBBlobField like so:
void setNull() {
super.setNull();
data = null;
length = null;
}
void setObject(Object value) throws SQLException {
if ( value == null )
setNull();
}
If you add these to FBBlobField, that should do it. Until then, if you
use Blob's with much data, I would NOT cache prepared statements.
R.
-----Original Message-----
From: Robert DiFalco
Sent: Wednesday, October 22, 2003 11:16 AM
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] A suggestion
Keeping fields around when you cache prepared-statements can really
become a drag, especially for large BLOBs and Strings.
Here's my suggestion. Current FBPreparedStatement looks like this:
public void clearParameters() throws SQLException {
for (int i = 0; i < isParamSet.length; i++)
isParamSet[i] = false;
}
I think it would work if you did something like this:
public void clearParameters() throws SQLException {
for (int i = 0; i < isParamSet.length; i++) {
field[i].setObject( null ); // free data
isParamSet[i] = false;
}
Then, in my CachedPreparedStatment#close method, I can just call
#clearParmaters to reclaim storage and make object available for garbage
collecting.
Yahoo! Groups Sponsor
ADVERTISEMENT
To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
think you will also need to override FBField's #setObject (and/or
#setNull) method in FBBlobField like so:
void setNull() {
super.setNull();
data = null;
length = null;
}
void setObject(Object value) throws SQLException {
if ( value == null )
setNull();
}
If you add these to FBBlobField, that should do it. Until then, if you
use Blob's with much data, I would NOT cache prepared statements.
R.
-----Original Message-----
From: Robert DiFalco
Sent: Wednesday, October 22, 2003 11:16 AM
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] A suggestion
Keeping fields around when you cache prepared-statements can really
become a drag, especially for large BLOBs and Strings.
Here's my suggestion. Current FBPreparedStatement looks like this:
public void clearParameters() throws SQLException {
for (int i = 0; i < isParamSet.length; i++)
isParamSet[i] = false;
}
I think it would work if you did something like this:
public void clearParameters() throws SQLException {
for (int i = 0; i < isParamSet.length; i++) {
field[i].setObject( null ); // free data
isParamSet[i] = false;
}
Then, in my CachedPreparedStatment#close method, I can just call
#clearParmaters to reclaim storage and make object available for garbage
collecting.
Yahoo! Groups Sponsor
ADVERTISEMENT
To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.