Rev 1116 | Rev 1148 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1116 | Rev 1130 | ||
---|---|---|---|
Line 22... | Line 22... | ||
22 | // phpcs:disable PSR1.Files.SideEffects |
22 | // phpcs:disable PSR1.Files.SideEffects |
23 | \defined('INSIDE_OIDPLUS') or die; |
23 | \defined('INSIDE_OIDPLUS') or die; |
24 | // phpcs:enable PSR1.Files.SideEffects |
24 | // phpcs:enable PSR1.Files.SideEffects |
25 | 25 | ||
26 | abstract class OIDplusDatabaseConnection extends OIDplusBaseClass { |
26 | abstract class OIDplusDatabaseConnection extends OIDplusBaseClass { |
- | 27 | /** |
|
- | 28 | * @var bool |
|
- | 29 | */ |
|
27 | protected /*bool*/ $connected = false; |
30 | protected /*bool*/ $connected = false; |
- | 31 | ||
- | 32 | /** |
|
- | 33 | * @var bool|null |
|
- | 34 | */ |
|
28 | protected /*?bool*/ $html = null; |
35 | protected /*?bool*/ $html = null; |
- | 36 | ||
- | 37 | /** |
|
- | 38 | * @var string|null |
|
- | 39 | */ |
|
29 | protected /*?string*/ $last_query = null; |
40 | protected /*?string*/ $last_query = null; |
- | 41 | ||
- | 42 | /** |
|
- | 43 | * @var bool |
|
- | 44 | */ |
|
30 | protected /*bool*/ $slangDetectionDone = false; |
45 | protected /*bool*/ $slangDetectionDone = false; |
31 | 46 | ||
32 | /** |
47 | /** |
33 | * @param string $sql |
48 | * @param string $sql |
34 | * @param array|null $prepared_args |
49 | * @param array|null $prepared_args |
Line 79... | Line 94... | ||
79 | 94 | ||
80 | /** |
95 | /** |
81 | * @return OIDplusDatabasePlugin|null |
96 | * @return OIDplusDatabasePlugin|null |
82 | */ |
97 | */ |
83 | public function getPlugin()/*: ?OIDplusDatabasePlugin*/ { |
98 | public function getPlugin()/*: ?OIDplusDatabasePlugin*/ { |
84 | $res = null; |
- | |
85 | $plugins = OIDplus::getDatabasePlugins(); |
99 | $plugins = OIDplus::getDatabasePlugins(); |
86 | foreach ($plugins as $plugin) { |
100 | foreach ($plugins as $plugin) { |
87 | if (get_class($this) == get_class($plugin::newConnection())) { |
101 | if (get_class($this) == get_class($plugin::newConnection())) { |
88 | return $plugin; |
102 | return $plugin; |
89 | } |
103 | } |
90 | } |
104 | } |
91 | return $res; |
105 | return null; |
92 | } |
106 | } |
93 | 107 | ||
94 | /** |
108 | /** |
95 | * @return int |
109 | * @return int |
96 | * @throws OIDplusException |
110 | * @throws OIDplusException |
Line 132... | Line 146... | ||
132 | * @param string $sql |
146 | * @param string $sql |
133 | * @param array|null $prepared_args |
147 | * @param array|null $prepared_args |
134 | * @return OIDplusQueryResult |
148 | * @return OIDplusQueryResult |
135 | * @throws OIDplusException |
149 | * @throws OIDplusException |
136 | */ |
150 | */ |
137 | public final function query(string $sql, /*?array*/ $prepared_args=null): OIDplusQueryResult { |
151 | public final function query(string $sql, array $prepared_args=null): OIDplusQueryResult { |
138 | 152 | ||
139 | $query_logfile = OIDplus::baseConfig()->getValue('QUERY_LOGFILE', ''); |
153 | $query_logfile = OIDplus::baseConfig()->getValue('QUERY_LOGFILE', ''); |
140 | if (!empty($query_logfile)) { |
154 | if (!empty($query_logfile)) { |
141 | $ts = explode(" ",microtime()); |
155 | $ts = explode(" ",microtime()); |
142 | $ts = date("Y-m-d H:i:s",intval($ts[1])).substr((string)$ts[0],1,4); |
156 | $ts = date("Y-m-d H:i:s",intval($ts[1])).substr((string)$ts[0],1,4); |