|
@@ -13,6 +13,7 @@ class EveDB {
|
13
|
13
|
|
14
|
14
|
$this->handlers = array(
|
15
|
15
|
'items' => new ItemsTableHandler($this->pdo),
|
|
16
|
+ 'locations' => new LocationsTableHandler($this->pdo),
|
16
|
17
|
);
|
17
|
18
|
}
|
18
|
19
|
|
|
@@ -54,4 +55,35 @@ class ItemsTableHandler extends BaseHandler {
|
54
|
55
|
|
55
|
56
|
}
|
56
|
57
|
|
|
58
|
+class LocationsTableHandler extends BaseHandler {
|
|
59
|
+
|
|
60
|
+ private $getByIdSmt;
|
|
61
|
+
|
|
62
|
+ protected function initStatements() {
|
|
63
|
+ $this->getByIdSmt = $this->pdo->prepare('SELECT categoryName, itemName FROM mapDenormalize JOIN invTypes ON (mapDenormalize.typeID = invTypes.typeID) JOIN invGroups ON (invGroups.groupID = invTypes.groupID) JOIN invCategories ON (invGroups.categoryID = invCategories.categoryID) WHERE itemID = :id');
|
|
64
|
+ }
|
|
65
|
+
|
|
66
|
+ public function getById($id) {
|
|
67
|
+ // 66014940 <= locationID <= 66014952 then staStations.stationID = locationID - 6000000
|
|
68
|
+ // 66000000 <= locationID <= 66999999 then staStations.stationID = locationID - 6000001
|
|
69
|
+ // 67000000 <= locationID <= 67999999 then ConqStations.stationID = locationID - 6000000
|
|
70
|
+ // 60014861 <= locationID <= 60014928 then ConqStations.stationID = locationID
|
|
71
|
+ // 60000000 <= locationID <= 61000000 then staStations.stationID = locationID
|
|
72
|
+ // 61000000 <= locationID then ConqStations.stationID = locationID
|
|
73
|
+ // default mapDenormalize.itemID = locationID
|
|
74
|
+
|
|
75
|
+ $id = (double) $id;
|
|
76
|
+
|
|
77
|
+ if (66014940 <= $id && $id <= 66014952 || 67000000 <= $id && $id <= 67999999) {
|
|
78
|
+ $id -= 6000000;
|
|
79
|
+ } else if (66000000 <= $id && $id <= 66999999) {
|
|
80
|
+ $id -= 6000001;
|
|
81
|
+ }
|
|
82
|
+
|
|
83
|
+ $this->getByIdSmt->execute(array(':id' => $id));
|
|
84
|
+ return $this->getByIdSmt->fetch(PDO::FETCH_CLASS | PDO::FETCH_CLASSTYPE);
|
|
85
|
+ }
|
|
86
|
+
|
|
87
|
+}
|
|
88
|
+
|
57
|
89
|
?>
|