Ejemplo n.º 1
0
        public override string GetSQLString(ISQL.DBType type)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("delete from ");
            sb.Append(tables.GetSQLString(type));
            sb.Append(where.GetSQLString(type));
            return(SQLUtils.RemoveMultiBlank(sb.ToString()));
        }
Ejemplo n.º 2
0
        public override string GetSQLString(ISQL.DBType type)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("update ");
            sb.Append(tables.GetSQLString(type));
            sb.Append(" set ");
            sb.Append(fieldValues.GetSQLString(type));
            sb.Append(where.GetSQLString(type));
            return(SQLUtils.RemoveMultiBlank(sb.ToString().Trim()));
        }
Ejemplo n.º 3
0
        public override string GetSQLString(ISQL.DBType type)
        {
            if (!StringUtil.IsNullOrEmpty(this.sql))
            {
                return(this.sql);
            }
            string field = fields.Size() == 0 ? "*" : fields.GetSQLString(type);
            string sql   = string.Empty;

            if (type == ISQL.DBType.mysql || limit == null || (limit.GetCount() == 0 && limit.GetStart() == 0))
            {
                sql = "select " + field + " from " + tables.GetSQLString(type) + where.GetSQLString(type) + groupBy.GetSQLString(type) + orderBy.GetSQLString(type) + limit.GetSQLString(type);
            }
            else
            {
                WhereSQL w1 = where.Clone();
                w1.AddCondition(new SQLCondition("rownum", (limit.GetStart() + limit.GetCount() + 1).ToString(), "<", true));
                WhereSQL w2 = where.Clone();
                w2.AddCondition(new SQLCondition("rownum", (limit.GetStart() + 1).ToString(), "<", true));
                sql = "SELECT * FROM ( SELECT A.*, ROWNUM RNNNNNN FROM (SELECT " + field + " FROM " + tables.GetSQLString(type) + where.GetSQLString(type) + groupBy.GetSQLString(type) + orderBy.GetSQLString(type) + ") A WHERE ROWNUM <= " + (limit.GetStart()
                                                                                                                                                                                                                                                 + limit.GetCount()) + " ) WHERE RNNNNNN >= " + (limit.GetStart() + 1);
            }
            return(SQLUtils.RemoveMultiBlank(sql.Trim()).Trim());
        }