Update the sqldiff tool so that it generates an rbu_count table.

FossilOrigin-Name: 1f7afb6e9be9f549a91bf2ab492df15698df89fd
diff --git a/tool/sqldiff.c b/tool/sqldiff.c
index d2423a7..319acaf 100644
--- a/tool/sqldiff.c
+++ b/tool/sqldiff.c
@@ -1244,6 +1244,7 @@
   Str sql = {0, 0, 0};            /* Query to find differences */
   Str insert = {0, 0, 0};         /* First part of output INSERT statement */
   sqlite3_stmt *pStmt = 0;
+  int nRow = 0;                   /* Total rows in data_xxx table */
 
   /* --rbu mode must use real primary keys. */
   g.bSchemaPK = 1;
@@ -1289,6 +1290,7 @@
 
     /* Output the first part of the INSERT statement */
     fprintf(out, "%s", insert.z);
+    nRow++;
 
     if( sqlite3_column_type(pStmt, nCol)==SQLITE_INTEGER ){
       for(i=0; i<=nCol; i++){
@@ -1342,6 +1344,12 @@
   }
 
   sqlite3_finalize(pStmt);
+  if( nRow>0 ){
+    Str cnt = {0, 0, 0};
+    strPrintf(&cnt, "INSERT INTO rbu_count VALUES('data_%q', %d);", zTab, nRow);
+    fprintf(out, "%s\n", cnt.z);
+    strFree(&cnt);
+  }
 
   strFree(&ct);
   strFree(&sql);
@@ -1856,7 +1864,13 @@
   }
 
   if( neverUseTransaction ) useTransaction = 0;
-  if( useTransaction ) printf("BEGIN TRANSACTION;\n");
+  if( useTransaction ) fprintf(out, "BEGIN TRANSACTION;\n");
+  if( xDiff==rbudiff_one_table ){
+    fprintf(out, "CREATE TABLE IF NOT EXISTS rbu_count"
+           "(tbl TEXT PRIMARY KEY COLLATE NOCASE, cnt INTEGER) "
+           "WITHOUT ROWID;\n"
+    );
+  }
   if( zTab ){
     xDiff(zTab, out);
   }else{