Exemplo n.º 1
0
 public SqlExpression Expr(string ex, SqlColumn col) { return new SqlExpressionData(ex, 4) { left = this, right = col }; }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 public SqlExpression Eq(SqlColumn col) { return new SqlExpressionData("=", 5) { left = this, right = col }; }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 public SqlBind Add(SqlColumn col, string name)
 {
     FieldDescriptor desc = _desc.Find(name);
     if (desc == null) throw new KeyNotFoundException(name);
     return Add(col, desc);
 }
Exemplo n.º 6
0
 public SqlBind(SqlColumn col, FieldDescriptor desc) { _column = col; _field = desc; }
Exemplo n.º 7
0
 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));
 }