Set the query where between clause
@param $name
@param $first_value
@param $last_value
@return $this
165534
public function whereBetween($name, $first_value, $last_value = null)
    {

        if (is_array($first_value) && count($first_value) == 2) {
            $last_value = $first_value[1];
            $first_value = $first_value[0];
        }

        $this->filter[] = ["range" => [$name => ["gte" => $first_value, "lte" => $last_value]]];

        return $this;
    }
1043740
public static function sequenceNextVal($name)
    {
        $sql = null;

        switch (Driver::$name) {
        case "oracle":
            $sql = "select $name.nextval from dual";
            break;
        case "postgresql":
            $sql = "select nextval('$name') as nextval";
            break;
        }

        if ($sql == null) {
            return null;
        }

        $stmt = self::executePrepared($sql);
        $data = $stmt->fetch(\PDO::FETCH_ASSOC);
        $rtn  = null;

        if (!$data) {
            return null;
        }

        $seq_keys = array("nextval", "NEXTVAL");
        foreach ($seq_keys as $seq_key) {
            if (array_key_exists($seq_key, $data)) {
                $rtn = $data[$seq_key];
                break;
            }
        }
        return $rtn;
    }
282096
public function setNameLast($name_last){
        if(!$this->setModified('name_last', $name_last)->isModified()) {
            return $this;
        }
        $this->name_last = $name_last;

        return $this;
    }
350707
public function range($val, $lower, $upper, $id, $name = null) {
        if ($val < $lower || $val > $upper) {
            if (is_null($name))
                $name = ucwords($id);
            $this->add($id, "$name must be between $lower and $upper.");
            return false;
        }

        return true;
    }
1058150
public function bindWhere()
    {
        if (count($this->wheresBindValue) > 0) {
            foreach ($this->wheresBindValue as $value) {
                $bindDataType = $this->bindDataType($value[2]);
                $this->sqlQuery->bindValue($this->positioningMarker, $value[2], $bindDataType);

                $this->positioningMarker++;
            }
        }

        return $this;
    }
630507
public function add($name, $value = null, $where = '')
    {
        if (!$this->has($name)) {
            $this->set($name, $value, $where);
        }

        return $this;
    }
462010
private function applyNestedOrder($relation_name, Builder $query, $relation_field, $value)
    {
        $that = $this;
        return $query->orderBy($relation_name, function ($query) use ($relation_field, $value, $that) {
            $query = $that->applyOrderByClause($query, $relation_field, $value);
        });
    }
160097
public function orWhereNotBetween($column, array $between): BaseQueryRelateContract
    {
        $this->query->orWhereNotBetween($column, $between);

        return $this;
    }
69542
public function getFromWhere($from, $where=NULL, $where_values=array(), $order=NULL, $limit=NULL, $offset=NULL){
        $res= FALSE;
        try{
            //Armo partes de la consulta
            if($order != NULL){$order= " ORDER BY " . $order;}
            if($limit != NULL){
                $limit= " LIMIT " . $limit;
                if($offset != NULL){$limit.= ' OFFSET ' . $offset;}
            }
            //Armo y preparo la consulta
            $query= $this->prepareSelect($this->select, $from, $where, '', '', $order, $limit);
            //Ejecuto la consulta
            $query->execute($where_values);
            //Controlo que este todo bien
            if($this->isOk($query)){
                $res= $query;
            }
            //Limpio las variables del AR
            $this->cleanVars();
        } catch (\PDOException $e) {
            $this->cleanVars();
            throw $e;
        }
        return $res;
    }
548368
private function between($method, $column, $a, $b, $filter)
    {
        if (!$this->queryBuilder->isFilterable($filter, array($a, $b))) {
            return $this;
        }

        if ($a instanceof RawSqlFragmentInterface) {
            $x = $a->getFragment();
        }

        if ($b instanceof RawSqlFragmentInterface) {
            $y = $b->getFragment();
        }

        // When doing betweens, unique placeholders come in handy
        if (!isset($x)) {
            $x = $this->getUniqPlaceholder();
        }

        if (!isset($y)) {
            $y = $this->getUniqPlaceholder();
        }

        // Prepare query string
        call_user_func(array($this->queryBuilder, $method), $column, $x, $y, $filter);

        // And finally bind values
        if (!($a instanceof RawSqlFragmentInterface)) {
            $this->bind($x, $a);
        }

        if (!($b instanceof RawSqlFragmentInterface)) {
            $this->bind($y, $b);
        }

        return $this;
    }
92139
public function setFirstResult($firstResult)
    {
        $this->_firstResult = $firstResult;
        $this->_state       = self::STATE_DIRTY;

        return $this;
    }
884885
public function where($where, $value = null)
    {
        $nArgs = func_num_args();
        if( $nArgs >= 2 ) {
            $this->where[] = array($where, $value);
        } else if( $nArgs >= 1 ) {
            $this->where[] = array($where);
        }
        return $this;
    }
1006729
public function whereIn($name, $value = [])
    {

        if (is_callback_function($name)) {
            $name($this);
            return $this;
        }

        $this->filter[] = ["terms" => [$name => $value]];

        return $this;
    }
759298
public function query($query_with_placeholders, $named_parameters = []) {
            Event::dispatch(EventData::forBefore(Event::BEFORE_QUERY, '', $named_parameters, $query_with_placeholders), $named_parameters);
            try {
                $stmt = $this->prepareStatement($query_with_placeholders, $named_parameters);
                $stmt->execute();
            } catch (Exception $ex) {
                Event::dispatch(EventData::forException($ex, $query_with_placeholders, $named_parameters));
                throw new QueryException($ex->getMessage(), $ex->getCode(), $ex);
            }

            Event::dispatch(EventData::forAfter(Event::AFTER_QUERY, null, $named_parameters, $query_with_placeholders, $stmt->rowCount()));

            return $this->fetch($stmt);
        }
1214688
protected function num_between($name, $value, $param){
        //Si no se completo no se valida
        if(! $this->isComplete($value)){
            return TRUE;
        }
        $params= explode('&', $param);
        $min= $params[0];
        $max= $params[1];
        if(is_numeric($value)){
            if($value >= $min && $value <= $max){
                return TRUE;
            }else{
                $this->add_message($name, 'num_between', array('min' => $min, 'max' => $max));
                return FALSE;
            }
        }else{
            $this->add_message($name, 'is_integer');
            return FALSE;
        }
    }
1264111
public static function setDefault($name, $value = null, $range = null)
    {
        return static::set($name, $value, $range, false);
    }
1371909
public function set($name, $value, $expires = null)
    {
        $name = $this->getFullName($name);

        if (!is_array($value)) {
            $value = ['value' => (string) $value];
        }

        if (isset($expires)) {
            $value['expires'] = $expires;
        }

        parent::set($name, $value);

        return $this;
    }