Skip to content
Browse files

more case sensitivity bugs

  • Loading branch information...
1 parent d5f3344 commit a56808cecebc548eae0c1b47493495f434d9da43 @ssandler ssandler committed Feb 21, 2013
Showing with 8 additions and 6 deletions.
  1. +8 −6 TeslaSQL/Agents/Slave.cs
View
14 TeslaSQL/Agents/Slave.cs
@@ -362,7 +362,8 @@ public Slave(IDataUtils sourceDataUtils, IDataUtils destDataUtils, Logger logger
//map each table to the last appropriate CT table, ditching tableconfs with no corresponding CT tables
var tableCTName = new Dictionary<TableConf, string>();
foreach (var table in tables) {
- ChangeTable changeTable = existingCTTables.Where(ct => ct.name == table.Name).OrderBy(ct => ct.CTID).LastOrDefault();
+ ChangeTable changeTable = existingCTTables.Where(ct => String.Compare(ct.name, table.Name, StringComparison.OrdinalIgnoreCase) == 0).OrderBy(ct => ct.CTID).LastOrDefault();
+
if (changeTable == null) {
continue;
}
@@ -376,7 +377,7 @@ public Slave(IDataUtils sourceDataUtils, IDataUtils destDataUtils, Logger logger
//tableCTName.Keys instead of tables because we've already filtered this for tables that don't have change tables
//note: allColumnsByTable.Keys or primaryKeysByTable.Keys should work just as well
- foreach (var table in tableCTName.Keys) {
+ foreach (var table in tableCTName.Keys) {
IEnumerable<TColumn> columns;
try {
//this is a hacky solution but we will have these columns in CT tables but actually are not interested in them here.
@@ -389,7 +390,7 @@ public Slave(IDataUtils sourceDataUtils, IDataUtils destDataUtils, Logger logger
}
IList<string> pks;
try {
- pks = primaryKeysByTable[table];
+ pks = primaryKeysByTable[table];
} catch (KeyNotFoundException) {
var e = new Exception("Primary keys for table " + table.FullName + " not found in " + dbName + ".dbo.tblCTTableInfo_" + batch.CTID);
HandleException(e, table);
@@ -474,7 +475,7 @@ public Slave(IDataUtils sourceDataUtils, IDataUtils destDataUtils, Logger logger
protected Dictionary<TableConf, TableConf> ValidTablesAndArchives(IEnumerable<ChangeTable> changeTables, Int64 CTID) {
var hasArchive = new Dictionary<TableConf, TableConf>();
foreach (var confTable in Config.Tables) {
- if (!changeTables.Any(s => s.name == confTable.Name)) {
+ if (!changeTables.Any(s => String.Compare(s.name, confTable.Name, StringComparison.OrdinalIgnoreCase) == 0)) {
continue;
}
if (hasArchive.ContainsKey(confTable)) {
@@ -484,9 +485,10 @@ public Slave(IDataUtils sourceDataUtils, IDataUtils destDataUtils, Logger logger
if (confTable.Name.EndsWith("Archive")) {
//if we have an archive table, we want to check if we also have the non-archive version of it configured in CT
string nonArchiveTableName = confTable.Name.Substring(0, confTable.Name.Length - confTable.Name.LastIndexOf("Archive") + 1);
- if (changeTables.Any(s => s.name == nonArchiveTableName)) {
+ if (changeTables.Any(s => String.Compare(s.name, nonArchiveTableName, StringComparison.OrdinalIgnoreCase) == 0)) {
//if the non-archive table has any changes, we grab the associated table configuration and pair them
- var nonArchiveTable = Config.Tables.First(t => t.Name == nonArchiveTableName);
+ var nonArchiveTable = Config.Tables.First(t => String.Compare(t.Name, nonArchiveTableName, StringComparison.OrdinalIgnoreCase) == 0);
+
hasArchive[nonArchiveTable] = confTable;
} else {
//otherwise we just go ahead and treat the archive CT table as a normal table

0 comments on commit a56808c

Please sign in to comment.
Something went wrong with that request. Please try again.