示例#1
0
        public bool CreateDestination()
        {
            WriteLog(Status.Running, "Creating CDM database...", 0);

            var dbDestination = new DbDestination(_settings.DestinationConnectionString,
                                                  _settings.ConversionSettings.DestinationSchema);

            try
            {
                dbDestination.CreateDatabase(_settings.CreateCdmDatabaseScript);
                WriteLog(Status.Running, "CDM database created", 0);
            }
            catch (Exception e)
            {
                WriteLog(Status.Running, "Warning: CDM database exists", 0);
            }

            try
            {
                dbDestination.CreateSchema();
                WriteLog(Status.Running, "Schema created", 0);
            }
            catch (Exception e)
            {
                WriteLog(Status.Running, "Warning: CDM schema exists", 0);
            }

            bool successful;

            try
            {
                dbDestination.ExecuteQuery(_settings.CreateCdmTablesScript);
                WriteLog(Status.Running, "CDM tables created", 0);

                successful = true;
            }
            catch (Exception e)
            {
                WriteLog(Status.Running, "Warning: CDM tables exists", 0);
                try
                {
                    dbDestination.ExecuteQuery(_settings.TruncateTablesScript);
                    WriteLog(Status.Running, "CDM tables truncated", 0);
                    successful = true;
                }
                catch (Exception e2)
                {
                    WriteLog(Status.Failed, e2.Message, 0);
                    throw e2;
                }
            }

            return(successful);
        }
        public void FillPostBuildTables()
        {
            var dbDestination = new DbDestination(Settings.Settings.Current.Building.DestinationConnectionString,
                                                  Settings.Settings.Current.Building.DestinationSchemaName);

            if (!string.IsNullOrEmpty(Settings.Settings.Current.Building.CdmSourceScript))
            {
                dbDestination.ExecuteQuery(Settings.Settings.Current.Building.CdmSourceScript);
            }

            if (!string.IsNullOrEmpty(Settings.Settings.Current.Building.CohortDefinitionScript))
            {
                dbDestination.ExecuteQuery(Settings.Settings.Current.Building.CohortDefinitionScript);
            }
        }
示例#3
0
        public void TruncateLookup()
        {
            var dbDestination = new DbDestination(Settings.Current.Building.DestinationConnectionString,
                                                  Settings.Current.Building.CdmSchema);

            dbDestination.ExecuteQuery(Settings.Current.TruncateLookupScript);
        }
示例#4
0
        public void DropDestination()
        {
            var dbDestination = new DbDestination(Settings.Current.Building.DestinationConnectionString,
                                                  Settings.Current.Building.CdmSchema);

            dbDestination.ExecuteQuery(Settings.Current.DropTablesScript);
        }
示例#5
0
        public void CreateTablesStep()
        {
            var dbDestination = new DbDestination(Settings.Current.Building.DestinationConnectionString,
                                                  Settings.Current.Building.CdmSchema);

            dbDestination.ExecuteQuery(Settings.Current.CreateCdmTablesScript);
        }
示例#6
0
        public void ResetVocabularyStep()
        {
            var dbDestination = new DbDestination(Settings.Current.Building.DestinationConnectionString,
                                                  Settings.Current.Building.CdmSchema);

            dbDestination.ExecuteQuery(Settings.Current.DropVocabularyTablesScript);
        }
示例#7
0
        public void TruncateWithoutLookupTables()
        {
            var dbDestination = new DbDestination(Settings.Settings.Current.Building.DestinationConnectionString,
                                                  Settings.Settings.Current.Building.DestinationSchemaName);

            dbDestination.ExecuteQuery(Settings.Settings.Current.TruncateWithoutLookupTablesScript);
        }
示例#8
0
        public void DropDestination()
        {
            var dbDestination = new DbDestination(Settings.Settings.Current.Building.DestinationConnectionString,
                                                  Settings.Settings.Current.Building.DestinationSchemaName);

            dbDestination.ExecuteQuery(Settings.Settings.Current.DropTablesScript);
            //dbDestination.DropDatabase();
        }
示例#9
0
        public bool CreateDestination()
        {
            _logHub.Clients.All.SendAsync("Log", "Creating CDM database...").Wait();

            var dbDestination = new DbDestination(_settings.DestinationConnectionString,
                                                  _settings.ConversionSettings.DestinationSchema);

            try
            {
                dbDestination.CreateDatabase(_settings.CreateCdmDatabaseScript);
                _logHub.Clients.All.SendAsync("Log", "CDM database created").Wait();
            }
            catch (Exception e)
            {
                _logHub.Clients.All.SendAsync("Log", "Warning: " + e.Message).Wait();
            }

            bool successful;

            try
            {
                dbDestination.ExecuteQuery(_settings.CreateCdmTablesScript);
                _logHub.Clients.All.SendAsync("Log", "CDM tables created").Wait();

                successful = true;
            }
            catch (Exception e)
            {
                _logHub.Clients.All.SendAsync("Log", "Warning: CDM tables " + e.Message).Wait();
                try
                {
                    dbDestination.ExecuteQuery(_settings.TruncateTablesScript);
                    _logHub.Clients.All.SendAsync("Log", "CDM tables truncated").Wait();
                    successful = true;
                }
                catch (Exception e2)
                {
                    throw e2;
                }
            }

            return(successful);
        }
示例#10
0
        public void CreateDestination()
        {
            PerformAction(() =>
            {
                var dbDestination = new DbDestination(Settings.Current.Building.DestinationConnectionString,
                                                      Settings.Current.Building.CdmSchema);

                dbDestination.CreateDatabase(Settings.Current.CreateCdmDatabaseScript);
                dbDestination.ExecuteQuery(Settings.Current.CreateCdmTablesScript);
            });
        }
示例#11
0
        public void CreateDestination()
        {
            PerformAction(() =>
            {
                var dbDestination = new DbDestination(Settings.Settings.Current.Building.DestinationConnectionString,
                                                      Settings.Settings.Current.Building.DestinationSchemaName);


                if (Settings.Settings.Current.Building.DestinationEngine.Database != Database.Redshift)
                {
                    dbDestination.CreateDatabase(Settings.Settings.Current.CreateCdmDatabaseScript);
                }

                dbDestination.ExecuteQuery(Settings.Settings.Current.CreateCdmTablesScript);
            });
        }