<?php
/**
 * A class for database statements.
 *
 * This class is a thin layer over pdo statement. It provides a few convenient
 * functions.
 */
class db_statement extends pdostatement implements countable
{
    ////////////////////////////////////////////////////////////////////////////
    // Construct and destruct functions.

    protected function __construct()
    {
        $this->setfetchmode(pdo::FETCH_ASSOC);
    }

    ////////////////////////////////////////////////////////////////////////////
    // Overload functions.

    /**
     * Function used by the countable interface.
     */
    public function count()
    {
        return $this->rowcount();
    }

    ////////////////////////////////////////////////////////////////////////////
    // Interface functions.
    
    /**
     * Gets the query result row count.
     *
     * @return integer The count.
     */
    public function get_count()
    {
        return $this->rowcount();
    }
    
    ////////////////////////////////////////////////////////////////////////////
    // Internal functions.
}
