On the server side, you can use the mysql_stmt_attr_set() function from the C API to enable cursor functionality, but there are some limitations.
Server-side cursors allow the result set to be generated on the server, but only the rows requested by the client are sent to the client. For example, if the client query only requests the first row of data, the remaining rows will not be transmitted.
In addition, cursors have the following limitations:
Cursors are read-only and cannot be used to update rows. Therefore,
UPDATE WHERE CURRENT OFandDELETE WHERE CURRENT OFare not supported.Cursors are non-holdable, meaning they do not remain open after a commit.
Cursors are insensitive.
Cursors are non-scrollable.
Cursors cannot be named. Use the statement handle to obtain the cursor ID.
Each prepared statement can only open one cursor. The number of cursors matches the number of prepared statements.
If a statement does not support generating a result set in prepared mode, you cannot use a cursor for that statement. This includes statements such as
CHECK TABLE,HANDLER READ, andSHOW BINLOG EVENTS.