add pss #62
This commit is contained in:
@@ -42,7 +42,7 @@ class PisSqlManager extends SQLManager {
|
||||
* String for the orderby part of the query
|
||||
* @var string
|
||||
*/
|
||||
private $orderByTerm = " ORDER BY pid";
|
||||
private $orderByTerm = " ORDER BY pid, iName";
|
||||
|
||||
/**
|
||||
* String for the pid part of the query
|
||||
@@ -73,44 +73,15 @@ class PisSqlManager extends SQLManager {
|
||||
|
||||
// build query string
|
||||
$query = $this->selectTerm;
|
||||
if ($this->validPidList($queryArgs)) {
|
||||
$query .= $this->createPidWhereString($queryArgs) . $this->orderByTerm;
|
||||
if (\utiliy\ArrayManager::validIntList($queryArgs)) {
|
||||
$query .= \utiliy\ArrayManager::toSqlWhereString($queryArgs, $this->orTerm, $this->pidTerm) . $this->orderByTerm;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
// send query
|
||||
return $this->query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method check if all items of the pidlist are orly digits
|
||||
* @param array $poly
|
||||
* @return boolean
|
||||
*/
|
||||
private function validPidList($pidList) {
|
||||
foreach ($pidList as $value) {
|
||||
|
||||
if (!ctype_digit($value) || PHP_INT_MAX < $value) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method convert a pidList to a where-string
|
||||
* @param array $pidList
|
||||
* @return string
|
||||
*/
|
||||
private function createPidWhereString($pidList) {
|
||||
$pidListStr = \utiliy\StringManager::$emptyString;
|
||||
foreach ($pidList as $value) {
|
||||
$pidListStr .= $this->pidTerm . $value . $this->orTerm;
|
||||
}
|
||||
$result = substr($pidListStr, 0, strlen($pidListStr) - strlen($this->orTerm));
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user