public override string Evaluate(Table.Row row) { string value = exp.Evaluate(row); bool b = bool.Parse(value); return(!b ? "TRUE" : "FALSE"); }
public override string Evaluate(Table.Row row) { switch (op) { case "=": return((left.Evaluate(row) == right.Evaluate(row)) ? "TRUE" : "FALSE"); case ">": return(double.Parse(left.Evaluate(row)) > double.Parse(right.Evaluate(row)) ? "TRUE" : "FALSE"); case "<": return(double.Parse(left.Evaluate(row)) < double.Parse(right.Evaluate(row)) ? "TRUE" : "FALSE"); } return(base.Evaluate(row)); }
public override Table Operate(Database db) { Table src = source.Value(db); Table.Row row = new Table.Row(); if (fields.Length != exp.Length) { throw new Exception("Missing values for insertion query"); } for (int i = 0; i < Math.Min(fields.Length, exp.Length); i++) { row.values[fields[i]] = (exp[i].Evaluate(row)); } src.rows.Add(row); return(src); }
public override string Evaluate(Table.Row row) { bool l = bool.Parse(left.Evaluate(row)); bool r = bool.Parse(right.Evaluate(row)); bool q; if (or) { q = l || r; } else { q = l && r; } return(q ? "TRUE" : "FALSE"); }
public override Table Value(Database db) { Table l = db.tables[left]; Table r = right.Value(db); List <Table.Column> cols = new List <Table.Column>(); for (int i = 0; i < l.columns.Length; i++) { Table.Column c = new Table.Column(); c.name = "left." + l.columns[i].name; cols.Add(c); } for (int i = 0; i < r.columns.Length; i++) { Table.Column c = new Table.Column(); c.name = "right." + r.columns[i].name; cols.Add(c); } Table j = new Table(cols.ToArray()); foreach (Table.Row row in l.rows) { foreach (Table.Row row2 in r.rows) { Table.Row jr = new Table.Row(); foreach (KeyValuePair <string, string> pair in row.values) { jr.values["left." + pair.Key] = pair.Value; } foreach (KeyValuePair <string, string> pair in row2.values) { jr.values["right." + pair.Key] = pair.Value; } j.rows.Add(jr); } } return(j); }
public override string Evaluate(Table.Row row) { return(row.values[this.row]); }
public override string Evaluate(Table.Row row) { return(value); }
public override string Evaluate(Table.Row row) { return("TRUE"); }
public virtual string Evaluate(Table.Row row) { return("FALSE"); }