add BETWEEN support
This commit is contained in:
12
inc/db.php
12
inc/db.php
@@ -504,8 +504,16 @@ class Db extends PhpObject
|
||||
{
|
||||
if(is_array($asConstraints))
|
||||
{
|
||||
$asSelection[$sField] = "(".implode(', ', $asConstraints).")";
|
||||
$asInfo['constOpe'][$sField] = " IN ";
|
||||
if(array_key_exists($sField, $asInfo['constOpe']) && $asInfo['constOpe'][$sField]=='BETWEEN') {
|
||||
//Between
|
||||
$asSelection[$sField] = $asConstraints['from'].' AND '.$asConstraints['to'];
|
||||
$asInfo['constOpe'][$sField] = " BETWEEN ";
|
||||
}
|
||||
else {
|
||||
//Multiple values (IN)
|
||||
$asSelection[$sField] = "(".implode(', ', $asConstraints).")";
|
||||
$asInfo['constOpe'][$sField] = " IN ";
|
||||
}
|
||||
}
|
||||
elseif(!array_key_exists('constOpe', $asInfo) || !array_key_exists($sField, $asInfo['constOpe'])) $asInfo['constOpe'][$sField] = " = ";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user