source: branches/1.2/workflow/inc/natural/class.natural_resultset.php @ 1349

Revision 1349, 1.5 KB checked in by niltonneto, 15 years ago (diff)

Ticket #561 - Inclusão do módulo Workflow faltante nessa versão.

Line 
1<?php
2/*
3 * Created on 26/03/2007
4 */
5
6 /**
7  * Result set class for PHP NatAPI
8  * @author Everton Flávio Rufino Seára - rufino@celepar.pr.gov.br
9  * @version 1.0
10  * @package Workflow
11  * @subpackage natural
12  * @license http://www.gnu.org/copyleft/gpl.html GPL
13  */
14 class NaturalResultSet
15 {
16  /**
17   * @var int $currRows Linha atual
18   * @access private
19   */
20        private $currRows;
21
22  /**
23   * @var array $result Array com o resultado
24   * @access private
25   */
26        private $result;
27
28        /** Inicializa o result set
29         * @return void
30         * @param array $_result Array com o resultado
31         * @access public
32         */
33        function __construct($_result)
34        {
35                $this->result = $_result;
36                $this->currRows = -1;
37        }
38        /**
39         * Returns the next row if it exists, else, returns false
40         * @return array next row of data, if it exists
41         * @access public
42         */
43        public function getNextRow()
44        {
45                if (count($this->result) > ++$this->currRows){
46                        return $this->result[$this->currRows];
47                } else {
48                        return false;
49                }
50        }
51
52        /**
53         * Returns the data from a specific field
54         * @param string $name Field name
55         * @return string data
56         * @access public
57         */
58        public function getFieldByName($name)
59        {
60                if (count($this->result) > $this->currRows)
61                        return $this->result[$this->currRows][$name];
62        }
63
64        /**
65         * Reset the result set
66         * @return void
67         * @access public
68         */
69        public function resetRow()
70        {
71                $this->currRows = -1;
72        }
73
74        /**
75         * Record count
76         * @return int Numero de registros
77         * @access public
78         */
79        public function recordCount()
80        {
81                return count($this->result);
82        }
83
84
85 }
86?>
Note: See TracBrowser for help on using the repository browser.