You can call the mysql_stmt_attr_set() function in the C API on a server to implement the cursor feature.
A server cursor can generate a result set on the server. Only the rows requested by the client are transferred to the client. For example, if the client executes a query to obtain the first row, other rows will not be transferred to the client.
Limitations:
Cursors are read-only. You cannot use cursors to update rows. Therefore,
UPDATE WHERE CURRENT OFandDELETE WHERE CURRENT OFare not supported.Cursors cannot be maintained. In other words, a cursor cannot maintain in the opened state after it is committed.
Cursors are insensitive.
Cursors are non-scrollable.
Cursors cannot be named. You can use a statement handle to obtain the cursor ID.
Each prepared statement can open only one cursor. The number of cursors is the same as the number of prepared statements.
If the prepared mode does not support a statement that generates a result set, you cannot use a cursor in this statement. Such statements include
CHECK TABLE,HANDLER READ, andSHOW BINLOG EVENTS.