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 36... | Line 36... | ||
36 | public function containsResultSet(): bool { |
36 | public function containsResultSet(): bool { |
37 | return !$this->no_resultset; |
37 | return !$this->no_resultset; |
38 | } |
38 | } |
39 | 39 | ||
40 | public function num_rows(): int { |
40 | public function num_rows(): int { |
41 | if ($this->no_resultset) throw new OIDplusException("The query has returned no result set (i.e. it was not a SELECT query)"); |
41 | if ($this->no_resultset) throw new OIDplusException(_L('The query has returned no result set (i.e. it was not a SELECT query)')); |
42 | return odbc_num_rows($this->res); |
42 | return odbc_num_rows($this->res); |
43 | } |
43 | } |
44 | 44 | ||
45 | public function fetch_array()/*: ?array*/ { |
45 | public function fetch_array()/*: ?array*/ { |
46 | if ($this->no_resultset) throw new OIDplusException("The query has returned no result set (i.e. it was not a SELECT query)"); |
46 | if ($this->no_resultset) throw new OIDplusException(_L('The query has returned no result set (i.e. it was not a SELECT query)')); |
47 | $ret = odbc_fetch_array($this->res); |
47 | $ret = odbc_fetch_array($this->res); |
48 | if ($ret === false) $ret = null; |
48 | if ($ret === false) $ret = null; |
49 | if (!is_null($ret)) { |
49 | if (!is_null($ret)) { |
50 | // ODBC gives bit(1) as binary, MySQL as integer and PDO as string. |
50 | // ODBC gives bit(1) as binary, MySQL as integer and PDO as string. |
51 | // We'll do it like MySQL does, even if ODBC is actually more correct. |
51 | // We'll do it like MySQL does, even if ODBC is actually more correct. |
Line 56... | Line 56... | ||
56 | } |
56 | } |
57 | return $ret; |
57 | return $ret; |
58 | } |
58 | } |
59 | 59 | ||
60 | public function fetch_object()/*: ?object*/ { |
60 | public function fetch_object()/*: ?object*/ { |
61 | if ($this->no_resultset) throw new OIDplusException("The query has returned no result set (i.e. it was not a SELECT query)"); |
61 | if ($this->no_resultset) throw new OIDplusException(_L('The query has returned no result set (i.e. it was not a SELECT query)')); |
62 | $ret = odbc_fetch_object($this->res); |
62 | $ret = odbc_fetch_object($this->res); |
63 | if ($ret === false) $ret = null; |
63 | if ($ret === false) $ret = null; |
64 | if (!is_null($ret)) { |
64 | if (!is_null($ret)) { |
65 | // ODBC gives bit(1) as binary, MySQL as integer and PDO as string. |
65 | // ODBC gives bit(1) as binary, MySQL as integer and PDO as string. |
66 | // We'll do it like MySQL does, even if ODBC is actually more correct. |
66 | // We'll do it like MySQL does, even if ODBC is actually more correct. |