Esempio n. 1
0
        public Column(string name, ColumnType type)
        {
            if (type == null)
                throw new ArgumentNullException("type");

            Name = name;
            ColumnType = type;
        }
Esempio n. 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);
        }
Esempio n. 4
0
 public string Get(ColumnType columnType)
 {
     return Get(columnType.DataType, columnType.Length, columnType.Scale);
 }
Esempio n. 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);
            }
        }
Esempio n. 9
0
 public Column(string name, ColumnType type, ColumnProperty property, object defaultValue)
     : this(name, type)
 {
     ColumnProperty = property;
     DefaultValue = defaultValue;
 }
Esempio n. 10
0
 public Column(string name, ColumnType type, object defaultValue)
     : this(name, type)
 {
     DefaultValue = defaultValue;
 }
Esempio n. 11
0
 public Column(string name, ColumnType type, ColumnProperty property)
     : this(name, type)
 {
     ColumnProperty = property;
 }
Esempio n. 12
0
 public void SetColumnType(ColumnType type)
 {
     if (type == null)
         throw new ArgumentNullException("type");
     ColumnType = type;
 }
Esempio n. 13
0
 protected Column()
 {
     ColumnType = new ColumnType(default(DbType));
 }
Esempio n. 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);
 }