[ http://issues.apache.org/jira/browse/DERBY-1002?page=all ]

Deepa Remesh updated DERBY-1002:
--------------------------------

    Attachment: derby1002-patch2-v2.diff
                derby1002-patch2-v2.status

Attaching 'derby1002-patch2-v2.diff' for Bryans' comments in the following 
derby-dev mail:
http://www.nabble.com/Re%3A-jira-Updated%3A-%28DERBY-1002%29-Check-that-DRDAStatement-and-DRDAResultSet-states-are-reset-when-they-are-re-used-p3135530.html

This patch modifies only one file: lang/procedure.java. With this patch, I have 
re-run lang/procedure.java. 

Please take a look at following two patches - patch 1 contains code changes and 
patch 2 contains tests. These have to be committed together.

------------------------------------------
1. derby1002-patch1-v1
------------------------------------------
* Adds reset() methods to DRDAStatement and DRDAResultSet objects. The purpose 
of reset method is to reset the states of all variables so that the objects can 
be re-used and will not have left-over states.

* In case of DRDAStatement, the following variables are not reset:
+ * 1. database - This variable gets initialized in the constructor and by
+ * call to setDatabase.
+ * 2. members which get initialized in setPkgnamcsn (pkgnamcsn, pkgcnstkn,
+ * pkgid, pkgsn, isolationLevel, cursorName). pkgnamcsn is the key used to
+ * find if the DRDAStatement can be re-used. Hence its value will not change
+ * when the object is re-used.

* close() methods are changed to only close and dereference objects.

* DRDAStatement.rsClose() method is not used in close() or reset(). This method 
has some checks which were causing the method to return without resetting 
currentDrdaRs. Now, close() calls currentDrdaRs.close() and reset() calls 
currentDrdaRs.reset().

* In Database.newDrdaStatement, close() method is called followed by reset() 
when the server finds the statement can be re-used. 

------------------------------------------
2. derby1002-patch2-v2
------------------------------------------
Modifies test lang/procedure.java. Adds a method 'setupStatementReuse' which 
creates and uses statements in such a way as to provoke re-use of statements 
and result sets on network server. This method is called from tests for 
jira-491 and 'testImplicitClose'.

------------------------------------------------------------------------------------
Remaining TODOs for DERBY-1002
------------------------------------------------------------------------------------
* pkgcnstkn, pkgid, pkgsn variables can be removed from DRDAStatement since 
these are derived from pkgnamcsn object.
* Look into what is required by initialize() of default statement. Currently, 
initialize just calls setTypDefValues(). Once the purpose of this method is 
confirmed, we may need to modify the comments at places it is currently called.

NOTE: patch 1 contains code changes and patch 2 contains tests. These have to 
be committed together.

> Check that DRDAStatement and DRDAResultSet states are reset when they are 
> re-used
> ---------------------------------------------------------------------------------
>
>          Key: DERBY-1002
>          URL: http://issues.apache.org/jira/browse/DERBY-1002
>      Project: Derby
>         Type: Bug
>   Components: Network Server
>     Reporter: Deepa Remesh
>     Assignee: Deepa Remesh
>      Fix For: 10.2.0.0
>  Attachments: derby1002-patch1-draft1.diff, derby1002-patch1-draft1.status, 
> derby1002-patch1-v1.diff, derby1002-patch1-v1.status, 
> derby1002-patch2-v2.diff, derby1002-patch2-v2.status, derby1002.java
>
> Network server re-uses DRDAStatement and DRDAResultSet objects when client 
> sends a request with same section number. When re-using DRDAStatement, it's 
> close() method is called which inturn calls close() method of DRDAResultSet. 
> For re-use to work properly, we have to ensure the states of these objects 
> are reset. This is not a bug but it is an area for possible improvements like:
> * The reset of all states are not in the close() methods. The states get 
> re-initialized at different places in the code. Fo example, in case of 
> DRDAResultSet, they get initialized in some other DRDAStatement methods - 
> like addResultSet, setRsDefaultOptions, setOPNQRYOptions, setQueryOptions 
> etc. It will be good to have all resets in one method.
> * The method name "close" is confusing since it is also called when objects 
> get re-used. For clarity, it may be good to have a method named reset(). And 
> then have the close method call reset.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to