1: <?php
2:
3: namespace database;
4:
5: include_once "../../global.inc.php";
6: include_once PATH_UTILITTY . "/StringManager.php";
7: require_once PATH_DATABASE . "/SqlManager.php";
8:
9: /**
10: * Description of PisSqlManager
11: *
12: * @author stubbfel
13: * @since 20.06.2013
14: */
15: class PisSqlManager extends SQLManager {
16:
17: /**
18: * Fieldname of the placeID
19: * @var string
20: */
21: public static $placeId = "pid";
22:
23: /**
24: * Fieldname of the name of the information
25: * @var string
26: */
27: public static $infName = "iName";
28:
29: /**
30: * Fieldname of the value of the information
31: * @var string
32: */
33: public static $infValue = "iValue";
34:
35: /**
36: * String for the select part of the query
37: * @var string
38: */
39: private $selectTerm = "SELECT pid, iName, iValue FROM pis WHERE ";
40:
41: /**
42: * String for the orderby part of the query
43: * @var string
44: */
45: private $orderByTerm = " ORDER BY pid, iName";
46:
47: /**
48: * String for the pid part of the query
49: * @var string
50: */
51: private $pidTerm = "pid = ";
52:
53: /**
54: * Default-Constructor
55: */
56: public function __construct() {
57: parent::__construct();
58: }
59:
60: /**
61: * Default-DeConstructor
62: */
63: public function __destruct() {
64: parent::__destruct();
65: }
66:
67: /**
68: * Methods send an query for the pis-service
69: * @param array $queryArgs
70: * @return array [num][assoc]
71: */
72: public function sendPisQuery($queryArgs) {
73:
74: // build query string
75: $query = $this->selectTerm;
76: if (\utiliy\ArrayManager::validIntList($queryArgs)) {
77: $query .= \utiliy\ArrayManager::toSqlWhereString($queryArgs, $this->orTerm, $this->pidTerm) . $this->orderByTerm;
78: } else {
79: return null;
80: }
81:
82: // send query
83: return $this->query($query);
84: }
85: }
86:
87: ?>
88: