db/drivers/MysqlDriver.php 1 location
|
@@ 216-229 (lines=14) @@
|
213 |
|
* |
214 |
|
* @return bool |
215 |
|
*/ |
216 |
|
public function exists($table, array $params = []) |
217 |
|
{ |
218 |
|
$keys = []; |
219 |
|
|
220 |
|
foreach ($params AS $key => $val) { |
221 |
|
$keys[] = '`' . $key . '`="' . $val . '""'; |
222 |
|
} |
223 |
|
|
224 |
|
$sth = $this->conn->prepare('SELECT * FROM ' . $table . ' WHERE ' . implode(' AND ', $keys) . ' LIMIT 1;'); |
225 |
|
/** @noinspection PdoApiUsageInspection */ |
226 |
|
$sth->execute(); |
227 |
|
|
228 |
|
return (bool)$sth->rowCount(); |
229 |
|
} |
230 |
|
} |
231 |
|
|
db/drivers/PgsqlDriver.php 1 location
|
@@ 222-235 (lines=14) @@
|
219 |
|
* |
220 |
|
* @return bool |
221 |
|
*/ |
222 |
|
public function exists($table, array $params = []) |
223 |
|
{ |
224 |
|
$keys = []; |
225 |
|
|
226 |
|
foreach ($params AS $key => $val) { |
227 |
|
$keys[] = '"' . $key . '"=\'' . $val . '\''; |
228 |
|
} |
229 |
|
|
230 |
|
$sth = $this->conn->prepare('SELECT * FROM ' . $table . ' WHERE ' . implode(' AND ', $keys) . ' LIMIT 1;'); |
231 |
|
/** @noinspection PdoApiUsageInspection */ |
232 |
|
$sth->execute(); |
233 |
|
|
234 |
|
return (bool)$sth->rowCount(); |
235 |
|
} |
236 |
|
} |