Hi
APC doesn't like it when I store the output of a SELECT:
===
include("apc.php");
$dbh = new PDO("sqlite:./test.sqlite");
$sql = "CREATE TABLE IF NOT EXISTS mytable (name TEXT)";
$dbh->exec($sql);
$sql = "INSERT INTO mytable VALUES (?)";
$insert = $dbh->prepare($sql);
$insert->execute(array("dead"));
$sql = "INSERT INTO mytable VALUES (?)";
$insert = $dbh->prepare($sql);
$insert->execute(array("beef"));
$sql = "SELECT * FROM mytable";
store("rows",$dbh->query($sql));
$rows = fetch("rows");
foreach($rows as $row) {
print $row['name'] . "<p>";
}
$dbh = null;
===
PHP Fatal error: Uncaught exception 'PDOException' with message 'You
cannot serialize or unserialize PDOStatement instances' in
/usr/local/www/apache22/data/apc.php:9\nStack trace:\n#0 [internal
function]: PDOStatement->__sleep()\n#1
/usr/local/www/apache22/data/apc.php(9): apc_store('rows',
Object(PDOStatement), 0)\n#2
/usr/local/www/apache22/data/test.php(21): store('rows',
Object(PDOStatement))\n#3 {main}\n thrown in
/usr/local/www/apache22/data/apc.php on line 9
===
Does it mean that PDO won't work with APC, and I should look at
another caching tool?
Thank you.