Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pdo free result

Tags:

there is a mysql function in php called mysql_free_result(); I couln't find any similar function for PDO.

is there a pdo function to free the result of a database fetch or does the result set automatically get requested and freed when I call $stmt->fetch() data?

could someone explain me this difference between native mysql and pdo?

like image 584
Timo Huovinen Avatar asked May 21 '11 20:05

Timo Huovinen


People also ask

What is mysql free result?

The mysqli_free_result() function frees the memory associated with the result.

What is close cursor PHP?

The PHP documentation on closeCursor() says that it. frees up the connection to the server so that other SQL statements may be issued, but leaves the statement in a state that enables it to be executed again.

Is PDO Quote safe?

Basically quote() is safe as prepared statements but it depends on the proper implementation of quote() and of course also on it's consequent usage. Additionally the implementation of the used database system/PDO driver has to be taken into account in order to answer the question.

What is PDO in Python?

PDO: Python Database Objects, is a collection of objects for use with Phase or with the Python Programing Language. PDO is designed to be robust and simple at the same time, allowing access to multiple styles of databases, with one set of instructions.


2 Answers

closest method is close cursor for PDO statements.

http://us.php.net/manual/en/pdostatement.closecursor.php

$stmt = $dbh->prepare('SELECT foo FROM bar'); $stmt->closeCursor(); 
like image 123
dqhendricks Avatar answered Oct 21 '22 20:10

dqhendricks


You can set the object variable to null. The GC will destroy the PDO Statement instance, I guess.

like image 25
Stijn Leenknegt Avatar answered Oct 21 '22 19:10

Stijn Leenknegt