SQLite

Check-in [09aed13678]
Login

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

Overview
Comment:Fix a problem causing the sessions module to occasionally lose track of rows with composite primary keys when there are two rows with the same text value in the leftmost column of the PK.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 09aed13678374bf22087cd808808b711dc703b7c18bc8aaf704850611e17f5cd
User & Date: dan 2018-01-17 17:38:18.448
Context
2018-01-17
21:14
Alternative implementation for the internal sqlite3Pow10() utility for MSVC, which is more accurate on that platform. (check-in: 469b96be53 user: drh tags: trunk)
20:57
Fix a problem in the sessions module with logging sqlite_stat1 rows for which (idx IS NULL) is true. (check-in: 25bf734be1 user: dan tags: sessions-stat1)
17:38
Fix a problem causing the sessions module to occasionally lose track of rows with composite primary keys when there are two rows with the same text value in the leftmost column of the PK. (check-in: 09aed13678 user: dan tags: trunk)
16:11
Fix main.mk so that testfixture can be built either from the amalgamation or from individual source files. No changes to code. (check-in: a8aea925f8 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Added ext/session/sessionH.test.














































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 2018 January 18
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#

if {![info exists testdir]} {
  set testdir [file join [file dirname [info script]] .. .. test]
} 
source [file join [file dirname [info script]] session_common.tcl]
source $testdir/tester.tcl
ifcapable !session {finish_test; return}
set testprefix sessionH

forcedelete test.db2
sqlite3 db2 test.db2

do_test 1.0 {
  do_common_sql {
    CREATE TABLE t1(a, b, c, PRIMARY KEY(a, b));
  }
  do_then_apply_sql {
    WITH s(i) AS (
      VALUES(1) UNION ALL SELECT i+1 FROM s WHERe i<10000
    )
    INSERT INTO t1 SELECT 'abcde', randomblob(16), i FROM s;
  }
  compare_db db db2
} {}


finish_test

Changes to ext/session/sessionat.test.
237
238
239
240
241
242
243




244
245
  do_test $tn.6.3 {
    sqlite3changeset_apply db $cinv xConflict
    execsql { SELECT * FROM t7 }
  } {1 1 ccc 2 2 ccc 3 3 ccc}
}]
}






finish_test







>
>
>
>


237
238
239
240
241
242
243
244
245
246
247
248
249
  do_test $tn.6.3 {
    sqlite3changeset_apply db $cinv xConflict
    execsql { SELECT * FROM t7 }
  } {1 1 ccc 2 2 ccc 3 3 ccc}
}]
}

catch { db close }
catch { db2 close }
sqlite3_shutdown
test_sqlite3_log

finish_test
Changes to ext/session/sqlite3session.c.
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
        if( eType==SQLITE_TEXT ){
          z = sqlite3_value_text(pVal);
        }else{
          z = sqlite3_value_blob(pVal);
        }
        if( memcmp(a, z, n) ) return 0;
        a += n;
        break;
      }
    }
  }

  return 1;
}








<







834
835
836
837
838
839
840

841
842
843
844
845
846
847
        if( eType==SQLITE_TEXT ){
          z = sqlite3_value_text(pVal);
        }else{
          z = sqlite3_value_blob(pVal);
        }
        if( memcmp(a, z, n) ) return 0;
        a += n;

      }
    }
  }

  return 1;
}