System.Data.SQLite

Check-in [5d35df2f75]
Login

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

Overview
Comment:Add initial test cases for ticket [01f20ea55a].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | tkt-01f20ea55a
Files: files | file ages | folders
SHA1: 5d35df2f75c54d7446ba39da495e676447558724
User & Date: mistachkin 2016-10-10 20:58:16.195
Context
2016-10-10
21:37
Test case updates. Closed-Leaf check-in: cf56f17881 user: mistachkin tags: tkt-01f20ea55a
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
Changes
Unified Diff Show Whitespace Changes Patch
Added Tests/tkt-01f20ea55a.eagle.




































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
###############################################################################
#
# tkt-01f20ea55a.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

set rawValue(0) "2016-10-01 12:34:56.8765401"

###############################################################################

set ticksValue(0) [getDateTimeTicks $rawValue(0)]
set ticksValue(1) [getDateTimeTicks $rawValue(0) false]

###############################################################################

set instanceValue(0) [object create -alias DateTime $ticksValue(0)]
set instanceValue(1) [object create -alias DateTime $ticksValue(1) Utc]

###############################################################################

set iso8601Value(0) [$instanceValue(0) ToString [getDateTimeFormat]]
set iso8601Value(1) [$instanceValue(1) ToString [getDateTimeFormat]]

###############################################################################

runTest {test tkt-01f20ea55a-1.1 {DateTimeKind with DataTable} -setup {
  proc dateTimeValueCallback { dataTable dataRow index value } {
    if {[object isoftype $value DateTime]} then {
      return [list [$value Kind] [$value ToString [getDateTimeFormat]]]
    } else {
      continue
    }
  }

  setupDb [set fileName tkt-01f20ea55a-1.1.db] "" ISO8601 Utc
} -body {
  set connection [getDbConnection]

  sql execute $db [subst {
    CREATE TABLE t1 (x, y DATETIME);
    INSERT INTO t1 (x, y) VALUES(1, NULL);
  }]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(2, ?);" \
      [list param1 DateTime $instanceValue(0)]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(3, ?);" \
      [list param1 DateTime $instanceValue(1)]

  set command [$connection -alias CreateCommand]
  $command CommandText {SELECT x, y FROM t1 ORDER BY x;}

  set dataAdapter [object create -alias \
      System.Data.SQLite.SQLiteDataAdapter $command]

  set dataTable [object create -alias System.Data.DataTable]

  $dataAdapter Fill $dataTable
  getRowsFromDataTable $dataTable dateTimeValueCallback
} -cleanup {
  unset -nocomplain dataTable dataAdapter command

  freeDbConnection

  cleanupDb $fileName

  unset -nocomplain connection db fileName

  rename dateTimeValueCallback ""
} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
compile.DATA SQLite System.Data.SQLite} -result {{{x 1} y} {{x 2} {y\
{Unspecified {2016-10-01 12:34:56.8765401}}}} {{x 3} {y {Utc {2016-10-01\
12:34:56.8765401}}}}}}

###############################################################################

unset -nocomplain iso8601Value instanceValue ticksValue rawValue

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue