Пример #1
0
        /// <summary>
        /// Compara dos Synonyms y devuelve true si son iguales, caso contrario, devuelve false.
        /// </summary>
        public Boolean Compare(FullText destino)
        {
            Database database = (Database)this.Parent;

            if (destino == null)
            {
                throw new ArgumentNullException("destino");
            }
            if (!this.IsAccentSensity.Equals(destino.IsAccentSensity))
            {
                return(false);
            }
            if (!this.IsDefault.Equals(destino.IsDefault))
            {
                return(false);
            }
            if ((!String.IsNullOrEmpty(this.FileGroupName)) && (!String.IsNullOrEmpty(destino.FileGroupName)))
            {
                if (!this.FileGroupName.Equals(destino.FileGroupName))
                {
                    return(false);
                }
            }
            if (database.Options.Ignore.FilterFullTextPath)
            {
                if ((!String.IsNullOrEmpty(this.Path)) && (!String.IsNullOrEmpty(destino.Path)))
                {
                    return(this.Path.Equals(destino.Path, StringComparison.CurrentCultureIgnoreCase));
                }
            }
            return(true);
        }
Пример #2
0
 public void Fill(Database database, string connectionString)
 {
     if (database.Options.Ignore.FilterFullText)
     {
         using (SqlConnection conn = new SqlConnection(connectionString))
         {
             using (SqlCommand command = new SqlCommand(GetSQL(), conn))
             {
                 conn.Open();
                 using (SqlDataReader reader = command.ExecuteReader())
                 {
                     while (reader.Read())
                     {
                         FullText item = new FullText(database);
                         item.Id = (int)reader["fulltext_catalog_id"];
                         item.Name = reader["Name"].ToString();
                         item.Owner = reader["Owner"].ToString();
                         item.IsAccentSensity = (bool)reader["is_accent_sensitivity_on"];
                         item.IsDefault = (bool)reader["is_default"];
                         if (!reader.IsDBNull(reader.GetOrdinal("path")))
                             item.Path = reader["path"].ToString().Substring(0, reader["path"].ToString().Length - item.Name.Length);
                         if (!reader.IsDBNull(reader.GetOrdinal("FileGroupName")))
                             item.FileGroupName = reader["FileGroupName"].ToString();
                         database.FullText.Add(item);
                     }
                 }
             }
         }
     }
 }
Пример #3
0
        public override string ToSql()
        {
            string sql = "";

            sql += FileGroups.ToSql();
            sql += Schemas.ToSql();
            sql += XmlSchemas.ToSql();
            sql += Rules.ToSql();
            sql += UserTypes.ToSql();
            sql += Assemblies.ToSql();
            sql += Tables.ToSql();
            sql += Functions.ToSql();
            sql += Procedures.ToSql();
            sql += CLRProcedures.ToSql();
            sql += CLRFunctions.ToSql();
            sql += DDLTriggers.ToSql();
            sql += Synonyms.ToSql();
            sql += Views.ToSql();
            sql += Users.ToSql();
            sql += PartitionFunctions.ToSql();
            sql += FullText.ToSql();
            return(sql);
        }
Пример #4
0
 /// <summary>
 /// Compara dos Synonyms y devuelve true si son iguales, caso contrario, devuelve false.
 /// </summary>
 public Boolean Compare(FullText destino)
 {
     Database database = (Database)this.Parent;
     if (destino == null) throw new ArgumentNullException("destino");
     if (!this.IsAccentSensity.Equals(destino.IsAccentSensity)) return false;
     if (!this.IsDefault.Equals(destino.IsDefault)) return false;
     if ((!String.IsNullOrEmpty(this.FileGroupName)) && (!String.IsNullOrEmpty(destino.FileGroupName)))
         if (!this.FileGroupName.Equals(destino.FileGroupName)) return false;
     if (database.Options.Ignore.FilterFullTextPath)
         if ((!String.IsNullOrEmpty(this.Path)) && (!String.IsNullOrEmpty(destino.Path)))
             return this.Path.Equals(destino.Path, StringComparison.CurrentCultureIgnoreCase);
     return true;
 }
Пример #5
0
        public override SQLScriptList ToSqlDiff(List <ISchemaBase> schemas)
        {
            var isAzure10 = this.Info.Version == DatabaseInfo.VersionTypeEnum.SQLServerAzure10;

            var listDiff = new SQLScriptList();

            listDiff.Add(new SQLScript(String.Format(@"/*

    Open DBDiff {0}
    http://opendbiff.codeplex.com/

    Script created by {1}\{2} on {3} at {4}.

    Created on:  {5}
    Source:      {6} on {7}
    Destination: {8} on {9}

*/

",
                                                     System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                                                     Environment.UserDomainName,
                                                     Environment.UserName,
                                                     DateTime.Now.ToShortDateString(),
                                                     DateTime.Now.ToLongTimeString(),
                                                     Environment.MachineName,
                                                     SourceInfo != null ? SourceInfo.Database : "Uknown",
                                                     SourceInfo != null ? SourceInfo.Server : "Uknown",
                                                     Info != null ? Info.Database : "Uknown",
                                                     Info != null ? Info.Server : "Uknown",
                                                     0), 0, Enums.ScripActionType.None));
            if (!isAzure10)
            {
                listDiff.Add("USE [" + Name + "]\r\nGO\r\n\r\n", 0, Enums.ScripActionType.UseDatabase);
                listDiff.AddRange(Assemblies.ToSqlDiff(schemas));
                listDiff.AddRange(UserTypes.ToSqlDiff(schemas));
            }
            listDiff.AddRange(TablesTypes.ToSqlDiff(schemas));
            listDiff.AddRange(Tables.ToSqlDiff(schemas));
            listDiff.AddRange(Rules.ToSqlDiff(schemas));
            listDiff.AddRange(Schemas.ToSqlDiff(schemas));
            listDiff.AddRange(XmlSchemas.ToSqlDiff(schemas));
            listDiff.AddRange(Procedures.ToSqlDiff(schemas));
            if (!isAzure10)
            {
                listDiff.AddRange(CLRProcedures.ToSqlDiff(schemas));
                listDiff.AddRange(CLRFunctions.ToSqlDiff(schemas));
                listDiff.AddRange(FileGroups.ToSqlDiff(schemas));
            }
            listDiff.AddRange(DDLTriggers.ToSqlDiff(schemas));
            listDiff.AddRange(Synonyms.ToSqlDiff(schemas));
            listDiff.AddRange(Views.ToSqlDiff(schemas));
            listDiff.AddRange(Users.ToSqlDiff(schemas));
            listDiff.AddRange(Functions.ToSqlDiff(schemas));
            listDiff.AddRange(Roles.ToSqlDiff(schemas));
            listDiff.AddRange(PartitionFunctions.ToSqlDiff(schemas));
            listDiff.AddRange(PartitionSchemes.ToSqlDiff(schemas));
            if (!isAzure10)
            {
                listDiff.AddRange(FullText.ToSqlDiff(schemas));
            }
            return(listDiff);
        }