diff options
-rw-r--r-- | project2/tablepatch.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/project2/tablepatch.cpp b/project2/tablepatch.cpp index 3533b65..aacedbb 100644 --- a/project2/tablepatch.cpp +++ b/project2/tablepatch.cpp @@ -254,7 +254,7 @@ TablePatch::doUpdates(const char * where, const char * order) // Build SQL for list of updates to perform ------------------------ // ----------------------------------------------------------------- Buffer updSql; - updSql.appendf("UPDATE %s SET ", + updSql.appendf("UPDATE %s a SET ", dest.c_str()); bool first = true; foreach (Columns::const_iterator, cols, col) { @@ -276,8 +276,8 @@ TablePatch::doUpdates(const char * where, const char * order) else { updSql.append(" AND "); } - updSql.appendf(" %s.%s = b.%s ", - dest.c_str(), pki->c_str(), pki->c_str()); + updSql.appendf(" a.%s = b.%s ", + pki->c_str(), pki->c_str()); } updSql.append(" AND ("); first = true; @@ -288,10 +288,10 @@ TablePatch::doUpdates(const char * where, const char * order) } first = false; updSql.appendf( - " (((CASE WHEN (%s.%s IS NULL AND b.%s IS NULL) THEN 1 ELSE 0 END) \ - + (CASE WHEN(%s.%s = b.%s) THEN 1 ELSE 0 END)) = 0)", - dest.c_str(), col->c_str(), col->c_str(), - dest.c_str(), col->c_str(), col->c_str()); + " (((CASE WHEN (a.%s IS NULL AND b.%s IS NULL) THEN 1 ELSE 0 END) \ + + (CASE WHEN(a.%s = b.%s) THEN 1 ELSE 0 END)) = 0)", + col->c_str(), col->c_str(), + col->c_str(), col->c_str()); } } updSql.append(")"); |