"is a call to pdostatement::closecursor() necessary if the statement object is unset anway?" Code Answer

5

pdo_mysql_stmt_dtor() runs the same cleanup operations as pdo_mysql_stmt_cursor_closer(), so as long as the statement object is either explicitly unset or goes out of scope, the operations will always be performed.

it is therefore not strictly necessary to call closecursor() if the statement is about to be destroyed anyway. personally i would do it anyway as i like to be explicit for readability, but that comes down to personal stylistic preferences.

based on the references above, this can only be said for certain about pdo_mysql - for other drivers this may not hold true.

By Lance McNearney on October 16 2022

Answers related to “is a call to pdostatement::closecursor() necessary if the statement object is unset anway?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.