MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / sem_same_rows

Function sem_same_rows

tests/test_pipeline.c:21755–21783  ·  view source on GitHub ↗

Step both statements in lockstep; every column of every row must match. */

Source from the content-addressed store, hash-verified

21753
21754/* Step both statements in lockstep; every column of every row must match. */
21755static bool sem_same_rows(sqlite3 *a, sqlite3 *b, const char *sql, int *rows) {
21756 sqlite3_stmt *sa = NULL;
21757 sqlite3_stmt *sb = NULL;
21758 bool same = sqlite3_prepare_v2(a, sql, -1, &sa, NULL) == SQLITE_OK &&
21759 sqlite3_prepare_v2(b, sql, -1, &sb, NULL) == SQLITE_OK;
21760 *rows = 0;
21761 while (same) {
21762 int ra = sqlite3_step(sa);
21763 int rb = sqlite3_step(sb);
21764 if (ra != rb) {
21765 same = false;
21766 break;
21767 }
21768 if (ra != SQLITE_ROW) {
21769 break;
21770 }
21771 int cols = sqlite3_column_count(sa);
21772 for (int c = 0; c < cols && same; c++) {
21773 const unsigned char *va = sqlite3_column_text(sa, c);
21774 const unsigned char *vb = sqlite3_column_text(sb, c);
21775 same = (va == NULL) == (vb == NULL) &&
21776 (!va || strcmp((const char *)va, (const char *)vb) == 0);
21777 }
21778 (*rows)++;
21779 }
21780 sqlite3_finalize(sa);
21781 sqlite3_finalize(sb);
21782 return same;
21783}
21784
21785TEST(pipeline_semantic_batched_matches_unbatched) {
21786 char tmp[256];

Callers 1

test_pipeline.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected