]>
jfr.im git - z_archive/KronOS.git/blob - video/system/database/drivers/pdo/pdo_result.php
1 <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
5 * An open source application development framework for PHP 5.1.6 or newer
8 * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
9 * @license http://codeigniter.com/user_guide/license.html
10 * @author EllisLab Dev Team
11 * @link http://codeigniter.com
12 * @since Version 2.1.2
16 // ------------------------------------------------------------------------
21 * This class extends the parent result class: CI_DB_result
24 * @author EllisLab Dev Team
25 * @link http://codeigniter.com/user_guide/database/
27 class CI_DB_pdo_result
extends CI_DB_result
{
32 * Number of rows in the result set
36 public function num_rows()
38 if (is_int($this->num_rows
))
40 return $this->num_rows
;
42 elseif (($this->num_rows
= $this->result_id
->rowCount()) > 0)
44 return $this->num_rows
;
47 $this->num_rows
= count($this->result_id
->fetchAll());
48 $this->result_id
->execute();
49 return $this->num_rows
;
52 // --------------------------------------------------------------------
55 * Number of fields in the result set
62 return $this->result_id
->columnCount();
65 // --------------------------------------------------------------------
70 * Generates an array of column names
75 function list_fields()
77 if ($this->db
->db_debug
)
79 return $this->db
->display_error('db_unsuported_feature');
84 // --------------------------------------------------------------------
89 * Generates an array of objects containing field meta-data
100 for($i = 0; $i < $this->num_fields(); $i++
)
102 $data[] = $this->result_id
->getColumnMeta($i);
109 if ($this->db
->db_debug
)
111 return $this->db
->display_error('db_unsuported_feature');
117 // --------------------------------------------------------------------
124 function free_result()
126 if (is_object($this->result_id
))
128 $this->result_id
= FALSE;
132 // --------------------------------------------------------------------
137 * Moves the internal pointer to the desired offset. We call
138 * this internally before fetching results to make sure the
139 * result set starts at zero
144 function _data_seek($n = 0)
149 // --------------------------------------------------------------------
152 * Result - associative array
154 * Returns the result set as an array
159 function _fetch_assoc()
161 return $this->result_id
->fetch(PDO
::FETCH_ASSOC
);
164 // --------------------------------------------------------------------
169 * Returns the result set as an object
174 function _fetch_object()
176 return $this->result_id
->fetchObject();
182 /* End of file pdo_result.php */
183 /* Location: ./system/database/drivers/pdo/pdo_result.php */