136 lines
3.1 KiB
PHP
136 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace database;
|
|
|
|
include_once "../../global.inc.php";
|
|
include_once PATH_UTILITTY . "/ArrayManager.php";
|
|
require_once PATH_DATABASE . "/SqlManager.php";
|
|
|
|
/**
|
|
* Description of PssSqlManager
|
|
*
|
|
* @author stubbfel
|
|
* @since 20.06.2013
|
|
*/
|
|
class PssSqlManager extends SQLManager {
|
|
|
|
/**
|
|
* Fieldname of the placeID
|
|
* @var string
|
|
*/
|
|
public static $placeId = "pid";
|
|
|
|
/**
|
|
* Fieldname of the name of the service
|
|
* @var string
|
|
*/
|
|
public static $srvName = "sName";
|
|
|
|
/**
|
|
* Fieldname of the value of the information
|
|
* @var string
|
|
*/
|
|
public static $srvSap = "sap";
|
|
|
|
/**
|
|
* Fieldname of the value of the information
|
|
* @var string
|
|
*/
|
|
public static $srvRequest = "request";
|
|
|
|
/**
|
|
* Fieldname of the parendId
|
|
* @var string
|
|
*/
|
|
public static $parentId = "parent";
|
|
|
|
/**
|
|
* Fieldname of the refpoint
|
|
* @var string
|
|
*/
|
|
public static $refpoint = "refpoint";
|
|
|
|
/**
|
|
* String for the select part of the query
|
|
* @var string
|
|
*/
|
|
private static $selectTerm = "SELECT pid, parent, refpoint, sName, sap, request FROM pss WHERE ";
|
|
|
|
/**
|
|
* String for the select all part of the query
|
|
* @var string
|
|
*/
|
|
private static $selectAllTerm = "SELECT pid, parent, refpoint, sName, sap, request FROM pss ";
|
|
|
|
/**
|
|
* String for the orderby part of the query
|
|
* @var string
|
|
*/
|
|
private static $orderByTerm = " ORDER BY pid, sName";
|
|
|
|
/**
|
|
* String for the pid part of the query
|
|
* @var string
|
|
*/
|
|
private static $pidTerm = "pid = ";
|
|
|
|
/**
|
|
* String for the iName part of the query
|
|
* @var string
|
|
*/
|
|
private static $sNameTerm = "sName = ";
|
|
|
|
/**
|
|
* 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 sendPssQuery($pidList, $sNameList) {
|
|
|
|
// build query string
|
|
$query = self::$selectTerm;
|
|
if (\utiliy\ArrayManager::validIntList($pidList)) {
|
|
$query .= self::$openBracket;
|
|
$query .= \utiliy\ArrayManager::toSqlWhereString($pidList, self::$orTerm, self::$pidTerm);
|
|
$query .= self::$closeBracket;
|
|
} else if ($pidList[0] != "*") {
|
|
return null;
|
|
}
|
|
|
|
if (count($sNameList) > 0 && \utiliy\ArrayManager::validAlphaNumList($sNameList)) {
|
|
if ($query != self::$selectTerm) {
|
|
$query .= self::$andTerm;
|
|
}
|
|
$query .= self::$openBracket;
|
|
$query .= \utiliy\ArrayManager::toSqlWhereString($sNameList, self::$orTerm, self::$sNameTerm);
|
|
$query .= self::$closeBracket;
|
|
}
|
|
|
|
if ($query == self::$selectTerm) {
|
|
$query = self::$selectAllTerm;
|
|
}
|
|
|
|
$query .= self::$orderByTerm;
|
|
|
|
// send query
|
|
return $this->query($query);
|
|
}
|
|
|
|
}
|
|
|
|
?>
|