public SqlExpression Expr(string ex, SqlColumn col) { return new SqlExpressionData(ex, 4) { left = this, right = col }; }
protected virtual Sql.Builder Output(Sql.Builder sb) { string s = SQL; char quot = sb.Context.GetMarker(false); SqlColumn scds = null; int bp = 0, cp = 1; while (cp < s.Length) { char ch = s[cp]; switch (ch) { case '#': sb.Append(s, bp, cp - 1); for (ch = s[cp - 1], bp = ++cp; cp < s.Length; cp++) if (s[cp] == '#') break; if (cp == s.Length) throw new NotSupportedException("incomplete markup section"); int np = bp; while (s[np] <= ' ') np++; //bp = ++cp; int ep = np, xp = cp; while (ep < cp) if (s[ep] != ':') ep++; else { xp = ep + 1; break; } while (s[xp] <= ' ') xp++; while (ep > np && s[ep - 1] <= ' ') ep--; string pname = ep > np ? s.Substring(np, ep - np) : null; ep = cp; while (ep > np && s[ep - 1] <= ' ') ep--; string opts = ep > xp ? s.Substring(xp, ep - xp) : null; if (scds == null) scds = new SqlColumn(); scds.Parse(opts); sb.AppendParam(pname, scds); bp = ++cp; continue; case '-': // singleline comment if (++cp == s.Length || s[cp] != '-') break; while (++cp < s.Length) if (s[cp] == '\n') { cp += 2; break; } continue; case '/': // muiltiline comment, may contain useful info, like hints if (++cp == s.Length || s[cp] != '*') break; while (++cp < s.Length) if (s[cp] == '*' && (cp + 1 < s.Length) && s[cp + 1] == '/') { cp += 2; break; } continue; default: if (ch != quot) break; while (++cp < s.Length && s[cp] != quot) ; break; } cp++; } sb.Append(s, bp, cp); return sb; }
public SqlExpression Eq(SqlColumn col) { return new SqlExpressionData("=", 5) { left = this, right = col }; }
public SqlBind Add(SqlColumn col, FieldDescriptor desc) { SqlBind bind = new SqlBind(col, desc); if (_last == null) _list = bind; else _last.Next = bind; return _last = bind; }
public SqlBind Add(SqlColumn col, string name) { FieldDescriptor desc = _desc.Find(name); if (desc == null) throw new KeyNotFoundException(name); return Add(col, desc); }
public SqlBind(SqlColumn col, FieldDescriptor desc) { _column = col; _field = desc; }
public virtual void AppendParam(string name, SqlColumn sc) { // match parameter marker to message field. var ds = desc.Find(name); if (ds == null) if (!desc.IsBoxType) { errors.Add(new SqlError("param name not found")); return; } else ds = desc.Fields[0]; //AppendParam(new SqlBind(sc, ds)); }