Adding to SP3 : fixing images and others
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user