more comment typos
[moodle.git] / lib / dml / moodle_recordset.php
CommitLineData
49926145 1<?php
2
3// This file is part of Moodle - http://moodle.org/
4//
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17
18
19/**
20 * Abstract recordset.
21 *
22 * @package moodlecore
23 * @subpackage DML
24 * @copyright 2008 Petr Skoda (http://skodak.org)
25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 */
37f7c9b0 27
28/**
d24832f9 29 * Abstract class for resultsets returned from database functions.
37f7c9b0 30 * This is a simple Iterator with needed recorset closing support.
31 *
d24832f9 32 * The difference from old recorset is that the records are returned
37f7c9b0 33 * as objects, not arrays. You should use "foreach ($recordset as $record) {}"
34 * followed by "$recordset->close()".
35 *
36 * Do not forget to close all recordsets when they are not needed anymore!
37 */
38abstract class moodle_recordset implements Iterator {
39
40 /**
41 * Returns current record - fields as object properties, lowercase
42 * @return object
43 */
44 //public abstract function current();
45
46 /**
47 * Returns the key of current row
48 * @return int current row
49 */
50 //public abstract function key();
51
52 /**
53 * Moves forward to next row
54 * @return void
55 */
56 //public abstract function next();
57
58 /**
4d276e34 59 * Rewinds are not supported!
37f7c9b0 60 * @return void
61 */
d6691608 62 public function rewind() {
63 // no seeking, sorry - let's ignore it ;-)
64 return;
65 }
37f7c9b0 66
67 /**
68 * Did we reach the end?
69 * @return boolean
70 */
71 //public abstract function valid();
72
73 /**
74 * Free resources and connections, recordset can not be used anymore.
75 * @return void
76 */
77 public abstract function close();
d24832f9 78}