Esempio n. 1
0
        protected virtual string GetDeleteSql(OrlQuery query)
        {
            StringBuilder buf = new StringBuilder("delete from ");

            if (schema != null && schema.Length > 0)
            {
                buf.Append(schema).Append(".");
            }
            buf.Append(name);
            if (query != null)
            {
                buf.Append(" ").Append(query.GetSql(this));
            }
            //buf.Append(";");
            return(buf.ToString());
        }
 public virtual string GetSql(OrlTable table, ref int offset)
 {
     if (HasQuery)
     {
         string sql = query.GetSql(table, ref offset);
         return(string.Format("({0})", sql));
     }
     else
     {
         index  = offset;
         offset = offset + 1;
         string name = table.Translate(column);
         if (name == null || name.Length == 0)
         {
             //name = column;
             throw new LightException(string.Format("column {0} not found in table {1}", column, table.Name));
         }
         return(string.Format("[{0}]{1}:{2}", name, oper, index));
     }
 }
Esempio n. 3
0
 protected virtual string GetSelectSql(OrlQuery query)
 {
     if (selectSQL == null)
     {
         StringBuilder buf   = new StringBuilder("select ");
         bool          comma = false;
         foreach (SqlColumn column in columns)
         {
             if (comma)
             {
                 buf.Append(",");
             }
             else
             {
                 comma = true;
             }
             buf.Append(column.Name);
         }
         buf.Append(" from ");
         if (schema != null && schema.Length > 0)
         {
             buf.Append(schema).Append(".");
         }
         buf.Append(name);
         selectSQL = buf.ToString();
     }
     if (query != null)
     {
         StringBuilder buf = new StringBuilder(selectSQL);
         buf.Append(" ").Append(query.GetSql(this));
         //buf.Append(";");
         return(buf.ToString());
     }
     else
     {
         return(string.Format("{0};", selectSQL));
     }
 }
Esempio n. 4
0
 protected virtual string GetSelectSql(OrlQuery query)
 {
     if (selectSQL == null)
     {
         StringBuilder buf = new StringBuilder("select ");
         bool comma = false;
         foreach (SqlColumn column in columns)
         {
             if (comma)
                 buf.Append(",");
             else
                 comma = true;
             buf.Append(column.Name);
         }
         buf.Append(" from ");
         if (schema != null && schema.Length > 0)
             buf.Append(schema).Append(".");
         buf.Append(name);
         selectSQL = buf.ToString();
     }
     if (query != null)
     {
         StringBuilder buf = new StringBuilder(selectSQL);
         buf.Append(" ").Append(query.GetSql(this));
         //buf.Append(";");
         return buf.ToString();
     }
     else
         return string.Format("{0};", selectSQL);
 }
Esempio n. 5
0
 protected virtual string GetDeleteSql(OrlQuery query)
 {
     StringBuilder buf = new StringBuilder("delete from ");
     if (schema != null && schema.Length > 0)
         buf.Append(schema).Append(".");
     buf.Append(name);
     if (query != null)
         buf.Append(" ").Append(query.GetSql(this));
     //buf.Append(";");
     return buf.ToString();
 }