static string GetUpdateSql(AnyDbConnection cnn, Update query)
        {
            ISqlOmRenderer renderer = Qb.CreateRenderer(cnn.DatabaseProvider);
            string         sql      = renderer.RenderUpdate(query);

            return(sql);
        }
        static string GetInsertSelectSql(AnyDbConnection cnn, InsertSelect query)
        {
            ISqlOmRenderer renderer = Qb.CreateRenderer(cnn.DatabaseProvider);
            string         sql      = renderer.RenderInsertSelect(query);

            return(sql);
        }
Beispiel #3
0
        public object ExecuteScalar(Select query)
        {
            ISqlOmRenderer render = Qb.CreateRenderer(_anyConnection.DatabaseProvider);

            _dbCommand.CommandText = render.RenderSelect(query);
            _dbCommand.CommandType = CommandType.Text;
            FillParameters(_dbCommand, query.Query.CommandParams, render);
            return(ExecuteScalar());
        }
Beispiel #4
0
        public int ExecuteNonQuery(Update query)
        {
            ISqlOmRenderer render = Qb.CreateRenderer(_anyConnection.DatabaseProvider);

            _dbCommand.CommandText = render.RenderUpdate(query);
            _dbCommand.CommandType = CommandType.Text;
            FillParameters(_dbCommand, query.Query.CommandParams, render);
            return(ExecuteNonQuery());
        }
Beispiel #5
0
        public DbDataReader ExecuteReader(Select query, CommandBehavior behavior)
        {
            ISqlOmRenderer render = Qb.CreateRenderer(_anyConnection.DatabaseProvider);

            _dbCommand.CommandText = render.RenderSelect(query);
            _dbCommand.CommandType = CommandType.Text;
            FillParameters(_dbCommand, query.Query.CommandParams, render);
            return(ExecuteReader(behavior));
        }
Beispiel #6
0
        public long ExecuteNonQuery(Insert query)
        {
            ISqlOmRenderer render = Qb.CreateRenderer(_anyConnection.DatabaseProvider);

            _dbCommand.CommandText = render.RenderInsert(query);
            _dbCommand.CommandType = CommandType.Text;
            FillParameters(_dbCommand, query.Query.CommandParams, render);
            if (!string.IsNullOrEmpty(query.Query.IdentityField))
            {
                return(Convert.ToInt64(ExecuteScalar()));
            }
            return(ExecuteNonQuery());
        }
Beispiel #7
0
        public int ExecuteNonQuery(Delete query)
        {
            ISqlOmRenderer render = Qb.CreateRenderer(_anyConnection.DatabaseProvider);

            _dbCommand.CommandText = render.RenderDelete(query);
            _dbCommand.CommandType = CommandType.Text;
            FillParameters(_dbCommand, query.Query.CommandParams, render);

            using (SqlStopwatch sw = new SqlStopwatch(this))
            {
                return(ExecuteNonQuery());
            }
        }
        public string GetSql(Update query)
        {
            ISqlOmRenderer renderer = Qb.CreateRenderer(AnyDbSetting.DatabaseProvider);

            return(renderer.RenderUpdate(query));
        }
        public string GetSql(InsertSelect query)
        {
            ISqlOmRenderer renderer = Qb.CreateRenderer(AnyDbSetting.DatabaseProvider);

            return(renderer.RenderInsertSelect(query));
        }