System.Data.SQLite

Check-in [cd91b8e6bf]
Login

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

Overview
Comment:Enhance the 'getRowsFromDataTable' test suite helper procedure.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cd91b8e6bff0c634ec1576934435e38882a5e0e2
User & Date: mistachkin 2016-10-10 20:48:53.142
Context
2016-10-13
17:31
Update SQLite core library to the latest trunk. check-in: 1da3d937ca user: mistachkin tags: trunk
2016-10-10
20:58
Add initial test cases for ticket [01f20ea55a]. check-in: 5d35df2f75 user: mistachkin tags: tkt-01f20ea55a
20:48
Enhance the 'getRowsFromDataTable' test suite helper procedure. check-in: cd91b8e6bf user: mistachkin tags: trunk
2016-10-07
19:20
Use NuGet 2.x to build the official NuGet packages for a release. Pursuant to [e9573e2d12]. check-in: bb7d27069f user: mistachkin tags: trunk
Changes
Unified Diff Show Whitespace Changes Patch
Changes to lib/System.Data.SQLite/common.eagle.
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672





2673
2674
2675
2676
2677
2678


































2679
2680
2681
2682
2683
2684
2685

2686
2687
2688
2689
2690
2691
2692
      # NOTE: Add the database connection provided by our caller to the list
      #       of those known to the Eagle interpreter.
      #
      object invoke -flags +NonPublic Interpreter.GetActive.connections Add \
          $db $connection
    }

    proc getRowsFromDataTable { dataTable } {
      set rows [list]
      set count [$dataTable Columns.Count]

      for {set index 0} {$index < $count} {incr index} {
        set dataColumn [$dataTable -alias Columns.get_Item $index]
        set names($index) [$dataColumn ColumnName]
      }






      object foreach -alias dataRow [set dataRows [$dataTable Rows]] {
        set row [list]

        for {set index 0} {$index < $count} {incr index} {
          set value [$dataRow -create -alias get_Item $index]



































          if {[string length $value] > 0 && \
              ![object invoke Convert IsDBNull $value]} then {
            lappend row [list $names($index) [$value ToString]]
          } else {
            lappend row [list $names($index)]
          }
        }


        lappend rows $row
      }

      return $rows
    }








|








>
>
>
>
>






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







>







2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
      # NOTE: Add the database connection provided by our caller to the list
      #       of those known to the Eagle interpreter.
      #
      object invoke -flags +NonPublic Interpreter.GetActive.connections Add \
          $db $connection
    }

    proc getRowsFromDataTable { dataTable {valueCallback ""} } {
      set rows [list]
      set count [$dataTable Columns.Count]

      for {set index 0} {$index < $count} {incr index} {
        set dataColumn [$dataTable -alias Columns.get_Item $index]
        set names($index) [$dataColumn ColumnName]
      }

      #
      # NOTE: Setup some Tcl return code constants.
      #
      set Ok 0; set Error 1; set Return 2; set Break 3; set Continue 4

      object foreach -alias dataRow [set dataRows [$dataTable Rows]] {
        set row [list]

        for {set index 0} {$index < $count} {incr index} {
          set value [$dataRow -create -alias get_Item $index]

          if {[string length $valueCallback] > 0} then {
            set code [catch {
              $valueCallback $dataTable $dataRow $index $value
            } newValue]

            if {$code == $Ok} then {
              #
              # NOTE: Use the specified (new?) row value.
              #
              lappend row [list $names($index) $newValue]
            } elseif {$code == $Error} then {
              #
              # NOTE: Use the (new?) NULL row value.
              #
              lappend row [list $names($index)]
            } elseif {$code == $Return} then {
              #
              # NOTE: Skip remaining values for this row.
              #
              break
            } elseif {$code == $Break} then {
              #
              # NOTE: Skip processing this row value.
              #
            } elseif {$code == $Continue} then {
              #
              # NOTE: Use default row value handling.
              #
            }
          } else {
            set code $Continue
          }

          if {$code == $Continue} then {
          if {[string length $value] > 0 && \
              ![object invoke Convert IsDBNull $value]} then {
            lappend row [list $names($index) [$value ToString]]
          } else {
            lappend row [list $names($index)]
          }
        }
        }

        lappend rows $row
      }

      return $rows
    }