System.Data.SQLite

Check-in [ed9c4825db]
Login

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

Overview
Comment:Test portability fixes for Mono on POSIX.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ed9c4825dbc649ad7041cb88ecce8b1e14779f59
User & Date: mistachkin 2018-02-20 10:46:41.501
Context
2018-02-20
12:18
Enhancements to test suite to improve detection of encrypted database support. check-in: c093917164 user: mistachkin tags: trunk
10:46
Test portability fixes for Mono on POSIX. check-in: ed9c4825db user: mistachkin tags: trunk
2018-02-08
17:45
Remove overrides of GetHashCode/Equals from SQLiteException (added by check-in [37dcaf8f5d]) because they are superfluous and cannot readily take into account all base class state. check-in: 242ef0c9a1 user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Tests/tkt-53962f9eff.eagle.
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

  set exception [object create -alias \
      System.Data.SQLite.SQLiteException $errCode "ioerr message."]

  normalizeExceptionMessage [$exception ToString]
} -cleanup {
  unset -nocomplain exception errCode
} -constraints {eagle command.object SQLite System.Data.SQLite} -result {code =\
IoErr_Delete_NoEnt (5898), message = System.Data.SQLite.SQLiteException\

(0x80004005): disk I/O error ==> ioerr message.}}

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

runTest {test tkt-53962f9eff-1.2 {SQLiteException ToString Ok} -body {
  set errCode [object invoke -create Enum Parse \
      System.Data.SQLite.SQLiteErrorCode Ok_Load_Permanently false]

  set exception [object create -alias \
      System.Data.SQLite.SQLiteException $errCode "ok message."]

  normalizeExceptionMessage [$exception ToString]
} -cleanup {
  unset -nocomplain exception errCode
} -constraints {eagle command.object SQLite System.Data.SQLite} -result {code =\
Ok_Load_Permanently (256), message = System.Data.SQLite.SQLiteException\

(0x80004005): not an error ==> ok message.}}

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

runTest {test tkt-53962f9eff-1.3 {SQLiteException ToString unknown} -body {
  set errCode [object invoke -create Enum Parse \
      System.Data.SQLite.SQLiteErrorCode 999 false]

  set exception [object create -alias \
      System.Data.SQLite.SQLiteException $errCode "unknown message."]

  normalizeExceptionMessage [$exception ToString]
} -cleanup {
  unset -nocomplain exception errCode
} -constraints {eagle command.object SQLite System.Data.SQLite} -result {code =\
999 (999), message = System.Data.SQLite.SQLiteException (0x80004005): unknown\

error ==> unknown message.}}

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

runSQLiteTestEpilogue
runTestEpilogue







|
|
>
|













|
|
>
|













|
|
>
|





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

  set exception [object create -alias \
      System.Data.SQLite.SQLiteException $errCode "ioerr message."]

  normalizeExceptionMessage [$exception ToString]
} -cleanup {
  unset -nocomplain exception errCode
} -constraints {eagle command.object SQLite System.Data.SQLite} -match \
regexp -result {^code = IoErr_Delete_NoEnt \(5898\), message =\
System\.Data\.SQLite\.SQLiteException(?: \(0x80004005\))?: disk I/O error\
==> ioerr message\.$}}

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

runTest {test tkt-53962f9eff-1.2 {SQLiteException ToString Ok} -body {
  set errCode [object invoke -create Enum Parse \
      System.Data.SQLite.SQLiteErrorCode Ok_Load_Permanently false]

  set exception [object create -alias \
      System.Data.SQLite.SQLiteException $errCode "ok message."]

  normalizeExceptionMessage [$exception ToString]
} -cleanup {
  unset -nocomplain exception errCode
} -constraints {eagle command.object SQLite System.Data.SQLite} -match \
regexp -result {^code = Ok_Load_Permanently \(256\), message =\
System\.Data\.SQLite\.SQLiteException(?: \(0x80004005\))?: not an error\
==> ok message.$}}

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

runTest {test tkt-53962f9eff-1.3 {SQLiteException ToString unknown} -body {
  set errCode [object invoke -create Enum Parse \
      System.Data.SQLite.SQLiteErrorCode 999 false]

  set exception [object create -alias \
      System.Data.SQLite.SQLiteException $errCode "unknown message."]

  normalizeExceptionMessage [$exception ToString]
} -cleanup {
  unset -nocomplain exception errCode
} -constraints {eagle command.object SQLite System.Data.SQLite} -match \
regexp -result {^code = 999 \(999\), message =\
System\.Data\.SQLite\.SQLiteException(?: \(0x80004005\))?: unknown error\
==> unknown message\.$}}

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

runSQLiteTestEpilogue
runTestEpilogue
Changes to lib/System.Data.SQLite/common.eagle.
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
      return [list \
          [sql execute -execute scalar $db "PRAGMA page_size;"] \
          [sql execute -execute scalar $db "PRAGMA cache_size;"]]
    }

    proc normalizeExceptionMessage { value } {
      if {[string length $value] == 0} then {return $value}
      return [string map [list \r\n " ==> "] $value]
    }

    proc extractSystemDataSQLiteExceptionMessage { value } {
      #
      # NOTE: If the string conforms to format of the normal exception
      #       error strings, extract and return only the error message
      #       portion itself.







|







2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
      return [list \
          [sql execute -execute scalar $db "PRAGMA page_size;"] \
          [sql execute -execute scalar $db "PRAGMA cache_size;"]]
    }

    proc normalizeExceptionMessage { value } {
      if {[string length $value] == 0} then {return $value}
      return [string map [list \r\n " ==> " \n " ==> "] $value]
    }

    proc extractSystemDataSQLiteExceptionMessage { value } {
      #
      # NOTE: If the string conforms to format of the normal exception
      #       error strings, extract and return only the error message
      #       portion itself.