/// <summary>
        /// 查询指定函数语句并返回当前语句
        /// </summary>
        /// <param name="function">函数</param>
        /// <param name="aliasesName">别名</param>
        /// <exception cref="ArgumentNullException">函数不能为空</exception>
        /// <returns>当前语句</returns>
        public SelectCommand Query(ISqlFunction function, String aliasesName)
        {
            if (function == null)
            {
                throw new ArgumentNullException("function");
            }

            this._queryFields.Add(SqlQueryField.InternalCreateFromFunction(function.ToString(this.DatabaseType), aliasesName));

            if (function.HasParameters)
            {
                this._parameters.AddRange(function.GetAllParameters());
            }

            return(this);
        }
        /// <summary>
        /// 查询插入最后一条记录的ID并返回当前语句
        /// </summary>
        /// <exception cref="DatabaseNotSupportException">Oracle数据库不支持获取最后一条记录的ID</exception>
        /// <returns>当前语句</returns>
        public SelectCommand QueryIdentity()
        {
            if (this.DatabaseType == DatabaseType.SQLite)
            {
                this._queryFields.Add(SqlQueryField.InternalCreateFromFunction("LAST_INSERT_ROWID()"));
            }
            else if (this.DatabaseType == DatabaseType.Oracle)
            {
                throw new DatabaseNotSupportException("Oracle database does not support identity.");
            }
            else
            {
                this._queryFields.Add(SqlQueryField.InternalCreateFromFunction("@@IDENTITY"));
            }

            return(this);
        }
        /// <summary>
        /// 查询指定选择语句并返回当前语句
        /// </summary>
        /// <param name="command">选择语句</param>
        /// <param name="aliasesName">别名</param>
        /// <exception cref="ArgumentNullException">选择语句不能为空</exception>
        /// <returns>当前语句</returns>
        public SelectCommand Query(SelectCommand command, String aliasesName)
        {
            if (command == null)
            {
                throw new ArgumentNullException("function");
            }

            this._queryFields.Add(SqlQueryField.InternalCreateFromFunction(command.ToString(true), aliasesName));

            List <SqlParameter> parameters = command.GetAllParameters();

            if (parameters != null)
            {
                this._parameters.AddRange(parameters);
            }

            return(this);
        }