1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Database
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * PostgreSQL database iterator.
14 *
15 * @since 13.1
16 */
17 class JDatabaseIteratorPostgresql extends JDatabaseIterator
18 {
19 /**
20 * Get the number of rows in the result set for the executed SQL given by the cursor.
21 *
22 * @return integer The number of rows in the result set.
23 *
24 * @since 13.1
25 * @see Countable::count()
26 */
27 public function count()
28 {
29 return pg_num_rows($this->cursor);
30 }
31
32 /**
33 * Method to fetch a row from the result set cursor as an object.
34 *
35 * @return mixed Either the next row from the result set or false if there are no more rows.
36 *
37 * @since 13.1
38 */
39 protected function fetchObject()
40 {
41 return pg_fetch_object($this->cursor, null, $this->class);
42 }
43
44 /**
45 * Method to free up the memory used for the result set.
46 *
47 * @return void
48 *
49 * @since 13.1
50 */
51 protected function freeResult()
52 {
53 pg_free_result($this->cursor);
54 }
55 }
56