sessionblob.test 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # 2024 November 04
  2. #
  3. # The author disclaims copyright to this source code. In place of
  4. # a legal notice, here is a blessing:
  5. #
  6. # May you do good and not evil.
  7. # May you find forgiveness for yourself and forgive others.
  8. # May you share freely, never taking more than you give.
  9. #
  10. #***********************************************************************
  11. #
  12. if {![info exists testdir]} {
  13. set testdir [file join [file dirname [info script]] .. .. test]
  14. }
  15. source [file join [file dirname [info script]] session_common.tcl]
  16. source $testdir/tester.tcl
  17. ifcapable !session {finish_test; return}
  18. if {$::tcl_platform(pointerSize)<8} {
  19. finish_test
  20. return
  21. }
  22. set testprefix sessionblob
  23. forcedelete test.db2
  24. sqlite3 db2 test.db2
  25. set NBLOB 2000000
  26. do_execsql_test 1.0 {
  27. CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
  28. INSERT INTO t1 VALUES(123, zeroblob($NBLOB));
  29. }
  30. do_test 1.1 {
  31. sqlite3session S db main
  32. S attach t1
  33. } {}
  34. set b2 [string repeat x 1000]
  35. do_test 1.2 {
  36. set ::blob [db incrblob t1 b 123]
  37. for {set ii 0} {$ii < $NBLOB} {incr ii [string length $b2]} {
  38. seek $::blob $ii
  39. puts -nonewline $::blob $b2
  40. }
  41. close $::blob
  42. } {}
  43. S delete
  44. finish_test