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); }
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; }
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)); }