Adding to SP3 : fixing images and others

This commit is contained in:
2014-11-30 17:24:49 +01:00
parent b6ebf33a02
commit c1f4308089
9 changed files with 159 additions and 115 deletions

View File

@@ -516,21 +516,22 @@ class MySqlManager extends PhpObject
public function selectRow($sTableName, $asConstraints=array(), $sColumnName='*')
{
if(!is_array($asConstraints))
{
$asConstraints = array($this->getId($sTableName)=>$asConstraints);
}
$asResult = $this->selectRows(array('select'=>$sColumnName, 'from'=>$sTableName, 'constraint'=>$asConstraints));
$iCountNb = count($asResult);
//Table ID directly
if(!is_array($asConstraints)) $asConstraints = array($this->getId($sTableName)=>$asConstraints);
$asRows = $this->selectRows(array('select'=>$sColumnName, 'from'=>$sTableName, 'constraint'=>$asConstraints));
$iCountNb = count($asRows);
switch($iCountNb)
{
case 0 :
return false;
$asResult = array();
break;
case $iCountNb > 1 :
$this->addError('Trop de résultats pour un selectRow() : '.$iCountNb.' lignes. Table: '.$sTableName.', contrainte: '.self::implodeAll($asConstraints, '=', ' ').', colonne: '.$sColumnName);
break;
default:
$asResult = array_shift($asRows);
}
return array_shift($asResult);
return $asResult;
}
public function selectValue($sTableName, $sColumnName, $oConstraints=array())