is cursor automatically closed with sqlquery_retrieveAsArray
Posted: Fri Oct 11, 2013 2:32 pm
[This post is an archive from the old SQL Yoga forums]
I notice that in a sqlyoga query object, there is a "cursor id" in the query object array. Should I be calling "sqlquery_close" on that cursor id?
The API says that this call "Closes an open database cursor associated with a SQL Query Object." Although it seems to imply that only sqlquery_retrieve returns an open cursor.
Calling sqlquery_get(tQueryA, "cursor id") also returns a number greater than zero. I'm using sqlyoga version 1.0.2 build 5, and I understand from some of the earlier release notes, that using sqlquery_get to get a cursor id will return zero if the cursor does not exist. Perhaps I have misunderstood that. But I think that one needs to know if there are open cursors, otherwise one is likely to incur memory leakage (or worse).
Whilst the cursor id in the query object is a number greater than 0 (or non-empty) that suggests the cursor is still open. If I try to call "sqlquery_close" on Valentina (passing the query object), then LiveCode crashes (and the LC log reports that it was dealing with a Valentina Cursor Destructor action immediately before the crash.) If I try and use the cursor id with the Valentina API (e.g. to ask the cursor for one of its properties) that also causes a crash.
I'm guessing that sql yoga is automatically closing the cursor, and whilst the query object is returning the handle for a Valentina cursor, that cursor no longer exists.
I notice that in a sqlyoga query object, there is a "cursor id" in the query object array. Should I be calling "sqlquery_close" on that cursor id?
The API says that this call "Closes an open database cursor associated with a SQL Query Object." Although it seems to imply that only sqlquery_retrieve returns an open cursor.
Calling sqlquery_get(tQueryA, "cursor id") also returns a number greater than zero. I'm using sqlyoga version 1.0.2 build 5, and I understand from some of the earlier release notes, that using sqlquery_get to get a cursor id will return zero if the cursor does not exist. Perhaps I have misunderstood that. But I think that one needs to know if there are open cursors, otherwise one is likely to incur memory leakage (or worse).
Whilst the cursor id in the query object is a number greater than 0 (or non-empty) that suggests the cursor is still open. If I try to call "sqlquery_close" on Valentina (passing the query object), then LiveCode crashes (and the LC log reports that it was dealing with a Valentina Cursor Destructor action immediately before the crash.) If I try and use the cursor id with the Valentina API (e.g. to ask the cursor for one of its properties) that also causes a crash.
I'm guessing that sql yoga is automatically closing the cursor, and whilst the query object is returning the handle for a Valentina cursor, that cursor no longer exists.