]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove some unused code from the sessions module.
authordan <dan@noemail.net>
Thu, 22 Mar 2018 11:15:59 +0000 (11:15 +0000)
committerdan <dan@noemail.net>
Thu, 22 Mar 2018 11:15:59 +0000 (11:15 +0000)
FossilOrigin-Name: a09518ab63a1ef1b7f56b9f9b16269fd83920469d4c4e179b1f68b35df4e0c4b

ext/session/sqlite3session.c
manifest
manifest.uuid

index b4440fc2ce25ed9aaa5fe3d812bcf81fb7d58e07..6d38d0ba9d2030f7ef1b201e315d3590f7adc1da 100644 (file)
@@ -3795,10 +3795,20 @@ static int sessionSeekToRow(
   return rc;
 }
 
+/*
+** This function is called from within sqlite3changset_apply_v2() when
+** a conflict is encountered and resolved using conflict resolution
+** mode eType (either SQLITE_CHANGESET_OMIT or SQLITE_CHANGESET_REPLACE)..
+** It adds a conflict resolution record to the buffer in 
+** SessionApplyCtx.rebase, which will eventually be returned to the caller
+** of apply_v2() as the "rebase" buffer.
+**
+** Return SQLITE_OK if successful, or an SQLite error code otherwise.
+*/
 static int sessionRebaseAdd(
-  SessionApplyCtx *p, 
-  int eType, 
-  sqlite3_changeset_iter *pIter
+  SessionApplyCtx *p,             /* Apply context */
+  int eType,                      /* Conflict resolution (OMIT or REPLACE) */
+  sqlite3_changeset_iter *pIter   /* Iterator pointing at current change */
 ){
   int rc = SQLITE_OK;
   int i;
@@ -4399,6 +4409,10 @@ static int sessionChangesetApply(
   return rc;
 }
 
+/*
+** Apply the changeset passed via pChangeset/nChangeset to the main 
+** database attached to handle "db".
+*/
 int sqlite3changeset_apply_v2(
   sqlite3 *db,                    /* Apply change to "main" db of this handle */
   int nChangeset,                 /* Size of changeset in bytes */
@@ -5017,21 +5031,15 @@ struct sqlite3_rebaser {
 /*
 ** Buffers a1 and a2 must both contain a sessions module record nCol
 ** fields in size. This function appends an nCol sessions module 
-** record to buffer pBuf that is a copy of a1, except that:
-**
-**   + If bUndefined is 0, for each field that is not "undefined" in either
-**     a1[] or a2[], swap in the field from a2[].
-**
-**   + If bUndefined is 1, for each field that is "undefined" in a1[]
-**     swap in the field from a2[].
+** record to buffer pBuf that is a copy of a1, except that for
+** each field that is undefined in a1[], swap in the field from a2[].
 */
 static void sessionAppendRecordMerge(
-  SessionBuffer *pBuf,
-  int nCol,
-  int bUndefined,
-  u8 *a1, int n1,
-  u8 *a2, int n2,
-  int *pRc
+  SessionBuffer *pBuf,            /* Buffer to append to */
+  int nCol,                       /* Number of columns in each record */
+  u8 *a1, int n1,                 /* Record 1 */
+  u8 *a2, int n2,                 /* Record 2 */
+  int *pRc                        /* IN/OUT: error code */
 ){
   sessionBufferGrow(pBuf, n1+n2, pRc);
   if( *pRc==SQLITE_OK ){
@@ -5040,22 +5048,12 @@ static void sessionAppendRecordMerge(
     for(i=0; i<nCol; i++){
       int nn1 = sessionSerialLen(a1);
       int nn2 = sessionSerialLen(a2);
-      if( bUndefined==0 ){
-        if( *a1 && *a2 ){
-          memcpy(pOut, a2, nn2);
-          pOut += nn2;
-        }else{
-          memcpy(pOut, a1, nn1);
-          pOut += nn1;
-        }
+      if( *a1==0 || *a1==0xFF ){
+        memcpy(pOut, a2, nn2);
+        pOut += nn2;
       }else{
-        if( *a1==0 || *a1==0xFF ){
-          memcpy(pOut, a2, nn2);
-          pOut += nn2;
-        }else{
-          memcpy(pOut, a1, nn1);
-          pOut += nn1;
-        }
+        memcpy(pOut, a1, nn1);
+        pOut += nn1;
       }
       a1 += nn1;
       a2 += nn2;
@@ -5191,7 +5189,7 @@ static int sessionRebase(
               sessionSkipRecord(&pCsr, pIter->nCol);
               sessionAppendByte(&sOut, SQLITE_INSERT, &rc);
               sessionAppendByte(&sOut, pIter->bIndirect, &rc);
-              sessionAppendRecordMerge(&sOut, pIter->nCol, 1,
+              sessionAppendRecordMerge(&sOut, pIter->nCol,
                   pCsr, nRec-(pCsr-aRec), 
                   pChange->aRecord, pChange->nRecord, &rc
               );
@@ -5209,7 +5207,7 @@ static int sessionRebase(
           if( pChange->op==SQLITE_INSERT ){
             sessionAppendByte(&sOut, SQLITE_DELETE, &rc);
             sessionAppendByte(&sOut, pIter->bIndirect, &rc);
-            sessionAppendRecordMerge(&sOut, pIter->nCol, 1,
+            sessionAppendRecordMerge(&sOut, pIter->nCol,
                 pChange->aRecord, pChange->nRecord, aRec, nRec, &rc
             );
           }
index d99a2e460a62340994e7af3ac6b66adcbce0d268..46d6d3257148d09134eb786f69269397cf7cfc00 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Merge\slatest\strunk\schanges\sinto\sthis\sbranch.
-D 2018-03-21T20:13:56.529
+C Remove\ssome\sunused\scode\sfrom\sthe\ssessions\smodule.
+D 2018-03-22T11:15:59.453
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in 7016fc56c6b9bfe5daac4f34be8be38d8c0b5fab79ccbfb764d3b23bf1c6fff3
@@ -403,7 +403,7 @@ F ext/session/sessionfault2.test 883c8919ebcf6c140ba86b480bc14ae642ee9969c009e0b
 F ext/session/sessionrebase.test 7cb11b80e6bc13756ac8a51a0601a11f124ee1aa3b1e9eab61ed660b8cab0ef4
 F ext/session/sessionstat1.test 41cd97c2e48619a41cdf8ae749e1b25f34719de638689221aa43971be693bf4e
 F ext/session/sessionwor.test 2f3744236dc8b170a695b7d8ddc8c743c7e79fdc
-F ext/session/sqlite3session.c f817bf0360da914bf353797347ed53dd08fda46bcef0d9e827a4c8cf956008aa
+F ext/session/sqlite3session.c 8cea7c63efa1e217d99ffeb3e67199c9538cf7fe5373c1d2ac2b62a691a2dc55
 F ext/session/sqlite3session.h 5f40a0660ff972c0c50f5fd6b33488fdbd2eb0c1244ea95777f8dbd5e529be04
 F ext/session/test_session.c f253742ea01b089326f189b5ae15a5b55c1c9e97452e4a195ee759ba51b404d5
 F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
@@ -1716,7 +1716,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P a9ec68627a4533ca6aa7cc1b73f864db615a80e86eda9e33660f22d269a1ba1e 3fb21251b0c9c731513e8fb137867c2710a77d99411c99348d3ac45d3babffd7
-R 3c085a679a5c6bacbd79a8bf650ad04f
+P d00b71ecf857bc6d903442d91418d5a313c584dcdd8e9c8ff3b5d940dd45bcc5
+R 1a609de137c9dc0274aa7feaed1a7236
 U dan
-Z de87c26f5f363c23e40146da082bca9e
+Z 10aaa03ec1ff02e2361d604078258cf8
index 84f49f10d18eb4b975a9dfa617a1a7c5df930f55..95d2cb6f81d6cd456c85bd69da3b92f2402ca8fa 100644 (file)
@@ -1 +1 @@
-d00b71ecf857bc6d903442d91418d5a313c584dcdd8e9c8ff3b5d940dd45bcc5
\ No newline at end of file
+a09518ab63a1ef1b7f56b9f9b16269fd83920469d4c4e179b1f68b35df4e0c4b
\ No newline at end of file