예제 #1
0
        /// <summary>
        /// 实例化 <see cref="MappingCommand"/> 类的新实例
        /// </summary>
        /// <param name="provider">数据查询提供者</param>
        /// <param name="aliases">别名</param>
        /// <param name="token">解析上下文参数</param>
        public MappingCommand(IDbQueryProvider provider, TableAliasCache aliases, ResolveToken token)
            : base(string.Empty, token != null ? token.Parameters : null, System.Data.CommandType.Text)
        {
            _provider   = provider;
            _aliases    = aliases;
            _navMembers = new Dictionary <string, MemberExpression>();

            _joinFragment  = provider.CreateSqlBuilder(token);
            _whereFragment = provider.CreateSqlBuilder(token);
        }
예제 #2
0
        /// <summary>
        /// 实例化 <see cref="SelectCommand"/> 类的新实例
        /// </summary>
        /// <param name="provider">数据查询提供者</param>
        /// <param name="aliases">别名</param>
        /// <param name="token">解析上下文参数</param>
        public SelectCommand(IDbQueryProvider provider, TableAliasCache aliases, ParserToken token)
            : base(string.Empty, null, System.Data.CommandType.Text)
        {
            _provider   = provider;
            _aliases    = aliases;
            _navMembers = new Dictionary <string, MemberExpression>();

            _joinFragment  = provider.CreateSqlBuilder(token);
            _whereFragment = provider.CreateSqlBuilder(token);
        }
예제 #3
0
        /// <summary>
        /// 实例化 <see cref="DbCommandDefinition_Select"/> 类的新实例
        /// </summary>
        /// <param name="provider">数据查询提供者</param>
        /// <param name="aliases">别名</param>
        /// <param name="parameters">已存在的参数列表</param>
        public DbCommandDefinition_Select(IDbQueryProvider provider, TableAliasCache aliases, List <IDbDataParameter> parameters)
            : base(string.Empty, null, System.Data.CommandType.Text)
        {
            _provider   = provider;
            _aliases    = aliases;
            _navMembers = new Dictionary <string, MemberExpression>();

            _joinFragment  = provider.CreateSqlBuilder(parameters);
            _whereFragment = provider.CreateSqlBuilder(parameters);
        }
예제 #4
0
 /// <summary>
 /// 实例化 <see cref="Builder" /> 的新实例
 /// </summary>
 public OracleSelectInfoCommand(IDbQueryProvider provider, TableAliasCache aliases, ParserToken token)
     : base(provider, aliases, token)
 {
     _provider = provider;
     _aliases  = aliases;
     _onPhrase = _provider.CreateSqlBuilder(token);
 }
 /// <summary>
 /// 实例化 <see cref="Builder" /> 的新实例
 /// </summary>
 public OracleDeleteDbCommandDefinition(IDbQueryProvider provider, TableAliasCache aliases, List <IDbDataParameter> parameters)
     : base(provider, aliases, parameters)
 {
     _provider = provider;
     _aliases  = aliases;
     _onPhrase = _provider.CreateSqlBuilder(parameters);
 }
        /// <summary>
        /// 实例化 <see cref="Builder" /> 的新实例
        /// </summary>
        public NpgDeleteDbCommandDefinition(IDbQueryProvider provider, TableAliasCache aliases, NpgCommandType operationType, List <IDbDataParameter> parameters)
            : base(provider, aliases, parameters)
        {
            _provider      = provider;
            _aliases       = aliases;
            _onPhrase      = _provider.CreateSqlBuilder(parameters);
            _operationType = operationType;

            if (_operationType == NpgCommandType.DELETE)
            {
                _keywordName = "USING";
            }
            else if (_operationType == NpgCommandType.UPDATE)
            {
                _keywordName = "FROM";
            }
        }
예제 #7
0
        /// <summary>
        /// 实例化 <see cref="Builder" /> 的新实例
        /// </summary>
        /// <param name="token">参数列表,NULL 或者 Parameters=NULL 时表示不使用参数化</param>
        public NpgSelectInfoCommand(IDbQueryProvider provider, TableAliasCache aliases, NpgCommandType operationType, ParserToken token)
            : base(provider, aliases, token)
        {
            _provider      = provider;
            _aliases       = aliases;
            _onPhrase      = _provider.CreateSqlBuilder(token);
            _operationType = operationType;

            if (_operationType == NpgCommandType.DELETE)
            {
                _keywordName = "USING";
            }
            else if (_operationType == NpgCommandType.UPDATE)
            {
                _keywordName = "FROM";
            }
        }
예제 #8
0
        /// <summary>
        /// 实例化 <see cref="NpgMappingDbCommand" /> 的新实例
        /// </summary>
        /// <param name="provider">数据查询提供者</param>
        /// <param name="aliases">别名</param>
        /// <param name="dbExpressionType">表达式类型</param>
        /// <param name="token">解析上下文参数</param>
        public NpgMappingDbCommand(IDbQueryProvider provider, TableAlias aliases, DbExpressionType dbExpressionType, ResolveToken token)
            : base(provider, aliases, token)
        {
            _provider         = provider;
            _aliases          = aliases;
            _onPhrase         = _provider.CreateSqlBuilder(token);
            _dbExpressionType = dbExpressionType;

            if (_dbExpressionType == DbExpressionType.Delete)
            {
                _keywordName = "USING ";
            }
            else if (_dbExpressionType == DbExpressionType.Update)
            {
                _keywordName = "FROM ";
            }
            _pad = "".PadLeft(_keywordName.Length, ' ');
        }
예제 #9
0
        /// <summary>
        /// 附加查询项
        /// </summary>
        public void AddQuery(string query, params object[] args)
        {
            var builder = _provider.CreateSqlBuilder(null);

            if (args != null && !string.IsNullOrEmpty(query))
            {
                for (int i = 0; i < args.Length; i++)
                {
                    args[i] = builder.GetSqlValue(args[i]);
                }
                query = string.Format(query, args);
            }
            lock (this._oLock)
                if (!string.IsNullOrEmpty(query))
                {
                    _dbQueryables.Add(query);
                }
        }