Skip to main content
Version: V1.0.0

Limitations on server-side cursors

You can call the mysql_stmt_attr_set() function in the C API on the server to implement cursor functionality, but it has certain limitations.

Server-side cursors allow you to generate result sets on the server, but only the rows requested by the client are transmitted to the client. For example, if a client executes a query that only needs the first row of data, the remaining rows will not be sent to the client.

Additionally, cursors have the following limitations:

  • Cursors are read-only and cannot be used to update rows. Therefore, UPDATE WHERE CURRENT OF and DELETE WHERE CURRENT OF are not supported.

  • Cursors are not held, meaning they do not remain open after a commit.

  • Cursors are insensitive.

  • Cursors are not scrollable.

  • Cursors cannot be named; you must use the statement handle to obtain the cursor ID.

  • Each prepared statement can open only one cursor. The number of cursors is equal to the number of prepared statements.

  • If a statement does not support generating a result set in prepared mode, you cannot use a cursor with that statement. This includes statements such as CHECK TABLE, HANDLER READ, and SHOW BINLOG EVENTS.