示例#1
0
        internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state)
        {
            string sql = state.GetDataSql(this, isFullName);

            if (sql != null)
            {
                return(sql);
            }

            string tableName   = factory.CreateDataTableMappingSql(TableMapping, state);
            string selectField = _selectField.CreateSqlString(factory, true, state);

            string field = _field.CreateSqlString(factory, isFullName, state);

            string query = null;

            if (_expression != null)
            {
                query = _expression.CreateSqlString(factory, true, state);
            }
            sql = factory.CreateSubQuerySql(field, _predicate, selectField, tableName, query);

            state.SetDataSql(this, isFullName, sql);
            return(sql);
        }
示例#2
0
        public string CreateSqlString(CommandFactory factory, CreateSqlState state)
        {
            var sb = new StringBuilder();

            if (Query != null || Order != null || Distinct)
            {
                var command   = factory.CreateSelectCommand(Mapping, AllSelector.Value, Query, Order, Distinct, null, state);
                var aliasName = AliasTableName;// ?? factory.CreateDataTableMappingSql(_mapping, state);
                sb.Append(factory.CreateAliasQuerySql(command.CommandText, aliasName));
            }
            else
            {
                sb.Append(AliasTableName != null
                    ? factory.CreateAliasTableSql(factory.CreateDataTableMappingSql(Mapping, state), AliasTableName)
                    : factory.CreateDataTableMappingSql(Mapping, state));
            }
            return(sb.ToString());
        }
示例#3
0
        public string CreateSqlString(CommandFactory factory, CreateSqlState state)
        {
            StringBuilder sb = new StringBuilder();

            if (_query != null || _order != null || _distinct)
            {
                CommandData command   = factory.CreateSelectCommand(_mapping, AllSelector.Value, _query, _order, _distinct, null, state);
                string      aliasName = _aliasTableName;// ?? factory.CreateDataTableMappingSql(_mapping, state);
                sb.Append(factory.CreateAliasQuerySql(command.CommandText, aliasName));
            }
            else
            {
                if (_aliasTableName != null)
                {
                    sb.Append(factory.CreateAliasTableSql(factory.CreateDataTableMappingSql(_mapping, state), _aliasTableName));
                }
                else
                {
                    sb.Append(factory.CreateDataTableMappingSql(_mapping, state));
                }
            }
            return(sb.ToString());
        }