blob: b584c99194a8dbd3c2d9a737a83bd0e9a72709d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
<?php
/**
* PHPPgAdmin v6.0.0-beta.52
*/
namespace PHPPgAdmin;
/**
* @file
* Really simple RecordSet to allow printTable of arrays.
*
* Id: ArrayRecordSet.php,v 1.3 2007/01/10 01:46:28 soranzo Exp $
*
* @package PHPPgAdmin
*/
/**
* Really simple RecordSet to allow printTable arrays.
* Mimics the behavior of an ADORecordset.
*
* Id: ArrayRecordSet.php,v 1.3 2007/01/10 01:46:28 soranzo Exp $
*
* @package PHPPgAdmin
*/
class ArrayRecordSet
{
private $_array;
private $_count;
public $EOF = false;
public $fields;
/**
* Constructor.
*
* @param array $data The input array
*/
public function __construct($data)
{
$this->_array = $data;
$this->_count = count($this->_array);
$this->fields = reset($this->_array);
if ($this->fields === false) {
$this->EOF = true;
}
}
/**
* Counts the records in the instance array.
*
* @return int number of records in the instance array
*/
public function recordCount()
{
return $this->_count;
}
/**
* Advance the internal pointer of the instance array
* if no more fields are left, marks the instance variable $EOF as true.
*/
public function moveNext()
{
$this->fields = next($this->_array);
if ($this->fields === false) {
$this->EOF = true;
}
}
}
|