System.Data.SQLite
Check-in [34545cc064]
Not logged in

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

Overview
Comment:Enhancements to the extended result code tests.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 34545cc0645efc7ce87cd7be0cf646017a33d8fd
User & Date: mistachkin 2018-02-08 04:40:10
Context
2018-02-08
06:08
Add tests for ticket [53962f9eff]. check-in: 5c1fba537e user: mistachkin tags: trunk
04:40
Enhancements to the extended result code tests. check-in: 34545cc064 user: mistachkin tags: trunk
02:22
Update two tests to account for modified error codes and messages. check-in: b793037b2e user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Tests/basic.eagle.

4774
4775
4776
4777
4778
4779
4780

4781
4782
4783
4784
4785
4786
4787
....
4837
4838
4839
4840
4841
4842
4843

4844
4845
4846
4847
4848

4849
4850
4851












































































4852
4853
4854
4855
4856
4857
4858

  lappend errCodes 256; # SQLITE_OK_LOAD_PERMANENTLY
  lappend errCodes 513; # SQLITE_ERROR_RETRY
  lappend errCodes 522; # SQLITE_IOERR_SHORT_READ
  lappend errCodes 270; # SQLITE_CANTOPEN_NOTEMPDIR
  lappend errCodes 539; # SQLITE_NOTICE_RECOVER_ROLLBACK
  lappend errCodes 284; # SQLITE_WARNING_AUTOINDEX


  set connection [getDbConnection]

  lappend result [catchAndReturn {$connection EnableExtensions true}]

  lappend result [catchAndReturn {$connection LoadExtension \
      [getCoreExtensionBinaryFileName null] interop_test_extension_init}]
................................................................................
  unset -nocomplain connection db fileName
} -constraints {eagle command.object monoBug28\
compile.DATA defineConstant.System.Data.SQLite.INTEROP_TEST_EXTENSION\
command.sql SQLite System.Data.SQLite} -result {{0 {}} {0 {}} {0 {}} Error {SQL\
logic error ==> SQL logic error} IoErr {disk I/O error ==> disk I/O error}\
CantOpen {unable to open database file ==> unable to open database file} Notice\
{notification message ==> notification message} Warning {warning message ==>\

warning message} {0 {}} Ok_Load_Permanently {not an error ==> not an error}\
Error_Retry {SQL logic error ==> SQL logic error} IoErr_Short_Read {disk I/O\
error ==> disk I/O error} CantOpen_NoTempDir {unable to open database file ==>\
unable to open database file} Notice_Recover_Rollback {notification message ==>\
notification message} Warning_AutoIndex {warning message ==> warning message}}}


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













































































reportSQLiteResources $test_channel

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

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue







>







 







>
|
|
|
|
|
>



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







4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
....
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937

  lappend errCodes 256; # SQLITE_OK_LOAD_PERMANENTLY
  lappend errCodes 513; # SQLITE_ERROR_RETRY
  lappend errCodes 522; # SQLITE_IOERR_SHORT_READ
  lappend errCodes 270; # SQLITE_CANTOPEN_NOTEMPDIR
  lappend errCodes 539; # SQLITE_NOTICE_RECOVER_ROLLBACK
  lappend errCodes 284; # SQLITE_WARNING_AUTOINDEX
  lappend errCodes 999; # unknown error

  set connection [getDbConnection]

  lappend result [catchAndReturn {$connection EnableExtensions true}]

  lappend result [catchAndReturn {$connection LoadExtension \
      [getCoreExtensionBinaryFileName null] interop_test_extension_init}]
................................................................................
  unset -nocomplain connection db fileName
} -constraints {eagle command.object monoBug28\
compile.DATA defineConstant.System.Data.SQLite.INTEROP_TEST_EXTENSION\
command.sql SQLite System.Data.SQLite} -result {{0 {}} {0 {}} {0 {}} Error {SQL\
logic error ==> SQL logic error} IoErr {disk I/O error ==> disk I/O error}\
CantOpen {unable to open database file ==> unable to open database file} Notice\
{notification message ==> notification message} Warning {warning message ==>\
warning message} 231 {SQL logic error ==> unknown error} {0 {}}\
Ok_Load_Permanently {not an error ==> not an error} Error_Retry {SQL logic\
error ==> SQL logic error} IoErr_Short_Read {disk I/O error ==> disk I/O error}\
CantOpen_NoTempDir {unable to open database file ==> unable to open database\
file} Notice_Recover_Rollback {notification message ==> notification message}\
Warning_AutoIndex {warning message ==> warning message} 999 {SQL logic error\
==> unknown error}}}

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

runTest {test data-1.94 {extended error code messages} -setup {
  setupDb [set fileName data-1.94.db]
} -body {
  set errCodes [list]

  lappend errCodes 256; # SQLITE_OK_LOAD_PERMANENTLY
  lappend errCodes 513; # SQLITE_ERROR_RETRY
  lappend errCodes 522; # SQLITE_IOERR_SHORT_READ
  lappend errCodes 270; # SQLITE_CANTOPEN_NOTEMPDIR
  lappend errCodes 539; # SQLITE_NOTICE_RECOVER_ROLLBACK
  lappend errCodes 284; # SQLITE_WARNING_AUTOINDEX
  lappend errCodes 999; # unknown error

  set connection [getDbConnection]

  lappend result [catchAndReturn {$connection EnableExtensions true}]

  lappend result [catchAndReturn {$connection LoadExtension \
      [getCoreExtensionBinaryFileName null] interop_test_extension_init}]

  lappend result [catchAndReturn {$connection SetExtendedResultCodes false}]

  foreach errCode $errCodes {
    #
    # HACK: Without extended error codes, SQLITE_OK_* cannot be handled via
    #       the semantics in the System.Data.SQLite.SQLite3.Prepare method;
    #       it will always assume that more results are available when the
    #       error code is Ok, thereby looping forever.
    #
    if {($errCode & 0xFF) == 0} then {continue}

    resetException; catchAndSetException {
      sql execute -execute scalar $db \
          "SELECT interopError(?);" [list param1 Int32 $errCode]
    } exception

    lappend result [$exception ResultCode] \
        [normalizeExceptionMessage [$exception Message]]
  }

  lappend result [catchAndReturn {$connection SetExtendedResultCodes true}]

  foreach errCode $errCodes {
    resetException; catchAndSetException {
      sql execute -execute scalar $db \
          "SELECT interopError(?);" [list param1 Int32 $errCode]
    } exception

    lappend result [$exception ResultCode] \
        [normalizeExceptionMessage [$exception Message]]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain result exception errCode errCodes
  unset -nocomplain connection db fileName
} -constraints {eagle command.object monoBug28\
compile.DATA defineConstant.System.Data.SQLite.INTEROP_TEST_EXTENSION\
command.sql SQLite System.Data.SQLite} -result {{0 {}} {0 {}} {0 {}} Error {SQL\
logic error ==> SQL logic error} IoErr {disk I/O error ==> disk I/O error}\
CantOpen {unable to open database file ==> unable to open database file} Notice\
{notification message ==> notification message} Warning {warning message ==>\
warning message} 231 {unknown error ==> unknown error} {0 {}}\
Ok_Load_Permanently {not an error ==> not an error} Error_Retry {SQL logic\
error ==> SQL logic error} IoErr_Short_Read {disk I/O error ==> disk I/O error}\
CantOpen_NoTempDir {unable to open database file ==> unable to open database\
file} Notice_Recover_Rollback {notification message ==> notification message}\
Warning_AutoIndex {warning message ==> warning message} 999 {unknown error ==>\
unknown error}}}

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

reportSQLiteResources $test_channel

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

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue