System.Data.SQLite
Check-in [acbeea6018]
Not logged in

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

Overview
Comment:Corrections to tests.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sessionStreamManager
Files: files | file ages | folders
SHA1: acbeea6018bb095e2d98a2a5d4aad37730c2580b
User & Date: mistachkin 2017-10-13 17:46:31
Context
2017-10-13
17:47
Object lifetime fixes for stream adapters and their managed delegates. check-in: aafb14f219 user: mistachkin tags: sessions
17:46
Corrections to tests. Closed-Leaf check-in: acbeea6018 user: mistachkin tags: sessionStreamManager
17:11
Prevent delegates used for native callbacks from being disposed while in use. check-in: 489188361e user: mistachkin tags: sessionStreamManager
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Tests/session.eagle.

    88     88     }
    89     89   }
    90     90   
    91     91   ###############################################################################
    92     92   
    93     93   proc createMemoryChangeSetForConnection { connection rawData } {
    94     94     if {[isObjectHandle $connection] && $connection ne "null"} then {
    95         -    return [$connection -alias \
    96         -        -objectflags +NoReturnReference CreateChangeSet $rawData]
           95  +    return [$connection -alias CreateChangeSet $rawData]
    97     96     }
    98     97   
    99     98     return null
   100     99   }
   101    100   
   102    101   ###############################################################################
   103    102   
................................................................................
   107    106   
   108    107       if {$patch} then {
   109    108         $session -alias CreatePatchSet byteArray
   110    109       } else {
   111    110         $session -alias CreateChangeSet byteArray
   112    111       }
   113    112   
   114         -    return [createByteArray [arrayToList byteArray]]
          113  +    set rawData [createByteArray [arrayToList byteArray]]
          114  +    object removeref $rawData
          115  +
          116  +    return $rawData
   115    117     }
   116    118   
   117    119     return null
   118    120   }
   119    121   
   120    122   ###############################################################################
   121    123   
