Esempio n. 1
0
        private void cbxDataType_SelectedIndexChanged(object sender, EventArgs e)
        {
            string value   = cbxDataType.Items[cbxDataType.SelectedIndex].ToString();
            object depcode = Enum.Parse(m_dialect.SpecificTypeEnum, value, true);

            m_dataType = m_dialect.CreateSpecificTypeInstance(depcode);
            propertyGrid1.SelectedObject = m_dataType;
        }
Esempio n. 2
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());
        }
Esempio n. 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();
                    }
                }
            }
        }
Esempio n. 4
0
        public void Init(IDomainStructure domain, ISqlDialect dialect)
        {
            m_oldDomain = domain;
            if (domain == null)
            {
                m_domain          = new DomainStructure();
                m_domain.DataType = new DbTypeString();
            }
            else
            {
                m_domain = new DomainStructure(domain);
            }
            m_dialect = dialect;
            cbxDataType.Items.Clear();
            foreach (string code in Enum.GetNames(m_dialect.SpecificTypeEnum).Sorted())
            {
                cbxDataType.Items.Add(code);
            }
            m_dataType = m_dialect.GenericTypeToSpecific(m_domain.DataType);
            propertyGrid1.SelectedObject = m_dataType;

            cbxDataType.SelectedIndex = cbxDataType.Items.IndexOf(((ISpecificType)m_dataType).Code.ToString());
            chbNullable.Checked       = m_domain.IsNullable;
        }