예제 #1
0
        public override string BuildSql(SqlOptions sqlOptions)
        {
            var operand = _selectBuilder.BuildSql(((SqlOptions)sqlOptions.Clone()).Inlined());
            var command = sqlOptions.Command("EXISTS");

            return($"{command}({operand})");
        }
예제 #2
0
        public override string BuildSql(SqlOptions sqlOptions)
        {
            if (sqlOptions == null)
            {
                throw new ArgumentException(nameof(sqlOptions));
            }

            var updatedSqlOptions = ((SqlOptions)sqlOptions.Clone()).WithoutTableNames();

            CheckBeforeBuild(updatedSqlOptions);
            IEnumerable <SqlBuilderEntity> data = new SqlBuilderEntity[]
            {
                CustomBlocks[SqlDeletePosition.Start],
                DeleteFromBlock,
                CustomBlocks[SqlDeletePosition.From],
                WhereBlock,
                CustomBlocks[SqlDeletePosition.Where],
                ReturningsBlock,
                CustomBlocks[SqlDeletePosition.Return]
            };
            var commands = data.Where(b => CheckBlock(b, updatedSqlOptions)).Select(b => b.BuildSql(updatedSqlOptions, FlowOptions.Construct(this)));

            return(string.Join(sqlOptions.NewLine(), commands));
        }