File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
system/database/drivers/pdo Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change 26
26
*/
27
27
class CI_DB_pdo_result extends CI_DB_result {
28
28
29
+ public $ num_rows ;
30
+
29
31
/**
30
32
* Number of rows in the result set
31
33
*
32
- * @access public
33
- * @return integer
34
+ * @return int
34
35
*/
35
- function num_rows ()
36
+ public function num_rows ()
36
37
{
37
- if (is_numeric ( stripos ( $ this ->result_id -> queryString , ' SELECT ' ) ))
38
+ if (is_int ( $ this ->num_rows ))
38
39
{
39
- $ dbh = $ this ->conn_id ;
40
- $ query = $ dbh ->query ($ this ->result_id ->queryString );
41
- $ result = $ query ->fetchAll ();
42
- unset($ dbh , $ query );
43
- return count ($ result );
40
+ return $ this ->num_rows ;
44
41
}
45
- else
42
+ elseif (( $ this -> num_rows = $ this -> result_id -> rowCount ()) > 0 )
46
43
{
47
- return $ this ->result_id -> rowCount ();
44
+ return $ this ->num_rows ;
48
45
}
46
+
47
+ $ this ->num_rows = count ($ this ->result_id ->fetchAll ());
48
+ $ this ->result_id ->execute ();
49
+ return $ this ->num_rows ;
49
50
}
50
51
51
52
// --------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments