Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a problem with concatenating patchsets containing DELETE and INSERT operations on the same row. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | sessions |
Files: | files | file ages | folders |
SHA1: |
4d8537eafb40e3687abc057ba26a1f70 |
User & Date: | dan 2014-09-26 10:52:21.193 |
Context
2014-09-27
| ||
12:26 | Improve sessions module documentation and comments. Fix some other code issues. (check-in: bfc8bd80f8 user: dan tags: sessions) | |
2014-09-26
| ||
10:52 | Fix a problem with concatenating patchsets containing DELETE and INSERT operations on the same row. (check-in: 4d8537eafb user: dan tags: sessions) | |
2014-09-25
| ||
20:43 | Add streaming version of sqlite3changeset_concat(). (check-in: 88eb6656bd user: dan tags: sessions) | |
Changes
Changes to ext/session/sessionB.test.
︙ | ︙ | |||
18 19 20 21 22 23 24 | } source [file join [file dirname [info script]] session_common.tcl] source $testdir/tester.tcl ifcapable !session {finish_test; return} set testprefix sessionB | < < < < < | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | } source [file join [file dirname [info script]] session_common.tcl] source $testdir/tester.tcl ifcapable !session {finish_test; return} set testprefix sessionB # # 1.*: Test that the blobs returned by the session_patchset() API are # as expected. Also the sqlite3_changeset_iter functions. # # 2.*: Test that patchset blobs are handled by sqlite3changeset_apply(). # # 3.*: Test that sqlite3changeset_invert() works with patchset blobs. |
︙ | ︙ |
Changes to ext/session/sqlite3session.c.
︙ | ︙ | |||
593 594 595 596 597 598 599 | ** This is a helper function used by sessionMergeUpdate(). ** ** When this function is called, both *paOne and *paTwo point to a value ** within a change record. Before it returns, both have been advanced so ** as to point to the next value in the record. ** ** If, when this function is called, *paTwo points to a valid value (i.e. | | | > > > > | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | ** This is a helper function used by sessionMergeUpdate(). ** ** When this function is called, both *paOne and *paTwo point to a value ** within a change record. Before it returns, both have been advanced so ** as to point to the next value in the record. ** ** If, when this function is called, *paTwo points to a valid value (i.e. ** *paTwo[0] is not 0x00 - the "no value" placeholder), a copy of the *paTwo ** pointer is returned and *pnVal is set to the number of bytes in the ** serialized value. Otherwise, a copy of *paOne is returned and *pnVal ** set to the number of bytes in the value at *paOne. If *paOne points ** to the "no value" placeholder, *pnVal is set to 1. In other words: ** ** if( *paTwo is valid ) return *paTwo; ** return *paOne; ** */ static u8 *sessionMergeValue( u8 **paOne, /* IN/OUT: Left-hand buffer pointer */ u8 **paTwo, /* IN/OUT: Right-hand buffer pointer */ int *pnVal /* OUT: Bytes in returned value */ ){ u8 *a1 = *paOne; |
︙ | ︙ | |||
3719 3720 3721 3722 3723 3724 3725 | assert( op2==SQLITE_UPDATE ); pNew->op = SQLITE_INSERT; if( bPatchset==0 ) sessionSkipRecord(&a1, pTab->nCol); sessionMergeRecord(&aCsr, pTab->nCol, aExist, a1); }else if( op1==SQLITE_DELETE ){ /* DELETE + INSERT */ assert( op2==SQLITE_INSERT ); pNew->op = SQLITE_UPDATE; | > > > > | | | > | 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 | assert( op2==SQLITE_UPDATE ); pNew->op = SQLITE_INSERT; if( bPatchset==0 ) sessionSkipRecord(&a1, pTab->nCol); sessionMergeRecord(&aCsr, pTab->nCol, aExist, a1); }else if( op1==SQLITE_DELETE ){ /* DELETE + INSERT */ assert( op2==SQLITE_INSERT ); pNew->op = SQLITE_UPDATE; if( bPatchset ){ memcpy(aCsr, aRec, nRec); aCsr += nRec; }else{ if( 0==sessionMergeUpdate(&aCsr, pTab, bPatchset, aExist, 0,aRec,0) ){ sqlite3_free(pNew); pNew = 0; } } }else if( op2==SQLITE_UPDATE ){ /* UPDATE + UPDATE */ u8 *a1 = aExist; u8 *a2 = aRec; assert( op1==SQLITE_UPDATE ); if( bPatchset==0 ){ sessionSkipRecord(&a1, pTab->nCol); |
︙ | ︙ |