This commit is contained in:
stubbfel
2013-07-10 11:34:07 +02:00
parent 5c11441ef5
commit fe6e6eaaf4
7 changed files with 163 additions and 67 deletions

View File

@@ -3,7 +3,7 @@
namespace database;
include_once "../../global.inc.php";
include_once PATH_UTILITTY . "/StringManager.php";
include_once PATH_UTILITTY . "/ArrayManager.php";
require_once PATH_DATABASE . "/SqlManager.php";
/**
@@ -50,6 +50,12 @@ class PisSqlManager extends SQLManager {
*/
private static $pidTerm = "pid = ";
/**
* String for the iName part of the query
* @var string
*/
private static $iNameTerm = "iName = ";
/**
* Default-Constructor
*/
@@ -69,19 +75,31 @@ class PisSqlManager extends SQLManager {
* @param array $queryArgs
* @return array [num][assoc]
*/
public function sendPisQuery($queryArgs) {
public function sendPisQuery($pidList, $iNameList) {
// build query string
$query = self::$selectTerm;
if (\utiliy\ArrayManager::validIntList($queryArgs)) {
$query .= \utiliy\ArrayManager::toSqlWhereString($queryArgs, self::$orTerm, self::$pidTerm) . self::$orderByTerm;
if (\utiliy\ArrayManager::validIntList($pidList)) {
$query .= self::$openBracket;
$query .= \utiliy\ArrayManager::toSqlWhereString($pidList, self::$orTerm, self::$pidTerm);
$query .= self::$closeBracket;
} else {
return null;
}
if (count($iNameList) > 0 && \utiliy\ArrayManager::validAlphaNumList($iNameList)) {
$query .= self::$andTerm;
$query .= self::$openBracket;
$query .= \utiliy\ArrayManager::toSqlWhereString($iNameList, self::$orTerm, self::$iNameTerm);
$query .= self::$closeBracket;
}
$query .= self::$orderByTerm;
// send query
return $this->query($query);
}
}
?>