|
@@ -14,6 +14,7 @@ class EveDB {
|
14
|
14
|
$this->handlers = array(
|
15
|
15
|
'items' => new ItemsTableHandler($this->pdo),
|
16
|
16
|
'locations' => new LocationsTableHandler($this->pdo),
|
|
17
|
+ 'flags' => new FlagsTableHandler($this->pdo),
|
17
|
18
|
);
|
18
|
19
|
}
|
19
|
20
|
|
|
@@ -55,6 +56,28 @@ class ItemsTableHandler extends BaseHandler {
|
55
|
56
|
|
56
|
57
|
}
|
57
|
58
|
|
|
59
|
+class FlagsTableHandler extends BaseHandler {
|
|
60
|
+
|
|
61
|
+ private $getAllSmt;
|
|
62
|
+ private $cache = array();
|
|
63
|
+
|
|
64
|
+ protected function initStatements() {
|
|
65
|
+ $this->getAllSmt = $this->pdo->prepare('SELECT flagId AS id, flagName AS name, flagText AS text FROM invFlags');
|
|
66
|
+ }
|
|
67
|
+
|
|
68
|
+ public function getById($id) {
|
|
69
|
+ if (empty($this->cache)) {
|
|
70
|
+ $this->getAllSmt->execute();
|
|
71
|
+ foreach ($this->getAllSmt->fetchAll(PDO::FETCH_CLASS) as $flag) {
|
|
72
|
+ $this->cache[(int) $flag->id] = $flag;
|
|
73
|
+ }
|
|
74
|
+ }
|
|
75
|
+
|
|
76
|
+ return $this->cache[(int) $id];
|
|
77
|
+ }
|
|
78
|
+
|
|
79
|
+}
|
|
80
|
+
|
58
|
81
|
class LocationsTableHandler extends BaseHandler {
|
59
|
82
|
|
60
|
83
|
private $getByIdSmt;
|