예제 #1
0
        //private const String s_ProductEventsView =
        //    "CREATE VIEW [ProductEvents_Vw] AS " +
        //    "SELECT E.EventId, E.DateCreatedLocal, E.DateModifiedLocal,E.ApplicationName, E.ApplicationVersion, E.ApplicationTimeStamp, E.TotalHits, " +
        //    "       E.ModuleName, E.ModuleVersion, E.ModuleTimeStamp, E.Offset, E.ExceptionCode, E.OffsetOriginal, E.ExceptionCodeOriginal, ET.EventTypeName, " +
        //    "       E.BugId, FE.FileId " +
        //    "FROM dbo.Events E " +
        //    "INNER JOIN dbo.EventTypes ET " +
        //    "   ON ET.EventTypeId=E.EventTypeId " +
        //    "INNER JOIN dbo.FileEvents FE " +
        //    "   ON FE.EventId=E.EventId AND FE.EventTypeId=E.EventTypeId " +
        //    "INNER JOIN dbo.ProductFiles PF " +
        //    "   ON PF.FileId=FE.EventId AND PF.ProductId=@ProductId ";



        /// <summary>
        /// Beta 95 sees the introduction of the UpdateTable.
        /// </summary>
        /// <returns>True - update applied. False - not necessary.</returns>
        public static void UpdateBeta95(SqlUtils sqlUtils, String databaseName, DbConnection connection)
        {
            // Add the update table.
            sqlUtils.ExecuteNonQuery(s_UpdateTable, connection);

            // Adds the new bug reference field to the Event.
            sqlUtils.ExecuteNonQuery(s_AddPlugInBugReferenceToEventTable, connection);
        }
예제 #2
0
        /// <summary>
        /// 1.20 added the Mappings table for workflow values.
        /// </summary>
        /// <returns>True - update applied. False - not necessary.</returns>
        public static void Update1_20(SqlUtils sqlUtils, String databaseName, DbConnection connection)
        {
            // Add the work flow mappings table.
            sqlUtils.ExecuteNonQuery(s_WorkFlowMappingsTable, connection);

            // Add the group mappings table.
            sqlUtils.ExecuteNonQuery(s_GroupMappingsTable, connection);

            // Adds the new workflow status to the Event.
            sqlUtils.ExecuteNonQuery(s_AddWorkFlowStatusToEventTable, connection);
        }
예제 #3
0
        /// <summary>
        /// Creates a database for the stackhash data with the specified name.
        /// Selects the database.
        /// Creates the tables in the database.
        /// </summary>
        /// <param name="sqlUtils"></param>
        /// <param name="databaseFolder">Folder where the database is to be stored.</param>
        /// <param name="databaseName">Name of the database.</param>
        /// <returns>True - database was created. False - already exists.</returns>
        public static bool CreateStackHashDatabase(SqlUtils sqlUtils, String databaseFolder, String databaseName, bool createIndexInDefaultLocation)
        {
            DbConnection connection = sqlUtils.CreateConnection(true);

            try
            {
                // Check if the database exists first.
                if (sqlUtils.DatabaseExists(databaseName, connection))
                {
                    // Select the new database as the active one.
                    sqlUtils.SelectDatabase(databaseName, connection);

                    // Do upgrades here.
                    UpdateBeta95(sqlUtils, databaseName, connection);
                    Update1_20(sqlUtils, databaseName, connection);

                    // Deselect the database.
                    sqlUtils.SelectDatabase("MASTER", connection);

                    return(false);
                }

                // Create the database itself.
                sqlUtils.CreateDatabase(databaseFolder, databaseName, connection, createIndexInDefaultLocation);

                // Select the new database as the active one.
                sqlUtils.SelectDatabase(databaseName, connection);

                // Create the control table. This table contains general global information.
                sqlUtils.ExecuteNonQuery(s_ControlTable, connection);

                // Create the product control table. This table contains general control information for each product.
                sqlUtils.ExecuteNonQuery(s_ProductControlTable, connection);

                // Create the task status table. This table contains general global information about tasks being run.
                sqlUtils.ExecuteNonQuery(s_TaskControlTable, connection);

                // Create the operating system table.
                sqlUtils.ExecuteNonQuery(s_OperatingSystemTable, connection);

                // Create the locales table.
                sqlUtils.ExecuteNonQuery(s_LocalesTable, connection);

                // Create the event types table.
                sqlUtils.ExecuteNonQuery(s_EventTypesTable, connection);

                // Create the products table.
                sqlUtils.ExecuteNonQuery(s_ProductsTable, connection);

                // Create the files table.
                sqlUtils.ExecuteNonQuery(s_FilesTable, connection);

                // Create the product files table.
                sqlUtils.ExecuteNonQuery(s_ProductFilesTable, connection);

                // Create the events table.
                sqlUtils.ExecuteNonQuery(s_EventsTable, connection);

                // Create the file events table.
                sqlUtils.ExecuteNonQuery(s_FileEventsTable, connection);

                // Create the event infos table.
                sqlUtils.ExecuteNonQuery(s_EventInfoTable, connection);

                // Create the cabs table.
                sqlUtils.ExecuteNonQuery(s_CabsTable, connection);

                // Create the cab notes table.
                sqlUtils.ExecuteNonQuery(s_CabNotesTable, connection);

                // Create the users table.
                sqlUtils.ExecuteNonQuery(s_UsersTable, connection);

                // Create the source table.
                sqlUtils.ExecuteNonQuery(s_SourceTable, connection);

                // Create the event notes table.
                sqlUtils.ExecuteNonQuery(s_EventNotesTable, connection);

                // Add the Locale summary table.
                sqlUtils.ExecuteNonQuery(s_LocaleSummaryTable, connection);

                // Add the operating system summary table.
                sqlUtils.ExecuteNonQuery(s_OperatingSystemSummaryTable, connection);

                // Add the hit date summary table.
                sqlUtils.ExecuteNonQuery(s_HitDateSummaryTable, connection);

                // Additions for Beta95.
                UpdateBeta95(sqlUtils, databaseName, connection);

                // Additions for 1.20.
                Update1_20(sqlUtils, databaseName, connection);

                // Deselect the database.
                sqlUtils.SelectDatabase("MASTER", connection);

                return(true);
            }
            finally
            {
                if (connection != null)
                {
                    sqlUtils.ReleaseConnection(connection);
                }
            }
        }