Exemple #1
0
        public void Append(string connector, string sqlformat, params object[] args)
        {
            if (_first)
            {
                _first = false;
                _commandTexts.Add(_firstConnector);
            }
            else
            {
                _commandTexts.Add(connector);
            }

            if (args == null || args.Length == 0)
            {
                _commandTexts.Add(sqlformat);
                _commandTextsLimit += 2;
                return;
            }
            var r = (FQLResult)FQL.Format(_provider, _argumentStart, sqlformat, args);

            _argumentStart += args.Length;
            _commandTexts.Add(r.CommandText);
            _commandTextsLimit += 2;
            _parameters.AddRange(r.DbParameters);
            _parametersLimit += r.DbParameters.Length;
            if (r._callback != null)
            {
                _callback += r._callback;
            }
        }
Exemple #2
0
 public void HavingOr(string sql, params object[] args)
 {
     if (_having == null)
     {
         _having = FQL.CreateBuilder(_fql, "HAVING");
     }
     _having.Or(sql, args);
 }
Exemple #3
0
 public void GroupBy(string sql, params object[] args)
 {
     if (_group == null)
     {
         _group = FQL.CreateBuilder(_fql, "GROUP BY");
     }
     _group.Concat(sql, args);
 }
Exemple #4
0
 public void OrderBy(string sql, params object[] args)
 {
     if (_order == null)
     {
         _order = FQL.CreateBuilder(_fql, "ORDER BY");
     }
     _order.Concat(sql, args);
 }
Exemple #5
0
 public SqlBuilder(DbTour tour, string sql, object[] args)
     : base(GetDbHelper(tour))
 {
     Assertor.AreNull(sql, "sql");
     if (args == null && sql.Length < 24 && sql.IndexOfAny(new char[] { ' ', '\r', '\n', '\t' }) == -1)
     {
         sql = "SELECT * FROM " + sql;
     }
     _fql   = tour._FQLProvider;
     _where = FQL.Format(_fql, sql, args).AsBuilder("WHERE");
 }
Exemple #6
0
        /// <summary> 设置sql语句和参数,得到执行器
        /// </summary>
        /// <param name="commandText">sql语句</param>
        /// <param name="args">参数</param>
        public DbExecuter Sql(string commandText, params object[] args)
        {
            var fql = FQL.Format(_FQLProvider, commandText, args);

            return(new DbExecuter(_DBHelper, CommandType.Text, fql.CommandText, fql.DbParameters, fql.ImportOutParameter));
        }