Attempt to open a materialized cursor.
- Parameters
-
| thd | thread handle |
[in] | result | result class of the caller used as a destination for the rows fetched from the cursor |
[in,out] | pcursor | a pointer to store a pointer to cursor in. The cursor is usually created on first call. Notice that a cursor may be returned even though execution causes an error. Cursor is open when execution is successful, closed otherwise. |
- Returns
- Error status
-
false on success, true on error
- Note
- Only used for cursors created by stored procedures. Cursors created for prepared statements are handled by simpler interfaces (new_cursor_result(), Materialized_cursor::open(), etc). On first invocation, mysql_open_cursor creates a query result object for management of the materialized result. When this cursor is prepared, it creates a materialized cursor object (Materialized_cursor) inside the cursor. In addition, an application specific result object supplied as argument is attached to the query result object. The query result object is also attached to the current prepared statement. A reference to the cursor object is returned in pcursor. The statement may or may not be prepared on first invocation, it is prepared if necessary.
On subsequent invocations, the query result object is located inside the preparable statement and the cursor object is located inside this. A reference to the cursor object is returned in pcursor.
On all invocations, the statement is executed and a temporary table managed by the cursor object is populated with the result set.