コード例 #1
0
        private static void CheckSamePrimaryKeyColumns(List <Dictionary <string, PrimaryKeyInfo> > allPkInfo, StagingTablesBuilder b)
        {
            // checks that all source timetables have identical primary key col names for
            // the tables that are to be extracted, which is an important consideration when
            // performing the full database diff...
            foreach (var tableName in b.GetTableNames(includePseudoRegisterMarkTable: false))
            {
                PrimaryKeyInfo baseInfo = null;

                foreach (var info in allPkInfo)
                {
                    var pkInfo = info[tableName];
                    if (pkInfo == null)
                    {
                        throw new ApplicationException($"Could not find primary key data for table: {tableName}");
                    }

                    if (baseInfo == null)
                    {
                        baseInfo = pkInfo;
                    }
                    else
                    {
                        if (!PrimaryKeyInfo.Identical(baseInfo, pkInfo))
                        {
                            var sb = new StringBuilder();
                            sb.Append("There is an incompatibility between source timetables.");
                            sb.AppendFormat(" Primary key column definitions are different for table {0}", tableName);

                            throw new ApplicationException(sb.ToString());
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: StagingSchema.cs プロジェクト: CELCAT/CTDataStore
        private bool DoParallelProcessing(StagingTablesBuilder b)
        {
            var rv = true;

            var pOptions = new ParallelOptions {
                MaxDegreeOfParallelism = MaxDegreeOfParallelism
            };

            Parallel.ForEach(b.GetTableNames(), pOptions, (t, loopState) =>
            {
                if (!loopState.IsExceptional && !DatabaseUtils.TableExists(ConnectionString, TimeoutSecs, t, _schemaName))
                {
                    rv = false;
                    loopState.Stop();
                }
            });

            return(rv);
        }