Files
geodb/geoapi/database/PisSqlManager.php
2013-07-01 18:54:59 +02:00

88 lines
1.8 KiB
PHP

<?php
namespace database;
include_once "../../global.inc.php";
include_once PATH_UTILITTY . "/StringManager.php";
require_once PATH_DATABASE . "/SqlManager.php";
/**
* Description of PisSqlManager
*
* @author stubbfel
* @since 20.06.2013
*/
class PisSqlManager extends SQLManager {
/**
* Fieldname of the placeID
* @var string
*/
public static $placeId = "pid";
/**
* Fieldname of the name of the information
* @var string
*/
public static $infName = "iName";
/**
* Fieldname of the value of the information
* @var string
*/
public static $infValue = "iValue";
/**
* String for the select part of the query
* @var string
*/
private static $selectTerm = "SELECT pid, iName, iValue FROM pis WHERE ";
/**
* String for the orderby part of the query
* @var string
*/
private static $orderByTerm = " ORDER BY pid, iName";
/**
* String for the pid part of the query
* @var string
*/
private static $pidTerm = "pid = ";
/**
* Default-Constructor
*/
public function __construct() {
parent::__construct();
}
/**
* Default-DeConstructor
*/
public function __destruct() {
parent::__destruct();
}
/**
* Methods send an query for the pis-service
* @param array $queryArgs
* @return array [num][assoc]
*/
public function sendPisQuery($queryArgs) {
// build query string
$query = self::$selectTerm;
if (\utiliy\ArrayManager::validIntList($queryArgs)) {
$query .= \utiliy\ArrayManager::toSqlWhereString($queryArgs, self::$orTerm, self::$pidTerm) . self::$orderByTerm;
} else {
return null;
}
// send query
return $this->query($query);
}
}
?>