Exemplo n.º 1
0
        public static Boolean CompareValues(PartitionFunction origen, PartitionFunction destino)
        {
            if (destino == null)
            {
                throw new ArgumentNullException("destino");
            }
            if (origen == null)
            {
                throw new ArgumentNullException("origen");
            }
            if (origen.Values.Count != destino.Values.Count)
            {
                return(false);
            }
            List <string> items = new List <string>();

            foreach (string s in origen.Values)
            {
                if (!destino.values.Contains(s))
                {
                    items.Add(s);
                }
            }

            //if (origen.Values.Except(destino.values).ToList().Count != 0) return false;
            if (items.Count != 0)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
 public static Boolean Compare(PartitionFunction origen, PartitionFunction destino)
 {
     if (destino == null)
     {
         throw new ArgumentNullException("destino");
     }
     if (origen == null)
     {
         throw new ArgumentNullException("origen");
     }
     if (!origen.Type.Equals(destino.Type))
     {
         return(false);
     }
     if (origen.Size != destino.Size)
     {
         return(false);
     }
     if (origen.Precision != destino.Precision)
     {
         return(false);
     }
     if (origen.Scale != destino.Scale)
     {
         return(false);
     }
     if (origen.IsBoundaryRight != destino.IsBoundaryRight)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 3
0
 public static Boolean CompareValues(PartitionFunction origen, PartitionFunction destino)
 {
     if (destino == null) throw new ArgumentNullException("destino");
     if (origen == null) throw new ArgumentNullException("origen");
     if (origen.Values.Count != destino.Values.Count) return false;
     if (origen.Values.Except(destino.Values).ToList().Count != 0) return false;
     return true;
 }
Exemplo n.º 4
0
 public static Boolean Compare(PartitionFunction origen, PartitionFunction destino)
 {
     if (destino == null) throw new ArgumentNullException("destino");
     if (origen == null) throw new ArgumentNullException("origen");
     if (!origen.Type.Equals(destino.Type)) return false;
     if (origen.Size != destino.Size) return false;
     if (origen.Precision != destino.Precision) return false;
     if (origen.Scale != destino.Scale) return false;
     if (origen.IsBoundaryRight != destino.IsBoundaryRight) return false;
     return true;
 }
Exemplo n.º 5
0
 public PartitionFunction Clone(ISchemaBase parent)
 {
     PartitionFunction item = new PartitionFunction(parent);
     item.Id = this.Id;
     item.IsBoundaryRight = this.IsBoundaryRight;
     item.Name = this.Name;
     item.Precision = this.Precision;
     item.Scale = this.Scale;
     item.Size = this.Size;
     item.Type = this.Type;
     this.Values.ForEach(value => { item.Values.Add(value); });
     return item;
 }
Exemplo n.º 6
0
        public PartitionFunction Clone(ISchemaBase parent)
        {
            PartitionFunction item = new PartitionFunction(parent);

            item.Id = this.Id;
            item.IsBoundaryRight = this.IsBoundaryRight;
            item.Name            = this.Name;
            item.Precision       = this.Precision;
            item.Scale           = this.Scale;
            item.Size            = this.Size;
            item.Type            = this.Type;
            this.Values.ForEach(value => { item.Values.Add(value); });
            return(item);
        }
Exemplo n.º 7
0
 public static Boolean CompareValues(PartitionFunction origen, PartitionFunction destino)
 {
     if (destino == null)
     {
         throw new ArgumentNullException("destino");
     }
     if (origen == null)
     {
         throw new ArgumentNullException("origen");
     }
     if (origen.Values.Count != destino.Values.Count)
     {
         return(false);
     }
     if (origen.Values.Except(destino.values).ToList().Count != 0)
     {
         return(false);
     }
     return(true);
 }
        public void Fill(Database database, string connectioString)
        {

            int lastObjectId = 0;
            PartitionFunction item = null;
            if (database.Info.Version == DatabaseInfo.VersionNumber.SQLServer2000) return;
            if (database.Options.Ignore.FilterPartitionFunction)
            {
                using (SqlConnection conn = new SqlConnection(connectioString))
                {
                    using (SqlCommand command = new SqlCommand(GetSQL(), conn))
                    {
                        conn.Open();
                        command.CommandTimeout = 0;
                        using (SqlDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                if (lastObjectId != (int)reader["function_id"])
                                {
                                    lastObjectId = (int)reader["function_id"];
                                    item = new PartitionFunction(database);
                                    item.Id = (int)reader["function_id"];
                                    item.Name = reader["name"].ToString();
                                    item.IsBoundaryRight = (bool)reader["IsRight"];
                                    item.Precision = (byte)reader["precision"];
                                    item.Scale = (byte)reader["scale"];
                                    item.Size = (short)reader["max_length"];
                                    item.Type = reader["TypeName"].ToString();
                                    database.PartitionFunctions.Add(item);
                                }
                                if (item.Type.Equals("binary") || item.Type.Equals("varbinary"))
                                    item.Values.Add(ToHex((byte[])reader["value"]));
                                else
                                    item.Values.Add(reader["value"].ToString());
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 9
0
        public static Boolean CompareValues(PartitionFunction origen, PartitionFunction destino)
        {
            if (destino == null) throw new ArgumentNullException("destino");
            if (origen == null) throw new ArgumentNullException("origen");
            if (origen.Values.Count != destino.Values.Count) return false;
            List<string> items = new List<string>();
            foreach (string s in origen.Values)
            {
                if (!destino.values.Contains(s))
                    items.Add(s);            }

            //if (origen.Values.Except(destino.values).ToList().Count != 0) return false;
            if (items.Count != 0) return false;
            return true;
        }