SQLite

Check-in [99827144f1]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Have sqlite3session_diff() automatically attach tables to session objects, as it has always been documented to do.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 99827144f112303e27a829c990b1858d227bd7369095100a435c367637985fad
User & Date: dan 2025-04-08 17:18:01.341
Context
2025-04-08
20:00
Remove an incorrect ALWAYS() macro. Forum post 2025-04-08T19:16:42Z. (check-in: 062cca9c63 user: drh tags: trunk)
17:18
Have sqlite3session_diff() automatically attach tables to session objects, as it has always been documented to do. (check-in: 99827144f1 user: dan tags: trunk)
15:58
Have sqlite3session_diff() automatically attach tables to session objects, as it has always been documented to do. (Closed-Leaf check-in: ec1641858e user: dan tags: sessions-diff-autoattach)
2025-04-07
18:29
During the post-configure validation of @VAR@ references, ignore commented-out references in files which seem (based on their name) to be makefiles, as it's sometimes handy to comment-out such vars during development of a configure script and its corresponding makefile(s). (check-in: 25d936b7b2 user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/session/sessionD.test.
225
226
227
228
229
230
231




























232
233
  S attach t8
  list [catch { S diff ixua t8 } msg] $msg
} {0 {}}
S delete
do_catchsql_test 4.5.2 {
  SELECT * FROM ixua.i8;
} {1 {no such table: ixua.i8}}





























finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
  S attach t8
  list [catch { S diff ixua t8 } msg] $msg
} {0 {}}
S delete
do_catchsql_test 4.5.2 {
  SELECT * FROM ixua.i8;
} {1 {no such table: ixua.i8}}

#-------------------------------------------------------------------------
# Test that sqlite3session_diff() really does automatically attach tables,
# as documented.
#
reset_db
forcedelete test.db2
do_execsql_test 4.0 {
  ATTACH 'test.db2' AS two;
  CREATE TABLE two.t1(a PRIMARY KEY, b, c);
  CREATE TABLE t1(a PRIMARY KEY, b, c);

  INSERT INTO two.t1 VALUES(1, 2, 3), (4, 5, 6), (7, 8, 9);
}

do_test 4.1 {
  sqlite3session S db main
  S attach t8
  S diff two t1
} {}

do_changeset_test 4.2 S {
  {DELETE t1 0 X.. {i 1 i 2 i 3} {}} 
  {DELETE t1 0 X.. {i 4 i 5 i 6} {}}
  {DELETE t1 0 X.. {i 7 i 8 i 9} {}}
}

S delete

finish_test
Changes to ext/session/sqlite3session.c.
2212
2213
2214
2215
2216
2217
2218

2219

2220
2221
2222
2223
2224
2225
2226
  if( pzErrMsg ) *pzErrMsg = 0;
  if( rc==SQLITE_OK ){
    char *zExpr = 0;
    sqlite3 *db = pSession->db;
    SessionTable *pTo;            /* Table zTbl */

    /* Locate and if necessary initialize the target table object */

    rc = sessionFindTable(pSession, zTbl, &pTo);

    if( pTo==0 ) goto diff_out;
    if( sessionInitTable(pSession, pTo, pSession->db, pSession->zDb) ){
      rc = pSession->rc;
      goto diff_out;
    }

    /* Check the table schemas match */







>

>







2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
  if( pzErrMsg ) *pzErrMsg = 0;
  if( rc==SQLITE_OK ){
    char *zExpr = 0;
    sqlite3 *db = pSession->db;
    SessionTable *pTo;            /* Table zTbl */

    /* Locate and if necessary initialize the target table object */
    pSession->bAutoAttach++;
    rc = sessionFindTable(pSession, zTbl, &pTo);
    pSession->bAutoAttach--;
    if( pTo==0 ) goto diff_out;
    if( sessionInitTable(pSession, pTo, pSession->db, pSession->zDb) ){
      rc = pSession->rc;
      goto diff_out;
    }

    /* Check the table schemas match */