Example #1
0
        /**
         * Compile a "between" where clause.
         *
         * @param  \Illuminate\Database\Query\Builder  $query
         * @param  array  $where
         * @return string
         */
        protected virtual string whereBetween(Builder query, WhereOptions where)
        {
            string between = where.not ? "not between" : "between";
            string str     = this.wrap(where.column) + " " + between + " ? and ?";

            return(this.wrap(where.column) + " " + between + " ? and ?");
        }
Example #2
0
        /**
         * Compile a "where not in" clause.
         *
         * @param  \Illuminate\Database\Query\Builder  $query
         * @param  array  $where
         * @return string
         */

        protected virtual string whereNotIn(Builder query, WhereOptions where)
        {
            if (where.values.Length == 0)
            {
                return("1 = 1");
            }
            string values = this.parameterize(where.values);

            return(this.wrap(where.column) + " not in (" + values + ")");
        }
Example #3
0
 public static WhereToken Create(WhereOperator op, string fieldName, string parameterName, WhereOptions options = null)
 {
     return(new WhereToken
     {
         FieldName = fieldName,
         ParameterName = parameterName,
         WhereOperator = op,
         Options = options ?? WhereOptions.Default()
     });
 }
Example #4
0
        /**
         * Compile a "where date" clause.
         *
         * @param  \Illuminate\Database\Query\Builder  $query
         * @param  array  $where
         * @return string
         */
        protected override string whereDate(Builder query, WhereOptions where)
        {
            string value = this.parameter(where.value);

            return("cast(" + this.wrap(where.column) + " as date) " + where.operator1 + " " + value);
        }
Example #5
0
 /**
  * Compile a raw where clause.
  *
  * @param  \Illuminate\Database\Query\Builder  $query
  * @param  array  $where
  * @return string
  */
 protected virtual string whereRaw(Builder query, WhereOptions where)
 {
     return(where.sql);
 }
Example #6
0
        /**
         * Compile a date based where clause.
         *
         * @param  string  $type
         * @param  \Illuminate\Database\Query\Builder  $query
         * @param  array  $where
         * @return string
         */
        protected virtual string dateBasedWhere(string type, Builder query, WhereOptions where)
        {
            string value = this.parameter(where.value);

            return(type + "(" + this.wrap(where.column) + ") " + where.operator1 + " " + value);
        }
Example #7
0
 /**
  * Compile a "where year" clause.
  *
  * @param  \Illuminate\Database\Query\Builder  $query
  * @param  array  $where
  * @return string
  */
 protected virtual string whereYear(Builder query, WhereOptions where)
 {
     return(this.dateBasedWhere("year", query, where));
 }
Example #8
0
 /**
  * Compile a "where month" clause.
  *
  * @param  \Illuminate\Database\Query\Builder  $query
  * @param  array  $where
  * @return string
  */
 protected virtual string whereMonth(Builder query, WhereOptions where)
 {
     return(this.dateBasedWhere("month", query, where));
 }
Example #9
0
 /**
  * Compile a "where day" clause.
  *
  * @param  \Illuminate\Database\Query\Builder  $query
  * @param  array  $where
  * @return string
  */
 protected virtual string whereDay(Builder query, WhereOptions where)
 {
     return(this.dateBasedWhere("day", query, where));
 }
Example #10
0
 /**
  * Compile a "where not null" clause.
  *
  * @param  \Illuminate\Database\Query\Builder  $query
  * @param  array  $where
  * @return string
  */
 protected virtual string whereNotNull(Builder query, WhereOptions where)
 {
     return(this.wrap(where.column) + " is not null");
 }
Example #11
0
        /**
         * Compile a where not in sub-select clause.
         *
         * @param  \Illuminate\Database\Query\Builder  $query
         * @param  array  $where
         * @return string
         */
        protected virtual string whereNotInSub(Builder query, WhereOptions where)
        {
            string select = this.compileSelect(where.query);

            return(this.wrap(where.column) + " not in (" + select + ")");
        }
Example #12
0
 /**
  * Compile a where exists clause.
  *
  * @param  \Illuminate\Database\Query\Builder  $query
  * @param  array  $where
  * @return string
  */
 protected virtual string whereNotExists(Builder query, WhereOptions where)
 {
     return("not exists (" + this.compileSelect(where.query) + ")");
 }
Example #13
0
        /**
         * Compile a basic where clause.
         *
         * @param  \Illuminate\Database\Query\Builder  $query
         * @param  array  $where
         * @return string
         */
        protected virtual string whereBasic(Builder query, WhereOptions where)
        {
            string value = this.parameter(where.value);

            return(this.wrap(where.column) + " " + where.operator1 + " " + value);
        }
Example #14
0
        /**
         * Compile a where condition with a sub-select.
         *
         * @param  \Illuminate\Database\Query\Builder $query
         * @param  array   $where
         * @return string
         */
        protected virtual string whereSub(Builder query, WhereOptions where)
        {
            string select = this.compileSelect(where.query);

            return(this.wrap(where.column) + " " + where.operator1 + " (" + select + ")");
        }
Example #15
0
        /**
         * Compile a nested where clause.
         *
         * @param  \Illuminate\Database\Query\Builder  $query
         * @param  array  $where
         * @return string
         */
        protected virtual string whereNested(Builder query, WhereOptions where)
        {
            Builder nested = where.query;

            return("(" + this.compileWheres(nested).Substring(6) + ")");
        }