Exemplo n.º 1
0
        public static string SqlCreateOutputView(this OutputContext c)
        {
            var columnNames = string.Join(",", c.GetAllEntityOutputFields().Select(f => "[" + f.FieldName() + "] AS [" + f.Alias + "]"));
            var sql         = $@"CREATE VIEW [{c.Entity.OutputViewName(c.Process.Name)}] AS SELECT {columnNames},TflBatchId,TflKey FROM [{c.Entity.OutputTableName(c.Process.Name)}] WITH (NOLOCK);";

            c.Debug(sql);
            return(sql);
        }
Exemplo n.º 2
0
        public static string SqlCreateOutput(this OutputContext c)
        {
            var columnsAndDefinitions = string.Join(",", c.GetAllEntityOutputFields().Select(f => "[" + f.FieldName() + "] " + f.SqlDataType() + " NOT NULL"));
            var sql = $"CREATE TABLE [{c.Entity.OutputTableName(c.Process.Name)}]({columnsAndDefinitions}, TflBatchId INT NOT NULL, TflKey INT IDENTITY(1,1));";

            c.Debug(sql);
            return(sql);
        }
Exemplo n.º 3
0
        public static string SqlCreateOutputView(this OutputContext c, IConnectionFactory cf)
        {
            var columnNames = string.Join(",", c.GetAllEntityOutputFields().Select(f => cf.Enclose(f.FieldName()) + " AS " + cf.Enclose(f.Alias)));
            var sql         = $@"CREATE VIEW {cf.Enclose(c.Entity.OutputViewName(c.Process.Name))} AS SELECT {columnNames} FROM {cf.Enclose(c.Entity.OutputTableName(c.Process.Name))}{cf.Terminator}";

            c.Debug(() => sql);
            return(sql);
        }
 public JsonStreamWriter2(OutputContext context, Stream stream)
 {
     _context = context;
     _stream  = stream;
     _fields  = context.GetAllEntityOutputFields().ToArray();
     _formats = new string[_fields.Count()];
     for (int i = 0; i < _fields.Length; i++)
     {
         _formats[i] = _fields[i].Format == string.Empty ? string.Empty : string.Concat("{0:", _fields[i].Format, "}");
     }
 }
Exemplo n.º 5
0
        public static string SqlCreateOutput(this OutputContext c, IConnectionFactory cf)
        {
            var columnsAndDefinitions = string.Join(",", c.GetAllEntityOutputFields().Select(f => cf.Enclose(f.FieldName()) + " " + cf.SqlDataType(f) + " NOT NULL"));
            var sql = $"CREATE TABLE {cf.Enclose(c.Entity.OutputTableName(c.Process.Name))}({columnsAndDefinitions}, ";

            if (cf.AdoProvider == AdoProvider.SqLite)
            {
                sql += $"PRIMARY KEY ({cf.Enclose(c.Entity.TflKey().FieldName())} ASC));";
            }
            else
            {
                sql += $"CONSTRAINT {Utility.Identifier("pk_" + c.Entity.OutputTableName(c.Process.Name) + "_tflkey")} PRIMARY KEY ({cf.Enclose(c.Entity.TflKey().FieldName())})){cf.Terminator}";
            }
            c.Debug(() => sql);
            return(sql);
        }