Beispiel #1
0
 /// <summary>
 /// 生成修改列的类型的语句
 /// </summary>
 /// <param name="op">修改列类型的实例对象</param>
 protected override void Generate(AlterColumnType op)
 {
     //SQLite 不支持
     if (op.DbType == DbType.Int32 && op.NewType == DbType.Int64)
     {
         //可能是自增列的类型在创建时不支持 Int64,而是以 Int32 生成了,所以这里选择忽略此种情况。
     }
     else
     {
         this.AlterColumnNotSupport(op);
     }
 }
Beispiel #2
0
        protected override void Generate(AlterColumnType op)
        {
            using (var sql = this.Writer())
            {
                sql.Write("ALTER TABLE ");
                sql.Write(this.Quote(op.TableName));
                sql.WriteLine();

                sql.Indent++;
                sql.Write("ALTER COLUMN ");
                this.GenerateColumnDeclaration(sql, op.ColumnName, op.NewType, op.Length, op.IsRequired, op.IsForeignKey);

                this.AddRun(sql);
            }
        }
Beispiel #3
0
        protected override void Generate(AlterColumnType op)
        {
            using (var sql = this.Writer())
            {
                sql.Write("ALTER TABLE ");
                sql.Write(this.Quote(op.TableName));
                sql.WriteLine();

                sql.Indent++;
                sql.Write("MODIFY ");//ORACLE 中,MODIFY 关键字后没有 COLUMN 关键字。

                //Oracle 中如果可空性没有变化时,不能加到 Modify Column 之后。
                bool?isRequired = null;
                this.GenerateColumnDeclaration(sql, op.ColumnName, op.NewType, op.Length, isRequired, op.IsForeignKey);

                this.AddRun(sql);
            }
        }
Beispiel #4
0
 protected abstract void Generate(AlterColumnType op);
Beispiel #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="op"></param>
 protected override void Generate(AlterColumnType op)
 {
     throw new NotImplementedException();
 }