Ejemplo n.º 1
0
 public override void WriteColumnChanges(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} alter column {1} ", SqlServerProvider.EscapeIdentifier(col.TableName),
                          SqlServerProvider.EscapeIdentifier(col.Current.Name));
     _writer.Write(col);
     Builder.AppendLine(";");
 }
Ejemplo n.º 2
0
        /// <summary>
        /// type, size,collate, null
        /// </summary>
        public override void WriteColumnChanges(ColumnModifications col)
        {
            var w = new MySqlColumnWriter(Builder);

            Builder.AppendFormat("alter table {0} modify ", MySqlProvider.EscapeIdentifier(col.Name));
            w.Write(col);
        }
Ejemplo n.º 3
0
 private IRelationalValueBufferFactory CreateValueBufferFactory()
 => _valueBufferFactoryFactory
 .Create(
     ColumnModifications
     .Where(c => c.IsRead)
     .Select(c => c.Property.ClrType)
     .ToArray(),
     indexMap: null);
Ejemplo n.º 4
0
 public virtual void Write(ColumnModifications item)
 {
     _item = item;
     _item.Options.Use(Engine);
     Builder.AppendFormat("alter table {0} drop column {1}", Escape(item.TableName), Escape(item.Name));
     WriteEndOptions();
     Builder.AppendLine(";");
 }
Ejemplo n.º 5
0
 public override void WriteDropDefault(ColumnModifications col)
 {
     if (!col.Current.DefaultConstraintName.IsNullOrEmpty())
     {
         Builder.AppendFormat("alter table {0} drop constraint {1};\n",
                              SqlServerProvider.EscapeIdentifier(col.TableName),
                              col.Current.DefaultConstraintName);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        ///     Reads values returned from the database in the given <see cref="ValueBuffer" /> and
        ///     propagates them back to into the appropriate <see cref="ColumnModification" />
        ///     from which the values can be propagated on to tracked entities.
        /// </summary>
        /// <param name="valueBuffer"> The buffer containing the values read from the database. </param>
        public virtual void PropagateResults(ValueBuffer valueBuffer)
        {
            Check.NotNull(valueBuffer, nameof(valueBuffer));

            // Note that this call sets the value into a sidecar and will only commit to the actual entity
            // if SaveChanges is successful.
            var index = 0;

            foreach (var modification in ColumnModifications.Where(o => o.IsRead))
            {
                modification.Value = valueBuffer[index++];
            }
        }
Ejemplo n.º 7
0
        public virtual void PropagateResults([NotNull] IValueReader reader)
        {
            Check.NotNull(reader, "reader");

            // TODO: Consider using strongly typed ReadValue instead of just <object>
            // Note that this call sets the value into a sidecar and will only commit to the actual entity
            // if SaveChanges is successful.
            var columnOperations = ColumnModifications.Where(o => o.IsRead).ToArray();

            for (var i = 0; i < columnOperations.Length; i++)
            {
                columnOperations[i].Value = reader.ReadValue <object>(i);
            }
        }
Ejemplo n.º 8
0
        public virtual void Write(ColumnModifications col)
        {
            if (col.Type != null)
            {
                Builder.Append(GetType(col.Type.Value, col.Size));
            }
            else
            {
                Builder.Append(col.Current.Type);
            }

            WriteCollation(col.Collation);

            if (col.Nullable != null)
            {
                WriteNullable(col.Nullable.Value);
            }

            WriteEndColumnOptions(col.Options);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// type, size,collate, null
        /// </summary>
        public override void WriteColumnChanges(ColumnModifications col)
        {
            var w = new PostgresColumnWriter(Builder);

            w.Write(col);
        }
Ejemplo n.º 10
0
 protected override bool ShouldDropDefault(ColumnModifications col)
 {
     return(base.ShouldDropDefault(col) || col.HasChangedStructure || col.IsDropped);
 }
Ejemplo n.º 11
0
 protected override void WriteRenameColumn(ColumnModifications col)
 {
     Builder.AppendFormat("exec sp_rename '{2}.{0}','{1}','COLUMN';\n", col.Current.Name, col.NewName, Table.Name);
 }
Ejemplo n.º 12
0
 protected override void WriteRenameColumn(ColumnModifications col)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 13
0
 public override void WriteSetDefault(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} add constraint {1} default ('{2}') for {3};\n",
                          SqlServerProvider.EscapeIdentifier(col.TableName),
                          string.Format("DF_{0}_{1}", col.TableName, col.Name), col.DefaultValue, col.Name);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// type, size,collate, null
 /// </summary>
 public abstract void WriteColumnChanges(ColumnModifications col);
Ejemplo n.º 15
0
 public abstract void WriteSetDefault(ColumnModifications col);
Ejemplo n.º 16
0
 public override void Write(ColumnModifications col)
 {
     col.Collation = null;
     base.Write(col);
 }
Ejemplo n.º 17
0
 public override void WriteSetDefault(ColumnModifications col)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 18
0
 protected override void WriteRenameColumn(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} rename {1} to {2};\n\r", Escape(col.TableName),
                          Escape(col.Current.Name), Escape(col.NewName));
 }
Ejemplo n.º 19
0
 public override void WriteDropDefault(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} alter {1} drop default;\n\r", col.TableName, col.Name);
 }
Ejemplo n.º 20
0
 public override void WriteSetDefault(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} alter {1} set default '{2}';",
                          MySqlProvider.EscapeIdentifier(col.TableName), MySqlProvider.EscapeIdentifier(col.Name),
                          col.DefaultValue);
 }
Ejemplo n.º 21
0
 protected virtual bool ShouldDropDefault(ColumnModifications col)
 {
     return(col.DefaultDropped);
 }
Ejemplo n.º 22
0
 public override void WriteDropDefault(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} alter {1} drop default;",
                          MySqlProvider.EscapeIdentifier(col.TableName), MySqlProvider.EscapeIdentifier(col.Name));
 }
Ejemplo n.º 23
0
 protected abstract void WriteRenameColumn(ColumnModifications col);
Ejemplo n.º 24
0
 public override void WriteSetDefault(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} alter {1} set default {2};\n\r", col.TableName, col.Name,
                          col.DefaultValue);
 }
Ejemplo n.º 25
0
 protected override void WriteRenameColumn(ColumnModifications col)
 {
     Builder.AppendFormat("ALTER TABLE {0} CHANGE {1} {2}", Escape(col.TableName), Escape(col.Current.Name),
                          col.Current.Definition.Replace(col.Current.Name, col.NewName));
     Builder.AppendLine(";");
 }
Ejemplo n.º 26
0
 /// <summary>
 /// type, size,collate, null
 /// </summary>
 public override void WriteColumnChanges(ColumnModifications col)
 {
     throw new NotImplementedException();
 }