Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
pdo.php
Aller à la documentation de ce fichier.
1 <?php
2 /**
3  * @package Joomla.Platform
4  * @subpackage Database
5  *
6  * @copyright Copyright (C) 2005 - 2013 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  * PDO database iterator.
14  *
15  * @package Joomla.Platform
16  * @subpackage Database
17  * @since 12.1
18  */
20 {
21  /**
22  * Get the number of rows in the result set for the executed SQL given by the cursor.
23  *
24  * @return integer The number of rows in the result set.
25  *
26  * @since 12.1
27  * @see Countable::count()
28  */
29  public function count()
30  {
31  if (!empty($this->cursor) && $this->cursor instanceof PDOStatement)
32  {
33  return $this->cursor->rowCount();
34  }
35  else
36  {
37  return 0;
38  }
39  }
40 
41  /**
42  * Method to fetch a row from the result set cursor as an object.
43  *
44  * @return mixed Either the next row from the result set or false if there are no more rows.
45  *
46  * @since 12.1
47  */
48  protected function fetchObject()
49  {
50  if (!empty($this->cursor) && $this->cursor instanceof PDOStatement)
51  {
52  return $this->cursor->fetchObject($this->class);
53  }
54  else
55  {
56  return false;
57  }
58  }
59 
60  /**
61  * Method to free up the memory used for the result set.
62  *
63  * @return void
64  *
65  * @since 12.1
66  */
67  protected function freeResult()
68  {
69  if (!empty($this->cursor) && $this->cursor instanceof PDOStatement)
70  {
71  $this->cursor->closeCursor();
72  }
73  }
74 }