/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk
20.1.1 by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff
1
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
/**
3
 * CodeIgniter
4
 *
5
 * An open source application development framework for PHP 5.1.6 or newer
6
 *
7
 * @package		CodeIgniter
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
13
 * @filesource
14
 */
15
16
// ------------------------------------------------------------------------
17
18
/**
19
 * PDO Result Class
20
 *
21
 * This class extends the parent result class: CI_DB_result
22
 *
23
 * @category	Database
24
 * @author		EllisLab Dev Team
25
 * @link		http://codeigniter.com/user_guide/database/
26
 */
27
class CI_DB_pdo_result extends CI_DB_result {
28
29
	public $num_rows;
30
31
	/**
32
	 * Number of rows in the result set
33
	 *
34
	 * @return	int
35
	 */
36
	public function num_rows()
37
	{
38
		if (is_int($this->num_rows))
39
		{
40
			return $this->num_rows;
41
		}
42
		elseif (($this->num_rows = $this->result_id->rowCount()) > 0)
43
		{
44
			return $this->num_rows;
45
		}
46
47
		$this->num_rows = count($this->result_id->fetchAll());
48
		$this->result_id->execute();
49
		return $this->num_rows;
50
	}
51
52
	// --------------------------------------------------------------------
53
54
	/**
55
	 * Number of fields in the result set
56
	 *
57
	 * @access	public
58
	 * @return	integer
59
	 */
60
	function num_fields()
61
	{
62
		return $this->result_id->columnCount();
63
	}
64
65
	// --------------------------------------------------------------------
66
67
	/**
68
	 * Fetch Field Names
69
	 *
70
	 * Generates an array of column names
71
	 *
72
	 * @access	public
73
	 * @return	array
74
	 */
75
	function list_fields()
76
	{
77
		if ($this->db->db_debug)
78
		{
79
			return $this->db->display_error('db_unsuported_feature');
80
		}
81
		return FALSE;
82
	}
83
84
	// --------------------------------------------------------------------
85
86
	/**
87
	 * Field data
88
	 *
89
	 * Generates an array of objects containing field meta-data
90
	 *
91
	 * @access	public
92
	 * @return	array
93
	 */
94
	function field_data()
95
	{
96
		$data = array();
97
	
98
		try
99
		{
100
			for($i = 0; $i < $this->num_fields(); $i++)
101
			{
102
				$data[] = $this->result_id->getColumnMeta($i);
103
			}
104
			
105
			return $data;
106
		}
107
		catch (Exception $e)
108
		{
109
			if ($this->db->db_debug)
110
			{
111
				return $this->db->display_error('db_unsuported_feature');
112
			}
113
			return FALSE;
114
		}
115
	}
116
117
	// --------------------------------------------------------------------
118
119
	/**
120
	 * Free the result
121
	 *
122
	 * @return	null
123
	 */
124
	function free_result()
125
	{
126
		if (is_object($this->result_id))
127
		{
128
			$this->result_id = FALSE;
129
		}
130
	}
131
132
	// --------------------------------------------------------------------
133
134
	/**
135
	 * Data Seek
136
	 *
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
140
	 *
141
	 * @access	private
142
	 * @return	array
143
	 */
144
	function _data_seek($n = 0)
145
	{
146
		return FALSE;
147
	}
148
149
	// --------------------------------------------------------------------
150
151
	/**
152
	 * Result - associative array
153
	 *
154
	 * Returns the result set as an array
155
	 *
156
	 * @access	private
157
	 * @return	array
158
	 */
159
	function _fetch_assoc()
160
	{
161
		return $this->result_id->fetch(PDO::FETCH_ASSOC);
162
	}
163
164
	// --------------------------------------------------------------------
165
166
	/**
167
	 * Result - object
168
	 *
169
	 * Returns the result set as an object
170
	 *
171
	 * @access	private
172
	 * @return	object
173
	 */
174
	function _fetch_object()
175
	{	
176
		return $this->result_id->fetchObject();
177
	}
178
179
}
180
181
182
/* End of file pdo_result.php */
183
/* Location: ./system/database/drivers/pdo/pdo_result.php */