예제 #1
0
        public Column(string name, ColumnType type)
        {
            if (type == null)
                throw new ArgumentNullException("type");

            Name = name;
            ColumnType = type;
        }
예제 #2
0
        public Column(string name, ColumnType type, ColumnProperty property = ColumnProperty.None, object defaultValue = null)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException("name");
            }

            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            Name = name;
            ColumnType = type;
            ColumnProperty = property;
            DefaultValue = defaultValue;
        }
        protected override string GetSqlChangeColumnType(SchemaQualifiedObjectName table, string column, ColumnType columnType)
        {
            string columnTypeSql = typeMap.Get(columnType);

            return FormatSql("ALTER TABLE {0:NAME} MODIFY {1:NAME} {2}", table, column, columnTypeSql);
        }
예제 #4
0
 public string Get(ColumnType columnType)
 {
     return Get(columnType.DataType, columnType.Length, columnType.Scale);
 }
예제 #5
0
 private ColumnType GetColumnType()
 {
     var columnType = new ColumnType(ColumnType);
     columnType.Length = ColumnLength ?? Defaults.ColumnSize;
     if (ColumnScale != null)
     {
         columnType.Scale = ColumnScale;
     }
     return columnType;
 }
        protected override string GetSqlChangeColumnType(SchemaQualifiedObjectName table, string column, ColumnType columnType)
        {
            string sqlColumnType = typeMap.Get(columnType);

            return FormatSql("ALTER TABLE {0:NAME} ALTER COLUMN {1:NAME} TYPE {2}", table.Name, column, sqlColumnType);
        }
        protected virtual string GetSqlChangeColumnType(SchemaQualifiedObjectName table, string column, ColumnType columnType)
        {
            string columnTypeSql = typeMap.Get(columnType);

            return FormatSql("ALTER TABLE {0:NAME} ALTER COLUMN {1:NAME} {2}", table, column, columnTypeSql);
        }
        public virtual void ChangeColumn(SchemaQualifiedObjectName table, string column, ColumnType columnType, bool notNull)
        {
            string sqlChangeColumn = GetSqlChangeColumnType(table, column, columnType);
            string sqlChangeNotNullConstraint = GetSqlChangeNotNullConstraint(
                table, column, notNull, ref sqlChangeColumn);

            if (!string.IsNullOrWhiteSpace(sqlChangeColumn))
            {
                ExecuteNonQuery(sqlChangeColumn);
            }

            if (!string.IsNullOrWhiteSpace(sqlChangeNotNullConstraint))
            {
                ExecuteNonQuery(sqlChangeNotNullConstraint);
            }
        }
예제 #9
0
 public Column(string name, ColumnType type, ColumnProperty property, object defaultValue)
     : this(name, type)
 {
     ColumnProperty = property;
     DefaultValue = defaultValue;
 }
예제 #10
0
 public Column(string name, ColumnType type, object defaultValue)
     : this(name, type)
 {
     DefaultValue = defaultValue;
 }
예제 #11
0
 public Column(string name, ColumnType type, ColumnProperty property)
     : this(name, type)
 {
     ColumnProperty = property;
 }
예제 #12
0
 public void SetColumnType(ColumnType type)
 {
     if (type == null)
         throw new ArgumentNullException("type");
     ColumnType = type;
 }
예제 #13
0
 protected Column()
 {
     ColumnType = new ColumnType(default(DbType));
 }
예제 #14
0
 /// <summary>
 /// Get the name of the database type associated with the given 
 /// </summary>
 /// <param name="type">The DbType</param>
 /// <returns>The database type name used by ddl.</returns>
 public virtual string GetTypeName(ColumnType type)
 {
     return typeNames.Get(type);
 }