................................................................................
   256    258   
   257    259   ###############################################################################
   258    260   
   259    261   proc matchSession { connection session expr } {
   260    262     if {[isObjectHandle $session] && $session ne "null"} then {
   261    263       if {![$session IsEmpty]} then {
   262    264         set rawData [createMemoryChangeSetForSession $session]
          265  +      object removeref $rawData
   263    266   
   264    267         if {[isObjectHandle $rawData] && $rawData ne "null"} then {
   265    268           return [matchChangeSet [set changeSet \
   266    269               [$connection -alias CreateChangeSet $rawData]] $expr]
   267    270         }
   268    271       }
   269    272     }
................................................................................
   351    354     $session AttachTable $tableName
   352    355   
   353    356     if {![isObjectHandle $session] || $session eq "null"} then {
   354    357       error "cannot create session"
   355    358     }
   356    359   
   357    360     catch {uplevel 1 $script}
   358         -  return [createMemoryChangeSetForSession $session]
          361  +  set rawData [createMemoryChangeSetForSession $session]
          362  +  object removeref $rawData
          363  +
          364  +  return $rawData
   359    365   }
   360    366   
   361    367   ###############################################################################
   362    368   
   363    369   proc captureChangeSetFile {
   364    370           connection databaseName tableName script fileName } {
   365    371     if {![isObjectHandle $connection] || $connection eq "null"} then {
................................................................................
   400    406     return $result
   401    407   }
   402    408   
   403    409   ###############################################################################
   404    410   
   405    411   proc createByteArray { list } {
   406    412     set length [llength $list]
   407         -
   408         -  set result [object create -alias \
   409         -      -objectflags +NoReturnReference System.Byte\[\] $length]
          413  +  set result [object create -alias System.Byte\[\] $length]
   410    414   
   411    415     for {set index 0} {$index < $length} {incr index} {
   412    416       set element [lindex $list $index]
   413    417       set value [object invoke -create Byte Parse $element]
   414    418       $result SetValue $value $index
   415    419     }
   416    420   
   417         -  #
   418         -  # NOTE: Prevent returning, which unsets all local variables,
   419         -  #       from causing the byte array object to be disposed.
   420         -  #
   421         -  object addref $result; object addref $result; return $result
          421  +  return $result
   422    422   }
   423    423   
   424    424   ###############################################################################
   425    425   
   426    426   proc tableFilterCallbackT1 { clientData name } {
   427    427     lappend ::callbackResults [object invoke -create \
   428    428         System.Boolean Parse [expr {[$name ToString] in [list t1]}]]
................................................................................
   469    469   
   470    470     set session [$connection -alias CreateSession main]
   471    471     $session AttachTable null
   472    472   
   473    473     makeSomeChanges $db t1 [list insert update delete]
   474    474   
   475    475     set rawData [createMemoryChangeSetForSession $session]
          476  +  object removeref $rawData
   476    477   
   477    478     writeRawDataToFile $fileName(1) $rawData
   478    479     writeStreamChangeSetForSession $session $fileName(2)
   479    480     openStreamChangeSetForConnection $connection $fileName(2) "" state
   480    481   
   481    482     list [expr {[file size $fileName(1)] > 0}] \
   482    483         [string equal [readFile $fileName(1)] [readFile $fileName(2)]] \
................................................................................
   526    527   
   527    528     set session [$connection -alias CreateSession main]
   528    529     $session AttachTable null
   529    530   
   530    531     makeSomeChanges $db t1 [list insert update delete]
   531    532   
   532    533     set rawData [createMemoryChangeSetForSession $session]
          534  +  object removeref $rawData
   533    535   
   534    536     set changeSet(1) \
   535    537         [createMemoryChangeSetForConnection $connection $rawData]
          538  +
          539  +  object removeref $changeSet(1)
   536    540   
   537    541     set changeSet(2) [$changeSet(1) -alias Invert]
   538    542   
   539    543     list [changeSetToString $changeSet(2) true]
   540    544   } -cleanup {
   541    545     cleanupSomeText
   542    546   
................................................................................
   649    653     $session SetToDisabled
   650    654     lappend result IsEnabled [$session IsEnabled]
   651    655   
   652    656     makeSomeChanges $db t1 [list insert]
   653    657     lappend result IsEmpty [$session IsEmpty]
   654    658   
   655    659     set rawData [createMemoryChangeSetForSession $session]
          660  +  object removeref $rawData
   656    661   
   657    662     lappend result Length [$rawData Length]
   658    663   
   659    664     $session SetToEnabled
   660    665     lappend result IsEnabled [$session IsEnabled]
   661    666   
   662    667     makeSomeChanges $db t1 [list insert]
   663    668     lappend result IsEmpty [$session IsEmpty]
   664    669   
   665    670     set rawData [createMemoryChangeSetForSession $session]
          671  +  object removeref $rawData
   666    672   
   667    673     set changeSet(1) \
   668    674         [createMemoryChangeSetForConnection $connection $rawData]
          675  +
          676  +  object removeref $changeSet(1)
   669    677   
   670    678     lappend result [changeSetToString $changeSet(1) false]
   671    679   } -cleanup {
   672    680     cleanupSomeText
   673    681   
   674    682     unset -nocomplain result changeSet rawData byteArray session
   675    683   
................................................................................
   708    716     $session SetToIndirect
   709    717     lappend result IsIndirect [$session IsIndirect]
   710    718   
   711    719     makeSomeChanges $db t1 [list insert]
   712    720     lappend result IsEmpty [$session IsEmpty]
   713    721   
   714    722     set rawData [createMemoryChangeSetForSession $session]
          723  +  object removeref $rawData
   715    724   
   716    725     $session SetToDirect
   717    726     lappend result IsIndirect [$session IsIndirect]
   718    727   
   719    728     makeSomeChanges $db t1 [list insert]
   720    729     lappend result IsEmpty [$session IsEmpty]
   721    730   
   722    731     set rawData [createMemoryChangeSetForSession $session]
          732  +  object removeref $rawData
   723    733   
   724    734     set changeSet(1) \
   725    735         [createMemoryChangeSetForConnection $connection $rawData]
          736  +
          737  +  object removeref $changeSet(1)
   726    738   
   727    739     lappend result [changeSetToString $changeSet(1) false]
   728    740   } -cleanup {
   729    741     cleanupSomeText
   730    742   
   731    743     unset -nocomplain result changeSet rawData byteArray session
   732    744   
................................................................................
   829    841     createTheSchema $db main
   830    842     makeSomeChanges $db t1 [list insert insert]
   831    843   
   832    844     set connection [getDbConnection]
   833    845   
   834    846     set rawData(1) [captureChangeSetRawData $connection main null {
   835    847       makeSomeChanges $db t1 [list delete] 1
   836         -  }]
          848  +  }]; object removeref $rawData(1)
   837    849   
   838    850     makeSomeChanges $db t1 [list insert] 1
   839    851   
   840    852     set rawData(2) [captureChangeSetRawData $connection main null {
   841    853       makeSomeChanges $db t1 [list insert]
   842         -  }]
          854  +  }]; object removeref $rawData(2)
   843    855   
   844    856     set changeSet(1) \
   845    857         [createMemoryChangeSetForConnection $connection $rawData(1)]
   846    858   
          859  +  object removeref $changeSet(1)
          860  +
   847    861     set changeSet(2) \
   848    862         [createMemoryChangeSetForConnection $connection $rawData(2)]
          863  +
          864  +  object removeref $changeSet(2)
   849    865   
   850    866     set changeSet(3) [$changeSet(1) -alias CombineWith $changeSet(2)]
   851    867   
   852    868     $changeSet(3) -marshalflags +DynamicCallback \
   853    869         Apply conflictCallback null
   854    870   
   855    871     list [changeSetToString $changeSet(3) true] Data \