The answer is no, so long as you’re not preparing to execute the statement again. I figured this out by looking at the code for PDOStatement::closeCursor and the MySQL implementation. Seems to me that all the freeing necessary is done in the destructor so if you’re not planning to use the statement again it seems to me that you can safely omit the call to PDOStatement::closeCursor(). On the other hand if you are going to reuse the statement calling closeCursor seems like it’s a pretty important thing to do. It would be nice if PDOStatement::fetchAll() called closeCursor() for us, but I don’t think it does.
Tag Archives: pdostatement
The PHP PDOStatement class
Reply
Learning about the functions available in The PDOStatement class. The API seems to have changed when I compare the sample code in this article to the API reference. In any event I was able to figure out how to do what I wanted to do!