Commit 1e6226045540dd17d83cdde8e9adc11092078e73

Authored by Neil Blakey-Milner
1 parent ee2f738e

Allow for the field name to the different from the dictionary key (in

case you need multiple constraints on a single key).

Add a 'between' constraint type, taking a lower and upper end for a SQL
BETWEEN clause.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5364 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 6 additions and 0 deletions
lib/ktentity.inc
... ... @@ -778,6 +778,11 @@ class KTEntityUtil {
778 778 return array("$sField < ?", array($aParam));
779 779 }
780 780  
  781 + function _getBy_between($sField, $aValue) {
  782 + $aParam = $aValue['value'];
  783 + return array("$sField BETWEEN ? AND ?", $aParam);
  784 + }
  785 +
781 786 function &getBy($sClassName, $aField, $mValue, $aOptions = null) {
782 787 $bMulti = KTUtil::arrayGet($aOptions, 'multi', false);
783 788 if ($bMulti) {
... ... @@ -797,6 +802,7 @@ class KTEntityUtil {
797 802 if (!is_array($mThisValue)) {
798 803 $mThisValue = array('type' => 'equals', 'value' => $mThisValue);
799 804 }
  805 + $sField = KTUtil::arrayGet($mThisValue, 'field', $sField);
800 806  
801 807 $sType = KTUtil::arrayGet($mThisValue, 'type');
802 808 if (empty($sType)) {
... ...