Subversion Repositories oidplus

Rev

Rev 277 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 277 Rev 360
Line 38... Line 38...
38
        public function containsResultSet(): bool {
38
        public function containsResultSet(): bool {
39
                return !$this->no_resultset;
39
                return !$this->no_resultset;
40
        }
40
        }
41
 
41
 
42
        public function num_rows(): int {
42
        public function num_rows(): int {
43
                if ($this->no_resultset) throw new OIDplusException("The query has returned no result set (i.e. it was not a SELECT query)");
43
                if ($this->no_resultset) throw new OIDplusException(_L('The query has returned no result set (i.e. it was not a SELECT query)'));
44
                return pg_num_rows($this->res);
44
                return pg_num_rows($this->res);
45
        }
45
        }
46
 
46
 
47
        public function fetch_array()/*: ?array*/ {
47
        public function fetch_array()/*: ?array*/ {
48
                if ($this->no_resultset) throw new OIDplusException("The query has returned no result set (i.e. it was not a SELECT query)");
48
                if ($this->no_resultset) throw new OIDplusException(_L('The query has returned no result set (i.e. it was not a SELECT query)'));
49
                $ret = pg_fetch_array($this->res, null, PGSQL_ASSOC);
49
                $ret = pg_fetch_array($this->res, null, PGSQL_ASSOC);
50
                if ($ret === false) $ret = null;
50
                if ($ret === false) $ret = null;
51
                if (!is_null($ret)) {
51
                if (!is_null($ret)) {
52
                        foreach ($ret as $key => &$value){
52
                        foreach ($ret as $key => &$value){
53
                                $type = pg_field_type($this->res,pg_field_num($this->res, $key));
53
                                $type = pg_field_type($this->res,pg_field_num($this->res, $key));
Line 58... Line 58...
58
                }
58
                }
59
                return $ret;
59
                return $ret;
60
        }
60
        }
61
 
61
 
62
        public function fetch_object()/*: ?object*/ {
62
        public function fetch_object()/*: ?object*/ {
63
                if ($this->no_resultset) throw new OIDplusException("The query has returned no result set (i.e. it was not a SELECT query)");
63
                if ($this->no_resultset) throw new OIDplusException(_L('The query has returned no result set (i.e. it was not a SELECT query)'));
64
                $ret = pg_fetch_object($this->res);
64
                $ret = pg_fetch_object($this->res);
65
                if ($ret === false) $ret = null;
65
                if ($ret === false) $ret = null;
66
                if (!is_null($ret)) {
66
                if (!is_null($ret)) {
67
                        foreach ($ret as $key => &$value){
67
                        foreach ($ret as $key => &$value){
68
                                $type = pg_field_type($this->res,pg_field_num($this->res, $key));
68
                                $type = pg_field_type($this->res,pg_field_num($this->res, $key));