Lines Matching refs:sql

470       Str sql;  in dump_table()  local
471 strInit(&sql); in dump_table()
474 strPrintf(&sql, "%s %s", zSep, az[i]); in dump_table()
477 strPrintf(&sql," FROM aux.%s", zId); in dump_table()
480 strPrintf(&sql, "%s %d", zSep, i); in dump_table()
483 pStmt = db_prepare("%s", sql.z); in dump_table()
484 strFree(&sql); in dump_table()
534 Str sql; /* Comparison query */ in diff_one_table() local
539 strInit(&sql); in diff_one_table()
605 strPrintf(&sql, "%sB.%s", zSep, az[i]); in diff_one_table()
608 strPrintf(&sql, ", 1%s -- changed row\n", nPk==n ? "" : ","); in diff_one_table()
610 strPrintf(&sql, " A.%s IS NOT B.%s, B.%s%s\n", in diff_one_table()
615 strPrintf(&sql, " B.%s IS NOT NULL, B.%s%s\n", in diff_one_table()
619 strPrintf(&sql, " FROM main.%s A, aux.%s B\n", zId, zId); in diff_one_table()
622 strPrintf(&sql, "%s A.%s=B.%s", zSep, az[i], az[i]); in diff_one_table()
627 strPrintf(&sql, "%sA.%s IS NOT B.%s%s\n", in diff_one_table()
633 strPrintf(&sql, "%sB.%s IS NOT NULL%s\n", in diff_one_table()
638 strPrintf(&sql, " UNION ALL\n"); in diff_one_table()
642 strPrintf(&sql, "%sA.%s", zSep, az[i]); in diff_one_table()
645 strPrintf(&sql, ", 2%s -- deleted row\n", nPk==n ? "" : ","); in diff_one_table()
647 strPrintf(&sql, " NULL, NULL%s\n", i==n2-1 ? "" : ","); in diff_one_table()
650 strPrintf(&sql, " FROM main.%s A\n", zId); in diff_one_table()
651 strPrintf(&sql, " WHERE NOT EXISTS(SELECT 1 FROM aux.%s B\n", zId); in diff_one_table()
654 strPrintf(&sql, "%s A.%s=B.%s", zSep, az[i], az[i]); in diff_one_table()
657 strPrintf(&sql, ")\n"); in diff_one_table()
660 strPrintf(&sql, "%sB.%s", zSep, az[i]); in diff_one_table()
663 strPrintf(&sql, ", 3%s -- inserted row\n", nPk==n ? "" : ","); in diff_one_table()
665 strPrintf(&sql, " 1, B.%s%s\n", az2[i], az2[i+1]==0 ? "" : ","); in diff_one_table()
668 strPrintf(&sql, " FROM aux.%s B\n", zId); in diff_one_table()
669 strPrintf(&sql, " WHERE NOT EXISTS(SELECT 1 FROM main.%s A\n", zId); in diff_one_table()
672 strPrintf(&sql, "%s A.%s=B.%s", zSep, az[i], az[i]); in diff_one_table()
675 strPrintf(&sql, ")\n ORDER BY"); in diff_one_table()
678 strPrintf(&sql, "%s%d", zSep, i); in diff_one_table()
681 strPrintf(&sql, ";\n"); in diff_one_table()
684 printf("SQL for %s:\n%s\n", zId, sql.z); in diff_one_table()
706 pStmt = db_prepare("%s", sql.z); in diff_one_table()
764 strFree(&sql); in diff_one_table()
1266 Str sql = {0, 0, 0}; /* Query to find differences */ in rbudiff_one_table() local
1292 getRbudiffQuery(zTab, azCol, nPK, bOtaRowid, &sql); in rbudiff_one_table()
1301 pStmt = db_prepare("%s", sql.z); in rbudiff_one_table()
1377 strFree(&sql); in rbudiff_one_table()
1400 Str sql; /* Comparison query */ in summarize_one_table() local
1407 strInit(&sql); in summarize_one_table()
1441 strPrintf(&sql, "SELECT 1, count(*)"); in summarize_one_table()
1443 strPrintf(&sql, ", 0\n"); in summarize_one_table()
1447 strPrintf(&sql, "%sA.%s IS NOT B.%s", zSep, az[i], az[i]); in summarize_one_table()
1450 strPrintf(&sql, ")\n"); in summarize_one_table()
1452 strPrintf(&sql, " FROM main.%s A, aux.%s B\n", zId, zId); in summarize_one_table()
1455 strPrintf(&sql, "%s A.%s=B.%s", zSep, az[i], az[i]); in summarize_one_table()
1458 strPrintf(&sql, " UNION ALL\n"); in summarize_one_table()
1459 strPrintf(&sql, "SELECT 2, count(*), 0\n"); in summarize_one_table()
1460 strPrintf(&sql, " FROM main.%s A\n", zId); in summarize_one_table()
1461 strPrintf(&sql, " WHERE NOT EXISTS(SELECT 1 FROM aux.%s B ", zId); in summarize_one_table()
1464 strPrintf(&sql, "%s A.%s=B.%s", zSep, az[i], az[i]); in summarize_one_table()
1467 strPrintf(&sql, ")\n"); in summarize_one_table()
1468 strPrintf(&sql, " UNION ALL\n"); in summarize_one_table()
1469 strPrintf(&sql, "SELECT 3, count(*), 0\n"); in summarize_one_table()
1470 strPrintf(&sql, " FROM aux.%s B\n", zId); in summarize_one_table()
1471 strPrintf(&sql, " WHERE NOT EXISTS(SELECT 1 FROM main.%s A ", zId); in summarize_one_table()
1474 strPrintf(&sql, "%s A.%s=B.%s", zSep, az[i], az[i]); in summarize_one_table()
1477 strPrintf(&sql, ")\n ORDER BY 1;\n"); in summarize_one_table()
1480 printf("SQL for %s:\n%s\n", zId, sql.z); in summarize_one_table()
1485 pStmt = db_prepare("%s", sql.z); in summarize_one_table()
1509 strFree(&sql); in summarize_one_table()
1589 Str sql; /* SQL for the diff query */ in changeset_one_table() local
1595 strInit(&sql); in changeset_one_table()
1618 strPrintf(&sql, "SELECT %d", SQLITE_UPDATE); in changeset_one_table()
1621 strPrintf(&sql, ",\n A.%s", azCol[i]); in changeset_one_table()
1623 strPrintf(&sql, ",\n A.%s IS NOT B.%s, A.%s, B.%s", in changeset_one_table()
1627 strPrintf(&sql,"\n FROM main.%s A, aux.%s B\n", zId, zId); in changeset_one_table()
1630 strPrintf(&sql, "%s A.%s=B.%s", zSep, azCol[aiPk[i]], azCol[aiPk[i]]); in changeset_one_table()
1636 strPrintf(&sql, "%sA.%s IS NOT B.%s", zSep, azCol[i], azCol[i]); in changeset_one_table()
1639 strPrintf(&sql,")\n UNION ALL\n"); in changeset_one_table()
1641 strPrintf(&sql, "SELECT %d", SQLITE_DELETE); in changeset_one_table()
1644 strPrintf(&sql, ",\n A.%s", azCol[i]); in changeset_one_table()
1646 strPrintf(&sql, ",\n 1, A.%s, NULL", azCol[i]); in changeset_one_table()
1649 strPrintf(&sql, "\n FROM main.%s A\n", zId); in changeset_one_table()
1650 strPrintf(&sql, " WHERE NOT EXISTS(SELECT 1 FROM aux.%s B\n", zId); in changeset_one_table()
1653 strPrintf(&sql, "%s A.%s=B.%s", zSep, azCol[aiPk[i]], azCol[aiPk[i]]); in changeset_one_table()
1656 strPrintf(&sql, ")\n UNION ALL\n"); in changeset_one_table()
1657 strPrintf(&sql, "SELECT %d", SQLITE_INSERT); in changeset_one_table()
1660 strPrintf(&sql, ",\n B.%s", azCol[i]); in changeset_one_table()
1662 strPrintf(&sql, ",\n 1, NULL, B.%s", azCol[i]); in changeset_one_table()
1665 strPrintf(&sql, "\n FROM aux.%s B\n", zId); in changeset_one_table()
1666 strPrintf(&sql, " WHERE NOT EXISTS(SELECT 1 FROM main.%s A\n", zId); in changeset_one_table()
1669 strPrintf(&sql, "%s A.%s=B.%s", zSep, azCol[aiPk[i]], azCol[aiPk[i]]); in changeset_one_table()
1672 strPrintf(&sql, ")\n"); in changeset_one_table()
1673 strPrintf(&sql, " ORDER BY"); in changeset_one_table()
1676 strPrintf(&sql, "%s %d", zSep, aiPk[i]+2); in changeset_one_table()
1679 strPrintf(&sql, ";\n"); in changeset_one_table()
1682 printf("SQL for %s:\n%s\n", zId, sql.z); in changeset_one_table()
1692 pStmt = db_prepare("%s", sql.z); in changeset_one_table()
1759 strFree(&sql); in changeset_one_table()