예제 #1
0
        protected override string GenerateSql(SqlStatement statement)
        {
            ISqlVisitor visitor = GetVisitor();

            statement.Accept(visitor);
            return(visitor.Sql);
        }
예제 #2
0
        internal static string ToSqlInternal(this SqlStatement sql, SqlDialect dialect = null, Action <SqlParameter> parameterCallback = null)
        {
            if (sql == null)
            {
                throw new ArgumentNullException(nameof(sql));
            }
            dialect = dialect ?? SqlDialect.Current;

            StringBuilder builder = new StringBuilder();

            using (SqlWriter writer = new SqlWriter(builder, dialect))
            {
                var visitor = new SqlWriterVisitor(writer)
                {
                    ParameterVisited = parameterCallback
                };

                sql.Accept(visitor);
            }

            return(builder.ToString());
        }