PluginProbe
User Access Manager / 2.3.13
User Access Manager v2.3.13
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
← All changes | src/Database/Database.php +53 -35 trunk2.3.13 View file →
@@ -34,13 +34,19 @@
34 34 {
35 35 return $this->wpDatabase->prefix . self::USER_GROUP_TO_OBJECT_TABLE_NAME;
36 36 }
37 37
38 + /**
39 + * @see dbDelta()
40 + */
38 41 public function dbDelta(string $queries = '', bool $execute = true): array
39 42 {
40 43 return $this->wordpress->dbDelta($queries, $execute);
41 44 }
42 45
46 + /**
47 + * @see wpdb
48 + */
43 49 public function getPrefix(): string
44 50 {
45 51 return $this->wpDatabase->prefix;
46 52 }
@@ -84,64 +90,92 @@
84 90 {
85 91 return $this->wpDatabase->prefix . 'capabilities';
86 92 }
87 93
94 + /**
95 + * @see wpdb::get_col
96 + */
88 97 public function getColumn(?string $query = null, int $column = 0): array
89 98 {
90 99 return $this->wpDatabase->get_col($query, $column);
91 100 }
92 101
102 + /**
103 + * @see wpdb::get_row
104 + */
93 105 public function getRow(?string $query = null, string $output = OBJECT, int $row = 0): object|array|null
94 106 {
95 107 return $this->wpDatabase->get_row($query, $output, $row);
96 108 }
97 109
110 + /**
111 + * @see wpdb::get_var
112 + */
98 113 public function getVariable(?string $query = null, int $column = 0, int $row = 0): int|string|null
99 114 {
100 115 return $this->wpDatabase->get_var($query, $column, $row);
101 116 }
102 117
118 + /**
119 + * @see wpdb::get_blog_prefix
120 + */
103 121 public function getBlogPrefix(int|string|null $blogId = null): string
104 122 {
105 123 return $this->wpDatabase->get_blog_prefix($blogId);
106 124 }
107 125
126 + /**
127 + * @see wpdb::prepare
128 + */
108 129 public function prepare(string $query, mixed $arguments): string
109 130 {
110 131 return $this->wpDatabase->prepare($query, $arguments);
111 132 }
112 133
134 + /**
135 + * @see wpdb::query
136 + */
113 137 public function query(string $query): bool|int
114 138 {
115 139 return $this->wpDatabase->query($query);
116 140 }
117 141
142 + /**
143 + * @see wpdb::get_results
144 + */
118 145 public function getResults(?string $query = null, string $output = OBJECT): object|array|null
119 146 {
120 147 return $this->wpDatabase->get_results($query, $output);
121 148 }
122 149
123 - public function insert(string $table, array $data, array|string|null $format = null): bool|int
150 + /**
151 + * @see wpdb::insert
152 + */
153 + public function insert(string $table, array $data, $format = null): bool|int
124 154 {
125 155 return $this->wpDatabase->insert($table, $data, $format);
126 156 }
127 157
128 - public function update(
129 - string $table,
130 - array $data,
131 - array $where,
132 - array|string|null $format = null,
133 - array|string|null $whereFormat = null
134 - ): bool|int {
158 + /**
159 + * @see wpdb::update
160 + */
161 + public function update(string $table, array $data, array $where, $format = null, $whereFormat = null): bool|int
162 + {
135 163 return $this->wpDatabase->update($table, $data, $where, $format, $whereFormat);
136 164 }
137 165
138 - public function replace(string $table, array $data, array|string|null $format = null): bool|int
166 + /**
167 + * @see wpdb::insert
168 + */
169 + public function replace(string $table, array $data, $format = null): bool|int
139 170 {
140 171 return $this->wpDatabase->replace($table, $data, $format);
141 172 }
142 173
143 - public function delete(string $table, array $where, array|string|null $whereFormat = null): bool|int
174 + /**
175 + * @see wpdb::delete
176 + */
177 + public function delete(string $table, array $where, $whereFormat = null): bool|int
144 178 {
145 179 return $this->wpDatabase->delete($table, $where, $whereFormat);
146 180 }
147 181
@@ -146,36 +180,20 @@
146 180 }
147 181
148 182 public function getCharset(): string
149 183 {
150 - return $this->getCharsetCollate('DEFAULT ');
151 - }
184 + $charsetCollate = '';
152 185
153 - /**
154 - * The charset clause for a column definition. It carries no DEFAULT, because that
155 - * makes it a table option, which a column definition does not accept.
156 - */
157 - public function getColumnCharset(): string
158 - {
159 - return $this->getCharsetCollate('');
160 - }
186 + $mySlqVersion = (string) $this->getVariable('SELECT VERSION() as mysql_version');
161 187
162 - private function getCharsetCollate(string $charsetPrefix): string
163 - {
164 - $mySqlVersion = (string) $this->getVariable('SELECT VERSION() as mysql_version');
188 + if (version_compare($mySlqVersion, '4.1.0', '>=')) {
189 + if (!empty($this->wpDatabase->charset)) {
190 + $charsetCollate = "DEFAULT CHARACTER SET {$this->wpDatabase->charset}";
191 + }
165 192
166 - if (version_compare($mySqlVersion, '4.1.0', '<')) {
167 - return '';
168 - }
169 -
170 - $charsetCollate = '';
171 -
172 - if (!empty($this->wpDatabase->charset)) {
173 - $charsetCollate = "{$charsetPrefix}CHARACTER SET {$this->wpDatabase->charset}";
174 - }
175 -
176 - if (!empty($this->wpDatabase->collate)) {
177 - $charsetCollate .= " COLLATE {$this->wpDatabase->collate}";
193 + if (!empty($this->wpDatabase->collate)) {
194 + $charsetCollate .= " COLLATE {$this->wpDatabase->collate}";
195 + }
178 196 }
179 197
180 198 return $charsetCollate;
181 199 }