4
$limit > 0 - first <limit> elements
5
$limit < 0 - last <limit> elements
8
class RAWPoint implements Iterator {
20
function __construct(CACHEDB &$cache, MASK &$mask, INTERVAL &$ivl, $limit) {
21
$this->cache = &$cache;
22
$this->ids = &$mask->ids;
24
$this->limit = $limit;
26
$this->use_subseconds = $cache->use_subseconds;
27
$this->postfix = false;
30
function SetOption($option, $value) {
31
$this->$option = $value;
34
function SetOptions($options) {
35
foreach ($options as $opt => &$value) {
41
if (!$this->ids) throw new ADEIException("Internal application error (MASK should be created using CACHE call)");
44
foreach ($this->ids as $id) {
45
$list .= "v$id AS v$id, ";
48
$table = $this->cache->GetTableName(0, $this->postfix);
50
$sql = $this->ivl->GetSQL($this->cache, $this->limit, $this->use_subseconds);
51
$list .= $sql['list'];
52
$cond = &$sql['cond'];
53
$sort = &$sql['sort'];
54
$limit = &$sql['limit'];
56
$this->res = mysql_query("SELECT $list FROM `$table` $cond $sort $limit", $this->cache->dbh);
59
throw new ADEIException("SELECT request '$list $cond $sort $limit' on CACHE table '$table' is failed...");
73
$this->row = mysql_fetch_row($this->res);
76
$lastkey = sizeof($this->row) - 1;
77
if ($this->use_subseconds) {
78
$ns = $this->row[$lastkey];
80
$extra = (9 - strlen($ns));
81
if ($extra) $ns = str_repeat('0', $extra) . $ns;
83
$this->key = $this->row[$lastkey-1] . ".$ns";
84
unset($this->row[$lastkey]);
85
unset($this->row[$lastkey-1]);
87
$this->key = $this->row[$lastkey];
88
unset($this->row[$lastkey]);
92
mysql_free_result($this->res);
97
return $this->row?true:false;
b'\\ No newline at end of file'