예제 #1
0
        protected override DbTypeBase ToGenericTypeNoArray()
        {
            DbTypeNumeric res = new DbTypeNumeric();

            res.Precision     = Precision;
            res.Scale         = Scale;
            res.Autoincrement = true;
            return(res);
        }
예제 #2
0
        public override DbTypeBase ToGenericType()
        {
            DbTypeNumeric res = new DbTypeNumeric();

            res.Precision     = Precision;
            res.Scale         = Scale;
            res.Autoincrement = IsAutoIncrement;
            return(res);
        }
예제 #3
0
        public override DbTypeBase ToGenericType()
        {
            DbTypeNumeric res = new DbTypeNumeric();

            res.Precision = Length;
            res.Scale     = Decimals;
            res.SetSpecificAttribute("mysql", "subtype", SqlName);
            SaveType(res);
            return(res);
        }
예제 #4
0
        ITableStructure GetStructure(DbfFile dbf)
        {
            var res = new TableStructure();

            //output column names
            for (int i = 0; i < dbf.Header.ColumnCount; i++)
            {
                DbTypeBase type;
                // convert DBF type to DA type
                switch (dbf.Header[i].ColumnType)
                {
                case DbfColumn.DbfColumnType.Binary:
                    type = new DbTypeBlob();
                    break;

                case DbfColumn.DbfColumnType.Boolean:
                    type = new DbTypeLogical();
                    break;

                case DbfColumn.DbfColumnType.Date:
                    type = new DbTypeDatetime {
                        SubType = DbDatetimeSubType.Date
                    };
                    break;

                case DbfColumn.DbfColumnType.Character:
                    type = new DbTypeString {
                        Length = dbf.Header[i].Length
                    };
                    break;

                case DbfColumn.DbfColumnType.Integer:
                    type = new DbTypeInt();
                    break;

                case DbfColumn.DbfColumnType.Memo:
                    type = new DbTypeText();
                    break;

                case DbfColumn.DbfColumnType.Number:
                    type = new DbTypeNumeric {
                        Precision = dbf.Header[i].DecimalCount
                    };
                    break;

                default:
                    type = new DbTypeString();
                    break;
                }
                res.AddColumn(dbf.Header[i].Name, type);
            }
            return(res);
        }
예제 #5
0
        public override DbTypeBase ToGenericType()
        {
            DbTypeNumeric res = new DbTypeNumeric();

            res.Precision = Precision;
            res.Scale     = Scale;
            if (IsIdentity)
            {
                res.Autoincrement = true;
                res.SetSpecificAttribute("effiproz", "identity_increment", IdentityIncrement.ToString());
                res.SetSpecificAttribute("effiproz", "identity_seed", IdentitySeed.ToString());
            }
            return(res);
        }
예제 #6
0
        public static string GetSqlType(Type type)
        {
            DbTypeBase res;

            if (type == typeof(SqlString))
            {
                res = new DbTypeString();
            }
            else if (type == typeof(SqlInt32))
            {
                res = new DbTypeInt {
                    Bytes = 4
                }
            }
            ;
            else if (type == typeof(SqlInt16))
            {
                res = new DbTypeInt {
                    Bytes = 2
                }
            }
            ;
            else if (type == typeof(SqlInt64))
            {
                res = new DbTypeInt {
                    Bytes = 8
                }
            }
            ;
            else if (type == typeof(SqlDecimal))
            {
                res = new DbTypeNumeric();
            }
            else
            {
                res = TypeTool.GetDatAdminType(type);
            }

            if (res is DbTypeString)
            {
                var stype = (DbTypeString)res;
                stype.Length    = 4000;
                stype.IsUnicode = true;
            }
            return(MsSqlDialect.Instance.GenericTypeToSpecific(res).ToString());
        }
예제 #7
0
 public override DbTypeBase ToGenericType()
 {
     if (Precision == null && Scale == null)
     {
         var fres = new DbTypeFloat {
             Bytes = 8
         };
         fres.SetSpecificAttribute("oracle", "subtype", "number");
         return(fres);
     }
     if (Precision != null && Scale != null)
     {
         var nres = new DbTypeNumeric();
         nres.Precision = Precision.Value;
         nres.Scale     = Scale.Value;
         return(nres);
     }
     if ((Scale ?? 0) == 0)
     {
         var ires = new DbTypeInt {
             Bytes = 4
         };
         if (Precision != null)
         {
             ires.SetSpecificAttribute("oracle", "length", Precision.ToString());
         }
         return(ires);
     }
     if (Precision == null)
     {
         var nres = new DbTypeNumeric();
         nres.Scale = Scale.Value;
         nres.SetSpecificAttribute("oracle", "noprec", "1");
         return(nres);
     }
     // this should never happen
     return(new DbTypeNumeric());
 }
예제 #8
0
        public override DbTypeBase ToGenericType()
        {
            DbTypeNumeric res = new DbTypeNumeric();

            return(res);
        }