Add constraint operation to selectValue

This commit is contained in:
2024-09-07 22:00:26 +02:00
parent 0f07724585
commit bcae723140

View File

@@ -655,12 +655,12 @@ class Db extends PhpObject
}
}
public function selectRow($sTableName, $asConstraints=array(), $sColumnName='*')
public function selectRow($sTableName, $asConstraints=array(), $sColumnName='*', $asConstOpe=[])
{
//Table ID directly
if(!is_array($asConstraints)) $asConstraints = array($this->getId($sTableName)=>$asConstraints);
$asRows = $this->selectRows(array('select'=>$sColumnName, 'from'=>$sTableName, 'constraint'=>$asConstraints));
$asRows = $this->selectRows(array('select'=>$sColumnName, 'from'=>$sTableName, 'constraint'=>$asConstraints, 'constOpe'=>$asConstOpe));
$iCountNb = count($asRows);
switch($iCountNb)
{
@@ -691,13 +691,13 @@ class Db extends PhpObject
);
}
public function selectValue($sTableName, $sColumnName, $oConstraints=array())
public function selectValue($sTableName, $sColumnName, $oConstraints=array(), $asConstOpe=[])
{
if(!is_array($oConstraints))
{
$oConstraints = array($this->getId($sTableName)=>$oConstraints);
}
$oResult = $this->selectRow($sTableName, $oConstraints, $sColumnName);
$oResult = $this->selectRow($sTableName, $oConstraints, $sColumnName, $asConstOpe);
return empty($oResult)?false:$oResult;
}