Inheritance: IAliasedObject
Ejemplo n.º 1
0
        public override string ToSql (Operator op)
        {
            if (String.IsNullOrEmpty (value)) {
                return null;
            }

            string escaped_value = EscapeString (op, Uri.EscapeUriString (value.ToLower ()));
            if (op == StartsWith) {
                return "file://" + escaped_value;
            }
            return escaped_value;
         }
Ejemplo n.º 2
0
        private void HandleOperatorChanged (object o, EventArgs args)
        {
            if (op_chooser.Active < 0 || op_chooser.Active >= operators.Count) {
                return;
            }

            this.op = operators [op_chooser.Active];
            if (operator_entries [this.op] != current_value_entry) {
                SetValueEntry (operator_entries [this.op]);
            }

            //value_entry = new QueryValueEntry <field.ValueType> ();
        }
Ejemplo n.º 3
0
 public override string ToSql (Operator op)
 {
     return Convert.ToString (value, System.Globalization.CultureInfo.InvariantCulture);
 }
Ejemplo n.º 4
0
 public override string ToSql (Operator op)
 {
     return String.IsNullOrEmpty (value) ? null : EscapeString (op, StringValue);
 }
Ejemplo n.º 5
0
 public override string ToSql (Operator op)
 {
     return null;
 }
Ejemplo n.º 6
0
 public abstract string ToSql(Operator op);
 public override string ToSql (Operator op)
 {
     return DateTimeUtil.FromDateTime (DateTime.Now + TimeSpan.FromSeconds ((double) offset)).ToString (System.Globalization.CultureInfo.InvariantCulture);
 }
Ejemplo n.º 8
0
 public override string ToSql (Operator op)
 {
     if (op == GreaterThan) {
         return DateTimeUtil.FromDateTime (value.AddDays (1.0)).ToString (System.Globalization.CultureInfo.InvariantCulture);
     } else {
         return DateTimeUtil.FromDateTime (value).ToString (System.Globalization.CultureInfo.InvariantCulture);
     }
 }
Ejemplo n.º 9
0
        public string ToSql (Operator op, QueryValue qv)
        {
            string value = qv.ToSql (op) ?? String.Empty;

            if (op == null) op = qv.OperatorSet.First;

            StringBuilder sb = new StringBuilder ();

            if (no_custom_format) {
                string column_with_key = Column;
                if (qv is StringQueryValue && !(column_lowered || qv is ExactStringQueryValue)) {
                    column_with_key = String.Format ("HYENA_SEARCH_KEY({0})", Column);
                }
                sb.AppendFormat ("{0} {1}", column_with_key, String.Format (op.SqlFormat, value));

                if (op.IsNot) {
                    return String.Format ("({0} IS NULL OR {1})", Column, sb.ToString ());
                } else {
                    return String.Format ("({0} IS NOT NULL AND {1})", Column, sb.ToString ());
                }
            } else {
                sb.AppendFormat (
                    Column, String.Format (op.SqlFormat, value),
                    value, op.IsNot ? "NOT" : null
                );
            }

            return sb.ToString ();
        }
 public override string ToSql(Operator op)
 {
     return(DateTimeUtil.FromDateTime(DateTime.Now + TimeSpan.FromSeconds((double)offset)).ToString(System.Globalization.CultureInfo.InvariantCulture));
 }
Ejemplo n.º 11
0
        protected static string EscapeString (Operator op, string orig)
        {
            orig = orig.Replace ("'", "''");

            if (op == Contains   || op == DoesNotContain ||
                op == StartsWith || op == EndsWith) {
                return orig.Replace ("\\", "\\\\")
                           .Replace ("%", "\\%")
                           .Replace ("_", "\\_");
            }
            
            return orig;
        }
Ejemplo n.º 12
0
 public override string ToSql (Operator op)
 {
     return String.IsNullOrEmpty (value) ? null : EscapeString (op, Hyena.StringUtil.SearchKey (value));
 }
Ejemplo n.º 13
0
        protected static string EscapeString (Operator op, string orig)
        {
            orig = orig.Replace ("'", "''");

            if (op == Contains   || op == DoesNotContain ||
                op == StartsWith || op == EndsWith) {
                return StringUtil.EscapeLike (orig);
            }

            return orig;
        }