summaryrefslogtreecommitdiffstats
path: root/modules/database/classes/driver/mysql/result.php
blob: e9de4a5bc271dfda965a20144199697c56e03d1e (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
<?php

/**
 * Database result implementation for Mysqli
 * @package Database
 */
class Result_Mysql_Driver extends Result_Database
{

    /**
     * Initializes new result object
     * 
     * @param mysqli_result $result Mysqli Result
     * @return void    
     * @access public  
     * @link http://php.net/manual/en/class.mysqli-result.php
     */
    public function __construct($result)
    {
        $this->_result = $result;
    }

    /**
     * Throws exception if rewind is attempted.
     * 
     * @return void      
     * @access public    
     * @throws Exception If rewind is attempted
     */
    public function rewind()
    {
        if ($this->_position > 0)
        {
            throw new Exception('Mysqli result cannot be rewound for unbuffered queries.');
        }
    }

    /**
     * Iterates to the next row in the result set
     * 
     * @return void   
     * @access public 
     */
    public function next()
    {
        $this->check_fetched();
        $this->_row = $this->_result->fetch_object();
        if ($this->_row)
        {
            $this->_position++;
        }
        else
        {
            $this->_result->free();
        }
    }

}