db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deepa Remesh" <drem...@gmail.com>
Subject [DRDA] Question about DRDAStatement.initialize() method
Date Thu, 23 Feb 2006 22:11:42 GMT
Hi,

For my DERBY-1002 patch, I have added a method DRDAStatement.reuse()
which resets all fields in this class.

        /**
	 * Clean up statements and result set for reuse.
         * This method should reset all members of this class except the
         * following which will be set at initial creation or set
explicitly in the code:
         * database, pkgnamcsn, pkgcnstkn, pkgid, pkgsn
         *
         * @throws SQLException
	 */
         protected void reuse() throws SQLException {
                ...
         }

I was just going through all methods in DRDAStatement and found that
there is a method called initialize() which does this:
        /**
	 * Initialize for reuse
	 */
	protected void initialize()
	{
		setTypDefValues();
	}
where setTypDefValues() does this:
         /**
	 * set TypDef values
	 *
	 */
	protected void setTypDefValues()
	{
		// initialize statement values to current database values
		this.typDefNam = database.typDefNam;
		this.byteOrder = database.byteOrder;
		this.ccsidSBC = database.ccsidSBC;
		this.ccsidDBC = database.ccsidDBC;
		this.ccsidMBC = database.ccsidMBC;
		this.ccsidSBCEncoding = database.ccsidSBCEncoding;
		this.ccsidDBCEncoding = database.ccsidDBCEncoding;
		this.ccsidMBCEncoding = database.ccsidMBCEncoding;
	}


I have couple of questions:
1. I find it confusing to have a initialize and reuse method with
similar comments. Can initialize be removed since we can call
setTypDefValues directly at places where it is currently called?

2. initialize() is called at called at 5 places in the server code.
Two of these places (DRDAConnThread methods parseEXCSQLIMM and
parseEXCSQLSETobjects) have the following comment:

// initialize statement for reuse
drdaStmt.initialize();

I am not sure about the actual intention of calling initialize() at
these places - whether it is to just reset the typedef values or does
it expect all fields to be reset for reuse. Can someone familiar with
code look at these places to see it is enough to use initialize() at
these places? If this does not look right, I can open another issue
for this.

3. Is my comment for the new reuse method() okay? specifically, the
comment about fields which should not be reset?
"This method should reset all members of this class except the
following which will be set at initial creation or set explicitly in
the code: database, pkgnamcsn, pkgcnstkn, pkgid, pkgsn"

I would appreciate if someone can answer these.

Thanks,
Deepa

Mime
View raw message