Esempio n. 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);
        }
Esempio n. 2
0
        /*public List<ISchemaBase> FindAllByColumn(String ColumnName)
         * {
         *  this.t
         * }*/

        public override SQLScriptList ToSqlDiff()
        {
            var listDiff = new SQLScriptList();

            listDiff.Add("USE [" + Name + "]\r\nGO\r\n\r\n", 0, Enums.ScripActionType.UseDatabase);
            listDiff.AddRange(Assemblies.ToSqlDiff());
            listDiff.AddRange(Defaults.ToSqlDiff());
            listDiff.AddRange(UserTypes.ToSqlDiff());
            listDiff.AddRange(TablesTypes.ToSqlDiff());
            listDiff.AddRange(Tables.ToSqlDiff());
            listDiff.AddRange(Rules.ToSqlDiff());
            listDiff.AddRange(Schemas.ToSqlDiff());
            listDiff.AddRange(XmlSchemas.ToSqlDiff());
            listDiff.AddRange(Procedures.ToSqlDiff());
            listDiff.AddRange(CLRProcedures.ToSqlDiff());
            listDiff.AddRange(CLRFunctions.ToSqlDiff());
            listDiff.AddRange(FileGroups.ToSqlDiff());
            listDiff.AddRange(DDLTriggers.ToSqlDiff());
            listDiff.AddRange(Synonyms.ToSqlDiff());
            listDiff.AddRange(Views.ToSqlDiff());
            listDiff.AddRange(Users.ToSqlDiff());
            listDiff.AddRange(Functions.ToSqlDiff());
            listDiff.AddRange(Roles.ToSqlDiff());
            listDiff.AddRange(PartitionFunctions.ToSqlDiff());
            listDiff.AddRange(PartitionSchemes.ToSqlDiff());
            listDiff.AddRange(FullText.ToSqlDiff());
            return(listDiff);
        }
Esempio n. 3
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);
                     }
                 }
             }
         }
     }
 }
Esempio n. 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;
 }
Esempio n. 5
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);
        }
Esempio n. 6
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);
        }
Esempio n. 7
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(@"/*

    数据库差异脚本

    脚本创建于: {1}\{2}   时间: {3} {4}

    创建人:{5}
    参考数据库:{6}   地址:{7}
    目标数据库:{8}   地址:{9}

*/
",
                                                     System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                                                     Environment.UserDomainName,
                                                     Environment.MachineName,
                                                     DateTime.Now.ToShortDateString(),
                                                     DateTime.Now.ToLongTimeString(),
                                                     Environment.UserName,
                                                     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);
        }