예제 #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
 public GenerateSqlJobCommand(IAppObjectSqlGenerator generator, IFilePlace place, ISqlDialect dialect, AppObject[] objs, ConnectionPack connpack, SqlFormatProperties formatProps)
     : this()
 {
     Generator = generator;
     Place     = place;
     Dialect   = dialect;
     Args.AddRange(objs);
     ConnPack    = connpack;
     FormatProps = formatProps;
 }
예제 #3
0
 public static Job CreateJob(IAppObjectSqlGenerator generator, IFilePlace place, ISqlDialect dialect, AppObject[] objs, ConnectionPack connpack, SqlFormatProperties formatProps, JobProperties jobProps)
 {
     return(Job.FromCommand(new GenerateSqlJobCommand(generator, place, dialect, objs, connpack, formatProps), jobProps));
 }