db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yiqing Zhu <XGDJ_a...@hotmail.com>
Subject RE: [?? Probable Spam] Re: A potential bug report
Date Mon, 12 Sep 2011 15:38:39 GMT


-----Original Message-----
From: Knut Anders Hatlen [mailto:knut.hatlen@oracle.com] 
Sent: Monday, September 12, 2011 8:32 PM
To: derby-dev@db.apache.org
Subject: [?? Probable Spam] Re: A potential bug report

Yiqing Zhu <XGDJ_alex@hotmail.com> writes:

> Hi, 
>
> Currently I’m doing some programming analysis work on derby.
>
> And I found that in the function ”EmbedResultSet.close()”, we should
> add the follow snippet after the statement “currentRow =null”. In
> order to make the function complete. 
>
> Snippet:
>
> if (columnGotUpdated != null && currentRowHasBeenUpdated) {
>
> initializeUpdateRowModifiers();
>
> }
>
>
> Am I right? Wish you reply, thank you very much!

Hi Yiqing,

Thanks for reporting this potential problem. Could you please elaborate
on why you think the extra code is needed in EmbedResultSet.close()?
After close() has been called, most methods of EmbedResultSet will throw
an SQLException if they are called. So it might be OK that some state
variables are not reset by close, as they will not be used again. 

-- 
Knut Anders


Hi, 
Thank you very much for your reply.
I find one program semantic rule in this class is "each time when 'currentRow' is set to null,
'currentRowHasBeenUpdated' should be set to false, which is done by calling initializeUpdateRowModifiers().
And this rule is proved by the comments in this class.
I think your point of view is right. After the "close()" is called, the "isClosed" field will
be set to true, so if other methods in this class are called and check this value, it will
throw SQLException.
However, because I don’t have a complete idea of derby, I'm not sure whether there exists
some method missing checking the "isClosed" field, so I think this inconsistent state may
cause some potential problem.
Therefore, if the snippet "if (columnGotUpdated != null && currentRowHasBeenUpdated)
initializeUpdateRowModifiers();"is added to the method after "currentRow = null", the function
will be more complete, meanwhile, it won't affect the efficiency of derby and cause other
problems.
Thank you again!

Sincerely, yiqing


Mime
View raw message