private MySqlTypeBase GetMySqlTypeInt(DbTypeInt type) { if (type.GetSpecificAttribute("mysql", "subtype") == "bit") { MySqlTypeBit bit = new MySqlTypeBit(); bit.Length = Int32.Parse(type.GetSpecificAttribute("mysql", "bitlength")); return(bit); } MySqlTypeInteger res; switch (type.Bytes) { case 1: res = new MySqlTypeTinyInt(); break; case 2: res = new MySqlTypeSmallInt(); break; case 3: res = new MySqlTypeMediumInt(); break; case 4: res = new MySqlTypeInt(); break; case 8: res = new MySqlTypeBigInt(); break; default: res = new MySqlTypeInt(); break; } res.IsAutoIncrement = type.Autoincrement; res.Unsigned = type.Unsigned; res.Zerofill = type.GetSpecificAttribute("mysql", "zerofill") == "1"; string len = type.GetSpecificAttribute("mysql", "length"); if (len != null) { res.Length = Int32.Parse(len); } return(res); }
private ISpecificType GetPostgreSqlTypeInt(DbTypeInt type) { string subtype = type.GetSpecificAttribute("pgsql", "subtype"); switch (subtype) { case "oid": return(new PostgreSqlTypeOid()); } if (type.Autoincrement) { if (type.Bytes == 8) { return(new PostgreSqlTypeBigSerial()); } return(new PostgreSqlTypeSerial()); } if (type.Bytes == 8) { return(new PostgreSqlTypeBigInt()); } if (type.Bytes == 2) { return(new PostgreSqlTypeSmallInt()); } return(new PostgreSqlTypeInteger()); }
private SqlTypeBase GetSqlTypeInt(DbTypeInt type) { SqlTypeInteger res; switch (type.Bytes) { case 1: // tinyint is unsigned, when type is signed, // we must use 2-byte signed int if (type.Unsigned) { res = new SqlTypeTinyInt(); } else { res = new SqlTypeSmallInt(); } break; case 2: res = new SqlTypeSmallInt(); break; case 4: res = new SqlTypeInt(); break; case 8: res = new SqlTypeBigInt(); break; default: res = new SqlTypeInt(); break; } res.IsIdentity = type.Autoincrement; int increment; if (Int32.TryParse(type.GetSpecificAttribute("mssql", "identity_increment"), out increment)) { res.IdentityIncrement = increment; res.IdentitySeed = Int32.Parse(type.GetSpecificAttribute("mssql", "identity_seed")); } return(res); }
private EfzTypeBase GetEfzTypeInt(DbTypeInt type) { EfzTypeInteger res; switch (type.Bytes) { case 1: res = new EfzTypeTinyInt(); break; case 2: res = new EfzTypeSmallInt(); break; case 4: res = new EfzTypeInt(); break; case 8: res = new EfzTypeBigInt(); break; default: res = new EfzTypeInt(); break; } res.IsIdentity = type.Autoincrement; int increment; if (Int32.TryParse(type.GetSpecificAttribute("effiproz", "identity_increment"), out increment)) { res.IdentityIncrement = increment; res.IdentitySeed = Int32.Parse(type.GetSpecificAttribute("effiproz", "identity_seed")); } return(res); }