<?php
namespace Claromentis\Core\DAL;

$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"] = (@$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] ?: array()) + array("_ebff9d37a7bb577c57" . "bee4dd9f0e5fd7" => base64_decode("YXJyYXlfd" . "mFsdWVz"), "_d706c160e45bf" . "7434fff82a5976" . "f0e19" => base64_decode("YXJyYXlfa2" . "V5cw=="), "_c336a736" . "f98472e69" . "eb00017dd" . "a5a17e" => base64_decode("dHJpZ2dlc" . "l9lcnJvcg" . "=="), "_a591754a8ddcdbd" . "a9c80f1db4d911e1" . "4" => base64_decode("aXNfbnV" . "sbA=="), "_7fa89a60b02e7313a986f4b8e" . "3f65376" => base64_decode("YXJyYXlfY" . "29tYmluZQ" . "=="), "_31767d7ad58e706dbf4" . "7b7a51a0fe6c4" => base64_decode("Y291" . "bnQ="), "_84c2c84" . "bd9e6e99" . "71c2fd1e" . "e6d1d34c" . "b" => base64_decode("TnVtYmVyIG9mIGZpZWxkcyBpbiBmZXRjaEFycmF5IGRvZXNuJ3QgbWF0Y2gg" . "dGhlIHNhbWUgb2YgZmV0Y2hSb3cuIFBsZWFzZSBjcmVhdGUgYWxpYXNlcyBm" . "b3Igc29tZSBmaWVsZHMuIFRvIHByZXZlbnQgZnVydGhlciBkYW1hZ2UsIGV4" . "ZWN1dGlvbiBoYXMgc3RvcHBlZC4="));
use UnsupportedOperationException;






class BufferedResult implements ResultInterface, \ArrayAccess, \IteratorAggregate
{
    protected $data_storage;
    protected $fields_names;
    protected $cur_row;
    
    
    
    
    
    
    
    
    public function __construct($data, $_ca2f7b8f88d205faacd7b09a73e01613)
    {
        $this->data_storage = $data;
        $this->fields_names = $_ca2f7b8f88d205faacd7b09a73e01613;
        $this->cur_row = 0;
    }
    
    
    
    
    
    
    
    
    public static function Create(ResultInterface $_19fd4f7f0d59e743161d42d162596d9a)
    {
        $_720dbc5ed62d83cdb95dd6bd91460485 = $_19fd4f7f0d59e743161d42d162596d9a->fetchArray();
        if (!$_720dbc5ed62d83cdb95dd6bd91460485) {
            return new self(array(), array());
        }
        $_147aa65e6f86b03cd87a88a580320c7e = $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_d706c160e45bf7434fff82a5976f" . "0e19"]($_720dbc5ed62d83cdb95dd6bd91460485);
        $data = array($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_ebff9d37a7bb" . "577c57bee4dd9" . "f0e5fd7"]($_720dbc5ed62d83cdb95dd6bd91460485));
        $_b8cfc2e06d9d1fec1893ea4a054002bf = $_19fd4f7f0d59e743161d42d162596d9a->fetchRow();
        if (!$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_a591754a8ddcdbda9c80f1db" . "4d911e14"]($_b8cfc2e06d9d1fec1893ea4a054002bf)) {
            $data[] = $_b8cfc2e06d9d1fec1893ea4a054002bf;
            if ($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_31767d7ad58e706dbf" . "47b7a51a0fe6c4"]($_147aa65e6f86b03cd87a88a580320c7e) !== $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_31767d7ad58e706db" . "f47b7a51a0fe6c4"]($_b8cfc2e06d9d1fec1893ea4a054002bf)) {
                $GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_c336a736f98472e69eb000" . "17dda5a17e"]($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_84c2c84bd9e6e" . "9971c2fd1ee6d1" . "d34cb"]);
                exit;
            }
            while ($_b8cfc2e06d9d1fec1893ea4a054002bf = $_19fd4f7f0d59e743161d42d162596d9a->fetchRow()) {
                $data[] = $_b8cfc2e06d9d1fec1893ea4a054002bf;
            }
        }
        $_19fd4f7f0d59e743161d42d162596d9a->free();
        return new self($data, $_147aa65e6f86b03cd87a88a580320c7e);
    }
    public function fetchRow()
    {
        if (isset($this->data_storage[$this->cur_row])) {
            return $this->data_storage[$this->cur_row++];
        } else {
            return false;
        }
    }
    public function fetchArray()
    {
        $_b8cfc2e06d9d1fec1893ea4a054002bf = $this->fetchRow();
        if ($_b8cfc2e06d9d1fec1893ea4a054002bf === false) {
            return false;
        }
        return $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_7fa89a60b0" . "2e7313a986f" . "4b8e3f65376"]($this->fields_names, $_b8cfc2e06d9d1fec1893ea4a054002bf);
    }
    public function numRows()
    {
        return $GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_31767d7ad58e706dbf47b7a" . "51a0fe6c4"]($this->data_storage);
    }
    public function free()
    {
        $this->data_storage = array();
        $this->fields_names = array();
        return true;
    }
    public function hasData()
    {
        return $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_31767d7ad58e706dbf47b" . "7a51a0fe6c4"]($this->data_storage) > 0;
    }
    public function fetchAllValues()
    {
        $_189840d11056515e52402d1412a0b6e4 = array();
        if ($this->hasData()) {
            while (list($_c96f552040dea8086bf8bdd70059542f) = $this->fetchRow()) {
                $_189840d11056515e52402d1412a0b6e4[] = $_c96f552040dea8086bf8bdd70059542f;
            }
        }
        return $_189840d11056515e52402d1412a0b6e4;
    }
    public function offsetExists($_1f50e30be8c2fefa6881834e71d504a2)
    {
        return isset($this->data_storage[$_1f50e30be8c2fefa6881834e71d504a2]);
    }
    public function offsetGet($_1f50e30be8c2fefa6881834e71d504a2)
    {
        return $this->data_storage[$_1f50e30be8c2fefa6881834e71d504a2];
    }
    public function offsetSet($_1f50e30be8c2fefa6881834e71d504a2, $value)
    {
        throw new UnsupportedOperationException();
    }
    public function offsetUnset($_1f50e30be8c2fefa6881834e71d504a2)
    {
        throw new UnsupportedOperationException();
    }
    
    
    
    
    
    
    
    
    
    public function getIterator()
    {
        return new \ArrayIterator($this->data_storage);
    }
}