Beispiel #1
0
        public virtual DbTypeBase MigrateDataType(IColumnStructure owningColumn, DbTypeBase type, IMigrationProfile profile, IProgressInfo progress)
        {
            ISpecificType spectype = GenericTypeToSpecific(type, profile, progress);

            //if (!DialectCaps.Arrays && type.ArraySpec.IsArray)
            //{
            //    return new DbTypeText(); // migrate arrays as text blob
            //}
            return(spectype.ToGenericType());
        }
Beispiel #2
0
 public override bool Save()
 {
     if (m_domain.FullName == null)
     {
         return(SaveAs());
     }
     else
     {
         m_domain.DataType   = m_dataType.ToGenericType();
         m_domain.IsNullable = chbNullable.Checked;
         m_conn.AlterObject(m_oldDomain, m_domain);
         Init(m_domain, m_conn.Dialect);
         return(true);
     }
 }
Beispiel #3
0
        private void LoadIdentityColumns(TableStructure tbl)
        {
            var cols = GetCachedTableColumnsTable("mssql.identity_columns", LoadIdentityColumnsTable, tbl.FullName);

            if (cols == null)
            {
                return;
            }
            bool oldver = cols.Columns.IndexOf("increment_value") < 0;

            foreach (DataRow row in cols.Rows)
            {
                var col = (ColumnStructure)tbl.Columns[row.SafeString("COLUMN_NAME")];
                if (oldver)
                {
                    int colstat = row.SafeString("COLUMN_STAT").SafeIntParse();
                    if ((colstat & 1) != 0)
                    {
                        col.DataType.SetAutoincrement(true);
                        // this is neccessery for correctly set ms_sql attributes
                        col.DataType = m_dialect.GenericTypeToSpecific(col.DataType).ToGenericType();
                    }
                }
                else
                {
                    ISpecificType spec    = m_dialect.GenericTypeToSpecific(col.DataType);
                    var           autoinc = spec as IMsSqlAutoIncrement;
                    if (autoinc != null)
                    {
                        autoinc.IsIdentity        = true;
                        autoinc.IdentityIncrement = row.SafeString("increment_value").SafeIntParse();
                        autoinc.IdentitySeed      = row.SafeString("seed_value").SafeIntParse();
                        col.DataType = spec.ToGenericType();
                    }
                }
            }
        }