--- a/classes/bfw/database/Database.php
+++ b/classes/bfw/database/Database.php
@@ -71,11 +71,11 @@
*/
public function cleanup() {
try {
- $this->pdo->exec("DELETE FROM `t_user` WHERE `id` > 2;");
- $this->pdo->exec("DELETE FROM `t_group` WHERE `id` > 5;");
+ $this->pdo->exec("DELETE FROM t_user WHERE id > 2;");
+ $this->pdo->exec("DELETE FROM t_group WHERE id > 5;");
- $this->pdo->exec("ALTER TABLE `t_user` AUTO_INCREMENT = 2;");
- $this->pdo->exec("ALTER TABLE `t_group` AUTO_INCREMENT = 5;");
+ $this->pdo->exec("ALTER TABLE t_user AUTO_INCREMENT = 2;");
+ $this->pdo->exec("ALTER TABLE t_group AUTO_INCREMENT = 5;");
} catch (PDOException $pdoe) {
return false;
}
@@ -99,7 +99,7 @@
throw new InvalidArgumentException("Datei nicht gefunden: " . $filename);
}
- $rows = $this->fetchAll(sprintf("SELECT %s FROM `%s` ORDER BY `id`", implode(", ", $fields), $table));
+ $rows = $this->fetchAll(sprintf("SELECT %s FROM %s ORDER BY id", implode(", ", $fields), $table));
fwrite($handle, sprintf("%s\n", implode($seperator, $fields)));
foreach ($rows as $row) {
@@ -121,7 +121,7 @@
SELECT
*
FROM
- `%s`
+ %s
WHERE
%s
', $table, $cond
@@ -146,7 +146,7 @@
SELECT
*
FROM
- `%s`
+ %s
WHERE
%s
LIMIT 1
@@ -206,9 +206,9 @@
SELECT
*
FROM
- `%s`
+ %s
WHERE
- `id` = :id
+ id = :id
LIMIT 1
', $table
));
@@ -236,9 +236,9 @@
SELECT
*
FROM
- `%s`
+ %s
WHERE
- `id` > :id
+ id > :id
', $table
));
@@ -266,9 +266,9 @@
SELECT
*
FROM
- `%s`
+ %s
WHERE
- `%s` = :value
+ %s = :value
LIMIT 1
', $table, $field
));
@@ -296,9 +296,9 @@
SELECT
*
FROM
- `%s`
+ %s
WHERE
- `%s` = :value
+ %s = :value
', $table, $field
));
@@ -346,7 +346,7 @@
$keys = array();
foreach (array_keys($array) as $key) {
if ($key != 'id') {
- $keys[] = sprintf("`%s`", $key);
+ $keys[] = sprintf("%s", $key);
}
}
@@ -362,8 +362,8 @@
$fields = implode(",", $values);
$sql = sprintf("
- INSERT INTO `%s`
- (`id`, %s) VALUES (NULL, %s)
+ INSERT INTO %s
+ (id, %s) VALUES (NULL, %s)
", $table, $fieldList, $fields);
return $this->pdo->exec($sql);
@@ -381,16 +381,16 @@
$list = array();
foreach ($array as $key => $value) {
if ($key != 'id') {
- $list[] = sprintf("`%s` = '%s'", $key, $value);
+ $list[] = sprintf("%s = '%s'", $key, $value);
}
}
$listItems = implode(", ", $list);
$sql = sprintf("
- UPDATE `%s`
+ UPDATE %s
SET %s
- WHERE `id` = %d
+ WHERE id = %d
", $table, $listItems, $id);
return $this->pdo->exec($sql);
@@ -405,8 +405,8 @@
$this->logger->info(sprintf('%s(%s, %s) ', __METHOD__, $table, $id));
$sql = sprintf("
- DELETE FROM `%s`
- WHERE `id` = %d;
+ DELETE FROM %s
+ WHERE id = %d;
", $table, $id);
return $this->pdo->exec($sql);
@@ -415,4 +415,4 @@
public function getLastInsertedId() {
return $this->pdo->lastInsertId();
}
-}
\ No newline at end of file
+}