1 <?php
2 /**
3 * @package FrameworkOnFramework
4 * @subpackage database
5 * @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
6 * @license GNU General Public License version 2 or later; see LICENSE.txt
7 *
8 * This file is adapted from the Joomla! Platform. It is used to iterate a database cursor returning FOFTable objects
9 * instead of plain stdClass objects
10 */
11
12 // Protect from unauthorized access
13 defined('FOF_INCLUDED') or die;
14
15 if (!interface_exists('JDatabaseQueryLimitable'))
16 {
17 /**
18 * Joomla Database Query Limitable Interface.
19 * Adds bind/unbind methods as well as a getBounded() method
20 * to retrieve the stored bounded variables on demand prior to
21 * query execution.
22 *
23 * @since 12.1
24 */
25 interface JDatabaseQueryLimitable
26 {
27 /**
28 * Method to modify a query already in string format with the needed
29 * additions to make the query limited to a particular number of
30 * results, or start at a particular offset. This method is used
31 * automatically by the __toString() method if it detects that the
32 * query implements the FOFDatabaseQueryLimitable interface.
33 *
34 * @param string $query The query in string format
35 * @param integer $limit The limit for the result set
36 * @param integer $offset The offset for the result set
37 *
38 * @return string
39 *
40 * @since 12.1
41 */
42 public function processLimit($query, $limit, $offset = 0);
43
44 /**
45 * Sets the offset and limit for the result set, if the database driver supports it.
46 *
47 * Usage:
48 * $query->setLimit(100, 0); (retrieve 100 rows, starting at first record)
49 * $query->setLimit(50, 50); (retrieve 50 rows, starting at 50th record)
50 *
51 * @param integer $limit The limit for the result set
52 * @param integer $offset The offset for the result set
53 *
54 * @return FOFDatabaseQuery Returns this object to allow chaining.
55 *
56 * @since 12.1
57 */
58 public function setLimit($limit = 0, $offset = 0);
59 }
60 }
61
62 /**
63 * Joomla Database Query Limitable Interface.
64 * Adds bind/unbind methods as well as a getBounded() method
65 * to retrieve the stored bounded variables on demand prior to
66 * query execution.
67 *
68 * @since 12.1
69 */
70 interface FOFDatabaseQueryLimitable extends JDatabaseQueryLimitable
71 {
72 }
73