1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67:
<?php
class PDOInjectQueryResult extends AbstractQueryResult implements InjectQueryResult
{
private $statement = null;
private $affected_rows = 0;
private $last_inserted_id = 0;
private $is_disposed = false;
public function __construct($query, $parameters, PDOStatement $statement, PDO $pdo)
{
$this->last_inserted_id = $pdo->lastInsertId();
$this->statement = $statement;
parent::__construct($query, $parameters);
}
public function __destruct()
{
$this->dispose();
}
public function get_last_inserted_id()
{
return $this->last_inserted_id;
}
public function get_affected_rows()
{
return $this->statement->rowCount();
}
public function dispose()
{
if (!$this->is_disposed)
{
$this->statement->closeCursor();
$this->is_disposed = true;
}
}
}
?>