Subversion Repositories oidplus

Rev

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

Rev 989 Rev 990
Line 52... Line 52...
52
                // function in order to use that specialized function (since it is usually
52
                // function in order to use that specialized function (since it is usually
53
                // more reliable).
53
                // more reliable).
54
                return $this->getSlang()->insert_id($this);
54
                return $this->getSlang()->insert_id($this);
55
        }
55
        }
56
 
56
 
-
 
57
        public final function getTable(string $sql) {
-
 
58
                $out = array();
-
 
59
                $res = $this->query($sql);
-
 
60
                while ($row = $res->fetch_array()) {
-
 
61
                        $out[] = $row;
-
 
62
                }
-
 
63
                return $out;
-
 
64
        }
-
 
65
 
57
        public final function getScalar($sql) {
66
        public final function getScalar(string $sql) {
58
                $res = $this->query($sql);
67
                $res = $this->query($sql);
59
                $row = $res->fetch_array();
68
                $row = $res->fetch_array();
60
                if (count($row) == 0) return null;
69
                return $row ? reset($row) : null;
61
                $keys = array_keys($row);
-
 
62
                if (count($keys) == 0) return null;
-
 
63
                return $row[$keys[0]];
-
 
64
        }
70
        }
65
 
71
 
66
        public final function query(string $sql, /*?array*/ $prepared_args=null): OIDplusQueryResult {
72
        public final function query(string $sql, /*?array*/ $prepared_args=null): OIDplusQueryResult {
67
 
73
 
68
                $query_logfile = OIDplus::baseConfig()->getValue('QUERY_LOGFILE', '');
74
                $query_logfile = OIDplus::baseConfig()->getValue('QUERY_LOGFILE', '');