コード例 #1
0
            public override void RunCommand()
            {
                if (Template == null)
                {
                    throw new CommandLineError("DAE-00153 Missing template argument");
                }
                IDatabaseSource db = m_connection.GetConnection();

                Async.SafeOpen(db.Connection);
                IAppObjectSqlGenerator sqlgen = (IAppObjectSqlGenerator)AppObjectSqlGeneratorAddonType.Instance.FindHolder(Template).CreateInstance();
                ISqlDialect            dial;

                if (Dialect != null)
                {
                    dial = (ISqlDialect)DialectAddonType.Instance.FindHolder(Dialect).CreateInstance();
                }
                else
                {
                    dial = new GenericDialect();
                }
                using (TextWriter fw = GetOutputStream())
                {
                    SqlOutputStream so   = new SqlOutputStream(dial, fw, new SqlFormatProperties());
                    ISqlDumper      dmp  = dial.CreateDumper(so, new SqlFormatProperties());
                    var             name = new FullDatabaseRelatedName
                    {
                        ObjectName = new NameWithSchema(Objschema, Objname),
                        ObjectType = Objtype,
                        SubName    = Subname
                    };
                    sqlgen.GenerateSql(db, name, dmp, dial);
                }
                Async.SafeClose(db.Connection);
            }
コード例 #2
0
ファイル: DialectExtension.cs プロジェクト: janproch/datadmin
        public static ISqlDumper CreateDumper(this ISqlDialect dialect, TextWriter tw, SqlFormatProperties props)
        {
            SqlOutputStream sqlo = new SqlOutputStream(dialect, tw, props);

            return(dialect.CreateDumper(sqlo, props));
        }