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 40... Line 40...
40
        public function containsResultSet(): bool {
40
        public function containsResultSet(): bool {
41
                return !$this->no_resultset;
41
                return !$this->no_resultset;
42
        }
42
        }
43
 
43
 
44
        public function num_rows(): int {
44
        public function num_rows(): int {
45
                if ($this->no_resultset) throw new OIDplusException("The query has returned no result set (i.e. it was not a SELECT query)");
45
                if ($this->no_resultset) throw new OIDplusException(_L('The query has returned no result set (i.e. it was not a SELECT query)'));
46
 
46
 
47
                $this->stmt->store_result();
47
                $this->stmt->store_result();
48
                return $this->stmt->num_rows;
48
                return $this->stmt->num_rows;
49
        }
49
        }
50
 
50
 
51
        public function fetch_array()/*: ?array*/ {
51
        public function fetch_array()/*: ?array*/ {
52
                if ($this->no_resultset) throw new OIDplusException("The query has returned no result set (i.e. it was not a SELECT query)");
52
                if ($this->no_resultset) throw new OIDplusException(_L('The query has returned no result set (i.e. it was not a SELECT query)'));
53
 
53
 
54
                // https://stackoverflow.com/questions/10752815/mysqli-get-result-alternative , modified
54
                // https://stackoverflow.com/questions/10752815/mysqli-get-result-alternative , modified
55
                $stmt = $this->stmt;
55
                $stmt = $this->stmt;
56
                $stmt->store_result();
56
                $stmt->store_result();
57
                $resultkeys = array();
57
                $resultkeys = array();
Line 87... Line 87...
87
                // Return the array we built.
87
                // Return the array we built.
88
                return $ret;
88
                return $ret;
89
        }
89
        }
90
 
90
 
91
        public function fetch_object()/*: ?object*/ {
91
        public function fetch_object()/*: ?object*/ {
92
                if ($this->no_resultset) throw new OIDplusConfigInitializationException("The query has returned no result set (i.e. it was not a SELECT query)");
92
                if ($this->no_resultset) throw new OIDplusConfigInitializationException(_L('The query has returned no result set (i.e. it was not a SELECT query)'));
93
 
93
 
94
                $ary = $this->fetch_array();
94
                $ary = $this->fetch_array();
95
                if (!$ary) return null;
95
                if (!$ary) return null;
96
 
96
 
97
                $obj = new stdClass;
97
                $obj = new stdClass;