On 24-7-2014 18:49, Dimitry Sibiryakov wrote:
> 24.07.2014 18:39, Mark Rotteveel wrote:
>> A cursor name should remain set for the lifetime of the statement,
>> unless it is explicitly set to a different value.
>
>     Ok. If there is two statements: one with cursor name and other using 
> WHERE CURRENT OF,
> what should happen is the first statement is closed, unprepared and then 
> prepared with
> different SQL text - completely different select from different table?

Looking at the SQL CLI standard Prepare it describes these actions to 
happen on prepare:

10) The following objects associated with S are destroyed:
a) Any prepared statement.
b) Any cursor.
c) Any select source.
d) Any executed statement.
**If a cursor associated with S is destroyed, then so are any prepared 
statements that reference that cursor.**
11) P is prepared and the prepared statement is associated with S.
12) If P is a <dynamic select statement> or a <dynamic single row select 
statement>, then:
a) P becomes the select source associated with S.
b) If there is no cursor name associated with S, then a unique 
implementation-dependent name that has the prefix 'SQLCUR' or the prefix 
'SQL_CUR' becomes the cursor name associated with S.

So according to the SQL CLI standard preparing a statement on a 
statement handle associated with a cursor name should destroy (and 
therefor unprepare) any other statements that reference that cursor name.

Mark
-- 
Mark Rotteveel

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to