diff options
author | drh <> | 2023-05-27 20:08:23 +0000 |
---|---|---|
committer | drh <> | 2023-05-27 20:08:23 +0000 |
commit | 4308b88dcdab08d8f7ead46e46c29180c1496585 (patch) | |
tree | 4ee000a6d43ac4133340604c538bb8cc0adb8d09 /tool/sqldiff.c | |
parent | 870fe69c727320c90cd04229f2b09d32611fa20b (diff) | |
download | sqlite-4308b88dcdab08d8f7ead46e46c29180c1496585.tar.gz sqlite-4308b88dcdab08d8f7ead46e46c29180c1496585.zip |
Fix an issue with sqldiff reported by
[forum:/info/9bd2155bdfae25a7|forum post 9bd2155bdfae25a7].
FossilOrigin-Name: 736a79c1491065f4ee77ce644af0e529e555ca733c78dbd55487d55d4ddbe5bd
Diffstat (limited to 'tool/sqldiff.c')
-rw-r--r-- | tool/sqldiff.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tool/sqldiff.c b/tool/sqldiff.c index 0a017037c..5477ff97f 100644 --- a/tool/sqldiff.c +++ b/tool/sqldiff.c @@ -605,18 +605,18 @@ static void diff_one_table(const char *zTab, FILE *out){ strPrintf(&sql, "%sB.%s", zSep, az[i]); zSep = ", "; } - strPrintf(&sql, ", 1%s -- changed row\n", nPk==n ? "" : ","); + strPrintf(&sql, ", 1 /* changed row */"); while( az[i] ){ - strPrintf(&sql, " A.%s IS NOT B.%s, B.%s%s\n", - az[i], az2[i], az2[i], az2[i+1]==0 ? "" : ","); + strPrintf(&sql, ", A.%s IS NOT B.%s, B.%s", + az[i], az2[i], az2[i]); i++; } while( az2[i] ){ - strPrintf(&sql, " B.%s IS NOT NULL, B.%s%s\n", - az2[i], az2[i], az2[i+1]==0 ? "" : ","); + strPrintf(&sql, ", B.%s IS NOT NULL, B.%s", + az2[i], az2[i]); i++; } - strPrintf(&sql, " FROM main.%s A, aux.%s B\n", zId, zId); + strPrintf(&sql, "\n FROM main.%s A, aux.%s B\n", zId, zId); zSep = " WHERE"; for(i=0; i<nPk; i++){ strPrintf(&sql, "%s A.%s=B.%s", zSep, az[i], az[i]); @@ -642,12 +642,12 @@ static void diff_one_table(const char *zTab, FILE *out){ strPrintf(&sql, "%sA.%s", zSep, az[i]); zSep = ", "; } - strPrintf(&sql, ", 2%s -- deleted row\n", nPk==n ? "" : ","); + strPrintf(&sql, ", 2 /* deleted row */"); while( az2[i] ){ - strPrintf(&sql, " NULL, NULL%s\n", i==n2-1 ? "" : ","); + strPrintf(&sql, ", NULL, NULL"); i++; } - strPrintf(&sql, " FROM main.%s A\n", zId); + strPrintf(&sql, "\n FROM main.%s A\n", zId); strPrintf(&sql, " WHERE NOT EXISTS(SELECT 1 FROM aux.%s B\n", zId); zSep = " WHERE"; for(i=0; i<nPk; i++){ @@ -660,12 +660,12 @@ static void diff_one_table(const char *zTab, FILE *out){ strPrintf(&sql, "%sB.%s", zSep, az[i]); zSep = ", "; } - strPrintf(&sql, ", 3%s -- inserted row\n", nPk==n ? "" : ","); + strPrintf(&sql, ", 3 /* inserted row */"); while( az2[i] ){ - strPrintf(&sql, " 1, B.%s%s\n", az2[i], az2[i+1]==0 ? "" : ","); + strPrintf(&sql, ", 1, B.%s", az2[i]); i++; } - strPrintf(&sql, " FROM aux.%s B\n", zId); + strPrintf(&sql, "\n FROM aux.%s B\n", zId); strPrintf(&sql, " WHERE NOT EXISTS(SELECT 1 FROM main.%s A\n", zId); zSep = " WHERE"; for(i=0; i<nPk; i++){ |