diff --git a/classes/db_pdo.php b/classes/db_pdo.php index ef66996..85da6c7 100644 --- a/classes/db_pdo.php +++ b/classes/db_pdo.php @@ -359,6 +359,20 @@ abstract class DB_PDO extends PDO { return ($filtered_index) ? db_filter($all, 0) : $all; } + + // -------------------------------------------------------------------------- + + /** + * Return the number of rows returned for a SELECT query + * + * @return int + */ + public function num_rows() + { + return isset($this->statement) && is_object($this->statement) + ? $this->statement->rowCount() + : FALSE; + } // ------------------------------------------------------------------------- // ! Abstract public functions to implement in child classes @@ -373,13 +387,6 @@ abstract class DB_PDO extends PDO { */ abstract public function truncate($table); - /** - * Return the number of rows for the last SELECT query - * - * @return int - */ - abstract public function num_rows(); - /** * Connect to a different database * diff --git a/docs/classes/DB_PDO.html b/docs/classes/DB_PDO.html index 736631a..23dfdd0 100644 --- a/docs/classes/DB_PDO.html +++ b/docs/classes/DB_PDO.html @@ -96,7 +96,7 @@ the connection/database
get_system_tables()
inTransaction()
  • lastInsertId()
    lastInsertId()
  • -
  • Return the number of rows for the last SELECT query
    num_rows()
  • +
  • Return the number of rows returned for a SELECT query
    num_rows()
  • prepare()
    prepare()
  • Create and execute a prepared statement with the provided parameters
    prepare_execute()
  • @@ -456,7 +456,7 @@ the connection/database
    -

    Return the number of rows for the last SELECT query

    +

    Return the number of rows returned for a SELECT query

    num_rows() : int
    @@ -662,7 +662,7 @@ the connection/database
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/DB_Reg.html b/docs/classes/DB_Reg.html index de7f90b..6b77ce0 100644 --- a/docs/classes/DB_Reg.html +++ b/docs/classes/DB_Reg.html @@ -151,7 +151,7 @@ and organizes database connections

    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/DB_SQL.html b/docs/classes/DB_SQL.html index 16d29f1..5be1053 100644 --- a/docs/classes/DB_SQL.html +++ b/docs/classes/DB_SQL.html @@ -268,7 +268,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/DB_Util.html b/docs/classes/DB_Util.html index cf8846e..067005b 100644 --- a/docs/classes/DB_Util.html +++ b/docs/classes/DB_Util.html @@ -208,7 +208,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/Firebird.html b/docs/classes/Firebird.html index 88eb42d..55a6b6f 100644 --- a/docs/classes/Firebird.html +++ b/docs/classes/Firebird.html @@ -92,7 +92,7 @@ the connection/database
    get_system_tables()
    inTransaction()
  • lastInsertId()
    lastInsertId()
  • -
  • Return the number of rows returned for a SELECT query
    num_rows()
  • +
  • Return the number of rows returned for a SELECT query
    num_rows()
  • Emulate PDO prepare
    prepare()
  • Prepare and execute a query
    prepare_execute()
  • Bind a prepared query with arguments for executing
    prepare_query()
  • @@ -533,9 +533,13 @@ the connection/database

    Return the number of rows returned for a SELECT query

    num_rows() : int
    -
    +
    Inherited

    + + + +
    inherited_from\DB_PDO::num_rows()

    Returns

    int
    @@ -766,7 +770,7 @@ the connection/database
     

    Reference to the connection resource

    -
    $conn 
    +
    $conn : resource

    @@ -784,20 +788,20 @@ the connection/database  

    Reference to the last query executed

    -
    $statement 
    +
    $statement : object

       

    Reference to the current transaction

    -
    $trans 
    +
    $trans : resource

    @@ -808,7 +812,7 @@ the last query executed
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/Firebird_Result.html b/docs/classes/Firebird_Result.html index ad10294..923e48b 100644 --- a/docs/classes/Firebird_Result.html +++ b/docs/classes/Firebird_Result.html @@ -85,7 +85,6 @@ the query
    __construct()
    getColumnMeta()
  • nextRowset()
    nextRowset()
  • -
  • Return the number of rows for the select query
    num_rows()
  • Return the number of rows affected by the previous query
    rowCount()
  • setAttribute()
    setAttribute()
  • @@ -94,6 +93,8 @@ the query
    __construct()
    +
  • Data pulled from query
    $result
  • +
  • Current row in result array
    $row
  • Reference to fbird resource
    $statement
  • @@ -377,7 +378,7 @@ the query

    Emulate PDOStatement::fetchObject, but only for the default use

    -
    fetchObject(string $class_name, array $ctor_args) : mixed
    +
    fetchObject(string $class_name, array $ctor_args) : \stdClass

    @@ -391,7 +392,7 @@ the query array

    Returns

    -
    mixed
    +
    @@ -433,16 +434,6 @@ the query
    -
    -

    Return the number of rows for the select query

    -
    num_rows() : int
    -
    -
    -

    -

    Returns

    -
    int
    -
    -

    Return the number of rows affected by the previous query

    rowCount() : int
    @@ -481,9 +472,27 @@ the query

     Properties

    + 
    +

    Data pulled from query

    +
    $result 
    +
    +
    +

    + + + +
    param<p>mixed</p>
    +
    +
    + 
    +

    Current row in result array

    +
    $row : int
    +
    +

    +
     

    Reference to fbird resource

    -
    $statement 
    +
    $statement : resource

    @@ -494,7 +503,7 @@ the query
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/Firebird_SQL.html b/docs/classes/Firebird_SQL.html index e6f35ce..525e8b7 100644 --- a/docs/classes/Firebird_SQL.html +++ b/docs/classes/Firebird_SQL.html @@ -296,7 +296,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/Firebird_Util.html b/docs/classes/Firebird_Util.html index d524ac1..3b19fe7 100644 --- a/docs/classes/Firebird_Util.html +++ b/docs/classes/Firebird_Util.html @@ -211,7 +211,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/MySQL.html b/docs/classes/MySQL.html index 0a93d52..ab4e967 100644 --- a/docs/classes/MySQL.html +++ b/docs/classes/MySQL.html @@ -96,7 +96,7 @@ the connection/database
    get_system_tables()
    inTransaction()
  • lastInsertId()
    lastInsertId()
  • -
  • Return the number of rows returned for a SELECT query
    num_rows()
  • +
  • Return the number of rows returned for a SELECT query
    num_rows()
  • prepare()
    prepare()
  • Create and execute a prepared statement with the provided parameters
    prepare_execute()
  • @@ -576,9 +576,13 @@ the connection/database

    Return the number of rows returned for a SELECT query

    num_rows() : int
    -
    +
    Inherited

    + + + +
    inherited_from\DB_PDO::num_rows()

    Returns

    int
    @@ -844,7 +848,7 @@ the connection/database
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/MySQL_SQL.html b/docs/classes/MySQL_SQL.html index 9bf55e0..9751588 100644 --- a/docs/classes/MySQL_SQL.html +++ b/docs/classes/MySQL_SQL.html @@ -280,7 +280,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/MySQL_Util.html b/docs/classes/MySQL_Util.html index f4b2b89..d0db5c1 100644 --- a/docs/classes/MySQL_Util.html +++ b/docs/classes/MySQL_Util.html @@ -207,7 +207,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/ODBC.html b/docs/classes/ODBC.html index c91eabf..4a83a03 100644 --- a/docs/classes/ODBC.html +++ b/docs/classes/ODBC.html @@ -96,7 +96,7 @@ the connection/database
    get_system_tables()
    inTransaction()
  • lastInsertId()
    lastInsertId()
  • -
  • Return the number of rows returned for a SELECT query
    num_rows()
  • +
  • Return the number of rows returned for a SELECT query
    num_rows()
  • prepare()
    prepare()
  • Create and execute a prepared statement with the provided parameters
    prepare_execute()
  • @@ -576,9 +576,13 @@ the connection/database

    Return the number of rows returned for a SELECT query

    num_rows() : int
    -
    +
    Inherited

    + + + +
    inherited_from\DB_PDO::num_rows()

    Returns

    int
    @@ -846,7 +850,7 @@ the connection/database
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/ODBC_SQL.html b/docs/classes/ODBC_SQL.html index 55b6532..6d274f6 100644 --- a/docs/classes/ODBC_SQL.html +++ b/docs/classes/ODBC_SQL.html @@ -280,7 +280,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/ODBC_Util.html b/docs/classes/ODBC_Util.html index d96e5f8..bff92d2 100644 --- a/docs/classes/ODBC_Util.html +++ b/docs/classes/ODBC_Util.html @@ -202,7 +202,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/PgSQL.html b/docs/classes/PgSQL.html index fd4a196..e25415f 100644 --- a/docs/classes/PgSQL.html +++ b/docs/classes/PgSQL.html @@ -96,7 +96,7 @@ the connection/database
    get_system_tables()
    inTransaction()
  • lastInsertId()
    lastInsertId()
  • -
  • Return the number of rows returned for a SELECT query
    num_rows()
  • +
  • Return the number of rows returned for a SELECT query
    num_rows()
  • prepare()
    prepare()
  • Create and execute a prepared statement with the provided parameters
    prepare_execute()
  • @@ -572,9 +572,13 @@ the connection/database

    Return the number of rows returned for a SELECT query

    num_rows() : int
    -
    +
    Inherited

    + + + +
    inherited_from\DB_PDO::num_rows()

    Returns

    int
    @@ -846,7 +850,7 @@ the connection/database
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/PgSQL_SQL.html b/docs/classes/PgSQL_SQL.html index 2e8ef52..b2648a0 100644 --- a/docs/classes/PgSQL_SQL.html +++ b/docs/classes/PgSQL_SQL.html @@ -296,7 +296,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/PgSQL_Util.html b/docs/classes/PgSQL_Util.html index 67de6f9..ecba724 100644 --- a/docs/classes/PgSQL_Util.html +++ b/docs/classes/PgSQL_Util.html @@ -207,7 +207,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/Query_Builder.html b/docs/classes/Query_Builder.html index d9e6d51..2943d59 100644 --- a/docs/classes/Query_Builder.html +++ b/docs/classes/Query_Builder.html @@ -1086,7 +1086,7 @@ for complex select queries
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/SQLite.html b/docs/classes/SQLite.html index a048f12..a413eff 100644 --- a/docs/classes/SQLite.html +++ b/docs/classes/SQLite.html @@ -95,7 +95,7 @@ method if the database does not support 'TRUNCATE';
    empty_table()lastInsertId()
             
    lastInsertId()
  • Load a database for the current connection
    load_database()
  • -
  • Return the number of rows returned for a SELECT query
    num_rows()
  • +
  • Return the number of rows returned for a SELECT query
    num_rows()
  • prepare()
    prepare()
  • Create and execute a prepared statement with the provided parameters
    prepare_execute()
  • @@ -580,9 +580,13 @@ method if the database does not support 'TRUNCATE';

    Return the number of rows returned for a SELECT query

    num_rows() : int
    -
    +
    Inherited

    + + + +
    inherited_from\DB_PDO::num_rows()

    Returns

    int
    @@ -861,7 +865,7 @@ method if the database does not support 'TRUNCATE';
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/SQLite_SQL.html b/docs/classes/SQLite_SQL.html index 36af013..da98d05 100644 --- a/docs/classes/SQLite_SQL.html +++ b/docs/classes/SQLite_SQL.html @@ -280,7 +280,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/SQLite_Util.html b/docs/classes/SQLite_Util.html index 545abe8..485392a 100644 --- a/docs/classes/SQLite_Util.html +++ b/docs/classes/SQLite_Util.html @@ -207,7 +207,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/classes/Settings.html b/docs/classes/Settings.html index 515884d..db920a6 100644 --- a/docs/classes/Settings.html +++ b/docs/classes/Settings.html @@ -243,7 +243,7 @@ directly - the settings should be safe!
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/deprecated.html b/docs/deprecated.html index 94810d3..59e3469 100644 --- a/docs/deprecated.html +++ b/docs/deprecated.html @@ -66,7 +66,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/errors.html b/docs/errors.html index c365598..449246f 100644 --- a/docs/errors.html +++ b/docs/errors.html @@ -92,7 +92,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/graph_class.html b/docs/graph_class.html index 12f6398..2f9b96f 100644 --- a/docs/graph_class.html +++ b/docs/graph_class.html @@ -63,7 +63,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/markers.html b/docs/markers.html index 05ea13e..2499abb 100644 --- a/docs/markers.html +++ b/docs/markers.html @@ -68,7 +68,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/namespaces/default.html b/docs/namespaces/default.html index e7b951e..b7fe931 100644 --- a/docs/namespaces/default.html +++ b/docs/namespaces/default.html @@ -282,7 +282,7 @@ instantiates the specific db driver

    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/packages/.html b/docs/packages/.html index af8a4ed..caa2544 100644 --- a/docs/packages/.html +++ b/docs/packages/.html @@ -66,7 +66,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/packages/Default.html b/docs/packages/Default.html index 315b082..2c64cf8 100644 --- a/docs/packages/Default.html +++ b/docs/packages/Default.html @@ -93,7 +93,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/packages/Query.Drivers.html b/docs/packages/Query.Drivers.html index 4480de3..23443d2 100644 --- a/docs/packages/Query.Drivers.html +++ b/docs/packages/Query.Drivers.html @@ -210,7 +210,7 @@ data-fetching methods

    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/packages/Query.Helper Classes.html b/docs/packages/Query.Helper Classes.html index b6462cd..4c1b5a9 100644 --- a/docs/packages/Query.Helper Classes.html +++ b/docs/packages/Query.Helper Classes.html @@ -96,7 +96,7 @@
    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/packages/Query.Query.html b/docs/packages/Query.Query.html index beb1499..bcbedb4 100644 --- a/docs/packages/Query.Query.html +++ b/docs/packages/Query.Query.html @@ -114,7 +114,7 @@ instantiates the specific db driver

    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/packages/Query.html b/docs/packages/Query.html index 4390153..92998cf 100644 --- a/docs/packages/Query.html +++ b/docs/packages/Query.html @@ -315,7 +315,7 @@ instantiates the specific db driver

    + generated on 2012-04-20T16:33:01-04:00.
    diff --git a/docs/structure.xml b/docs/structure.xml index 8c7b280..8470f51 100644 --- a/docs/structure.xml +++ b/docs/structure.xml @@ -510,7 +510,7 @@ directly - the settings should be safe!]]> - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -871,50 +871,50 @@ the connection/database]]> - + + num_rows + function + + + + + int + + + + truncate function - + - + string - + void - + $table - - num_rows - function - - - - - int - - - - + switch_db function - + - + string - + void - + $name @@ -2616,7 +2616,7 @@ with array_map and glob]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -2709,23 +2709,12 @@ with array_map and glob]]> - num_rows - function - - - - - int - - - - get_schemas function - + - + array @@ -3013,7 +3002,7 @@ with array_map and glob]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -3119,17 +3108,6 @@ with array_map and glob]]> - - num_rows - function - - - - - int - - -
    @@ -3265,7 +3243,7 @@ with array_map and glob]]> - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -3368,17 +3346,6 @@ with array_map and glob]]> - - num_rows - function - - - - - int - - -
    @@ -3670,7 +3637,7 @@ with array_map and glob]]> - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -3824,17 +3791,6 @@ with array_map and glob]]> - - num_rows - function - - - - - int - - -
    @@ -4168,7 +4124,7 @@ with array_map and glob]]> - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -4189,350 +4145,362 @@ data-fetching methods]]>
    - + $statement - - - - __construct - function - - - - + resource - + + + $row + + + + + + int + + + + + $result + + + + + + + + + __construct + function + + + + + resource + + + $link - + bindColumn function - + - + mixed - + mixed - + int - + mixed - + array - + FALSE - + $column - + $param - + $type - + $maxlen - + $driverdata - + bindParam function - + - + mixed - + mixed - + int - + mixed - + array - + FALSE - + $parameter - + $variable - + $data_type - + $maxlen - + $driverdata - + bindValue function - + - + mixed - + mixed - + int - + FALSE - + $parameter - + $variable - + $data_type - + execute function - + - + array - + bool - + $args - + fetch function - + - + int - + mixed - + mixed - + mixed - + $fetch_style - + $statement - + $offset - + fetchAll function - + - + int - + mixed - + mixed - + mixed - + $fetch_style - + $statement - + $ctor_args - + fetchColumn function - + - + int - + mixed - + $column_num - + fetchObject function - + - + string - + array - - mixed + + \stdClass - + $class_name - + $ctor_args - + rowCount function - + - + int - - num_rows - function - - - - - int - - - - + errorCode function - + errorCode]]> - + string - + errorInfo function - + errorInfo / PDOStatement->errorInfo]]> - + array
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -4552,163 +4520,164 @@ the query]]>
    - + $statement + + object + - + $statement_link - + + + resource + - + $trans - + + + resource + - + $conn - + + + resource + - + __construct function - + - + string - + string - + string - + $dbpath - + $user - + $pass - + switch_db function - + - + string - + FALSE - + $name - + truncate function - + - + string - + $table - + query function - + - + string - + \$this - + $sql - + prepare function - + - + string - + array - + \$this - + $query - + $options - - num_rows - function - - - - - int - - - beginTransaction function diff --git a/drivers/firebird/firebird_driver.php b/drivers/firebird/firebird_driver.php index 4b79eb5..5a7c359 100644 --- a/drivers/firebird/firebird_driver.php +++ b/drivers/firebird/firebird_driver.php @@ -25,22 +25,30 @@ class Firebird extends DB_PDO { /** * Reference to the last query executed + * + * @var object */ protected $statement; /** * Reference to the resource returned by * the last query executed + * + * @var resource */ protected $statement_link; /** * Reference to the current transaction + * + * @var resource */ protected $trans; /** * Reference to the connection resource + * + * @var resource */ protected $conn; @@ -122,8 +130,10 @@ class Firebird extends DB_PDO { { throw new PDOException(fbird_errmsg()); } + + $this->statement = new FireBird_Result($this->statement_link); - return new FireBird_Result($this->statement_link); + return $this->statement; } // -------------------------------------------------------------------------- @@ -145,19 +155,9 @@ class Firebird extends DB_PDO { throw new PDOException(fbird_errmsg()); } - return new FireBird_Result($this->statement_link); - } + $this->statement = new FireBird_Result($this->statement_link); - // -------------------------------------------------------------------------- - - /** - * Return the number of rows returned for a SELECT query - * - * @return int - */ - public function num_rows() - { - return $this->statement->num_rows(); + return $this->statement; } // -------------------------------------------------------------------------- @@ -215,7 +215,7 @@ class Firebird extends DB_PDO { $query = $this->prepare($sql); // Set the statement in the class variable for easy later access - $this->statement =& $query; + $this->statement_link =& $query; return $query->execute($args); } diff --git a/drivers/firebird/firebird_result.php b/drivers/firebird/firebird_result.php index 4935483..a333b2f 100644 --- a/drivers/firebird/firebird_result.php +++ b/drivers/firebird/firebird_result.php @@ -24,8 +24,24 @@ class Firebird_Result extends PDOStatement { /** * Reference to fbird resource + * + * @var resource */ private $statement; + + /** + * Current row in result array + * + * @var int + */ + private $row; + + /** + * Data pulled from query + * + * @param mixed + */ + private $result = array(); /** * Create the object by passing the resource for @@ -37,6 +53,19 @@ class Firebird_Result extends PDOStatement { { $this->statement = $link; $this->setFetchMode(PDO::FETCH_ASSOC); + $this->row = -1; + $this->result = array(); + + // Create the result array, so that we can get row counts + // Check the resource type, because prepared statements are "interbase query" + // but we only want "interbase result" types when attempting to fetch data + if (is_resource($link) && get_resource_type($link) === "interbase result") + { + while($row = ibase_fetch_assoc($link, IBASE_FETCH_BLOBS)) + { + $this->result[] = $row; + } + } } // -------------------------------------------------------------------------- @@ -125,21 +154,38 @@ class Firebird_Result extends PDOStatement { { $this->statement = $statement; } - + + // If there is no result, continue + if (empty($this->result)) + { + return FALSE; + } + + // Keep track of the current row being fetched + ++$this->row; + + // Return false if the next row doesn't exist + if ( ! isset($this->result[$this->row])) + { + return FALSE; + } + switch($fetch_style) { case PDO::FETCH_OBJ: - return fbird_fetch_object($this->statement, IBASE_FETCH_BLOBS); + $row = (object) $this->result[$this->row]; break; case PDO::FETCH_NUM: - return fbird_fetch_row($this->statement, IBASE_FETCH_BLOBS); + $row = array_values($this->result[$this->row]); break; default: - return fbird_fetch_assoc($this->statement, IBASE_FETCH_BLOBS); + $row = $this->result[$this->row]; break; } + + return $row; } // -------------------------------------------------------------------------- @@ -187,7 +233,7 @@ class Firebird_Result extends PDOStatement { * * @param string $class_name * @param array $ctor_args - * @return mixed + * @return stdClass */ public function fetchObject($class_name='stdClass', $ctor_args=array()) { @@ -203,19 +249,15 @@ class Firebird_Result extends PDOStatement { */ public function rowCount() { - return fbird_affected_rows(); - } - - // -------------------------------------------------------------------------- - - /** - * Return the number of rows for the select query - * - * @return int - */ - public function num_rows() - { - return count($this->fetchAll()); + $rows = fbird_affected_rows(); + + // Get the number of rows for the select query if you can + if ($rows === FALSE && is_resource($link) && get_resource_type($link) === "interbase result") + { + $rows = count($this->result); + } + + return $rows; } // -------------------------------------------------------------------------- diff --git a/drivers/mysql/mysql_driver.php b/drivers/mysql/mysql_driver.php index efa8d6d..9a26fb9 100644 --- a/drivers/mysql/mysql_driver.php +++ b/drivers/mysql/mysql_driver.php @@ -69,17 +69,5 @@ class MySQL extends DB_PDO { { $this->query("TRUNCATE `{$table}`"); } - - // -------------------------------------------------------------------------- - - /** - * Return the number of rows returned for a SELECT query - * - * @return int - */ - public function num_rows() - { - return isset($this->statement) ? $this->statement->rowCount() : FALSE; - } } //End of mysql_driver.php \ No newline at end of file diff --git a/drivers/odbc/odbc_driver.php b/drivers/odbc/odbc_driver.php index ca7951c..f64ec7c 100644 --- a/drivers/odbc/odbc_driver.php +++ b/drivers/odbc/odbc_driver.php @@ -67,17 +67,5 @@ class ODBC extends DB_PDO { $sql = "DELETE FROM {$table}"; $this->query($sql); } - - // -------------------------------------------------------------------------- - - /** - * Return the number of rows returned for a SELECT query - * - * @return int - */ - public function num_rows() - { - // @TODO: Implement - } } // End of odbc_driver.php \ No newline at end of file diff --git a/drivers/pgsql/pgsql_driver.php b/drivers/pgsql/pgsql_driver.php index 7a009be..f7d975f 100644 --- a/drivers/pgsql/pgsql_driver.php +++ b/drivers/pgsql/pgsql_driver.php @@ -62,18 +62,6 @@ class PgSQL extends DB_PDO { // -------------------------------------------------------------------------- - /** - * Return the number of rows returned for a SELECT query - * - * @return int - */ - public function num_rows() - { - return (isset($this->statement)) ? $this->statement->rowCount() : FALSE; - } - - // -------------------------------------------------------------------------- - /** * Get a list of schemas for the current connection * diff --git a/drivers/sqlite/sqlite_driver.php b/drivers/sqlite/sqlite_driver.php index 8eb8556..719515a 100644 --- a/drivers/sqlite/sqlite_driver.php +++ b/drivers/sqlite/sqlite_driver.php @@ -135,17 +135,5 @@ SQL; $this->statement->execute(); } - - // -------------------------------------------------------------------------- - - /** - * Return the number of rows returned for a SELECT query - * - * @return int - */ - public function num_rows() - { - return (isset($this->statement)) ? $this->statement->rowCount() : FALSE; - } } //End of sqlite_driver.php \ No newline at end of file diff --git a/tests/core/db_qb_test.php b/tests/core/db_qb_test.php index a7ace5d..f7f1940 100644 --- a/tests/core/db_qb_test.php +++ b/tests/core/db_qb_test.php @@ -358,6 +358,13 @@ abstract class QBTest extends UnitTestCase { $this->assertTrue(is_numeric($query)); } + function TestNumRows() + { + $query = $this->db->get('create_test'); + + $this->assertTrue(is_numeric($this->db->num_rows())); + } + } // End of db_qb_test.php \ No newline at end of file diff --git a/tests/databases/firebird/firebird-qb.php b/tests/databases/firebird/firebird-qb.php index 99f2821..21225bc 100644 --- a/tests/databases/firebird/firebird-qb.php +++ b/tests/databases/firebird/firebird-qb.php @@ -34,5 +34,7 @@ class FirebirdQBTest extends QBTest { $this->db = new Query_Builder($params); // echo '
    Firebird Queries
    '; - } + } + + } \ No newline at end of file diff --git a/tests/db_files/FB_TEST_DB.FDB b/tests/db_files/FB_TEST_DB.FDB index 4191b49..fad34f9 100644 Binary files a/tests/db_files/FB_TEST_DB.FDB and b/tests/db_files/FB_TEST_DB.FDB differ