tdbc::odbc

Check-in [29da102373]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2018 Conference, Houston/TX, US, Oct 15-19
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Aug 20.

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

Overview
Comment:Be more permissive about SQL/CLI HY??? general errors in test cases - they aren't all HY010 on some ODBC implementations.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:29da10237321cd67db9f3f415b9b3eed3313cafb141d9a764264d37fc4b66278
User & Date: kbk 2018-06-19 02:29:21
Context
2018-06-19
02:53
Don't try to do 'nextrow' after 'nextresults' returns 0 - the HSTMT is in an unspecified state and may return SQL_NO_DATA rather than giving an error. check-in: f1c411de8a user: kbk tags: trunk
02:29
Be more permissive about SQL/CLI HY??? general errors in test cases - they aren't all HY010 on some ODBC implementations. check-in: 29da102373 user: kbk tags: trunk
01:40
Do not attempt to retrieve row count from an operation that returns SQL_NO_DATA. Tolerate any error message from attempting to open a database with an incorrect driver specified. Allow SQLite to return 'serializable' in place of 'readcommitted' on both Unix and Windows. check-in: 34a5e8496c user: kbk tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/tdbcodbc.test.

2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
....
2697
2698
2699
2700
2701
2702
2703

2704
2705
2706
2707
2708
2709
2710
2711
....
2713
2714
2715
2716
2717
2718
2719

2720
2721
2722
2723
2724
2725
2726
2727
....
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
....
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
}

test tdbc::odbc-14.4 {commit - not in transaction} {*}{
    -body {
	list [catch {::db commit} result] $result $::errorCode
    }
    -match glob
    -result {1 {no transaction is in progress} {TDBC GENERAL_ERROR HY010 ODBC *}}
}

test tdbc::odbc-14.5 {rollback - not in transaction} {*}{
    -body {
	list [catch {::db rollback} result] $result $::errorCode
    }
    -match glob
    -result {1 {no transaction is in progress} {TDBC GENERAL_ERROR HY010 ODBC *}}
}

test tdbc::odbc-14.6 {empty transaction} {*}{
    -body {
	::db begintransaction
	::db commit
    }
................................................................................
    -result "bad option *"
}

test tdbc::odbc-19.3 {$connection configure - inappropriate arg} {*}{
    -body {
	list [catch {::db configure -parent} result] $::errorCode
    }

    -result {1 {TDBC GENERAL_ERROR HY010 ODBC -1}}
}

test tdbc::odbc-19.4 {$connection configure - set unknown arg} {*}{
    -body {
	::db configure -junk morejunk
    }
    -returnCodes error
................................................................................
    -result "bad option *"
}

test tdbc::odbc-19.5 {$connection configure - set inappropriate arg} {*}{
    -body {
	list [catch {::db configure -parent .} result] $::errorCode
    }

    -result {1 {TDBC GENERAL_ERROR HY010 ODBC -1}}
}

test tdbc::odbc-19.6 {$connection configure - wrong # args} {*}{
    -body {
	::db configure -parent . -junk
    }
    -returnCodes error
................................................................................
    }
    -body {
	list [catch {
	    db allrows {INSERT INTO people(idnum, name) VALUES(1, 'fred')}
	} result] $result $::errorCode
    }
    -match glob
    -result {1 * {TDBC GENERAL_ERROR HY000 ODBC *}}
}

test tbdc::odbc-25.1b {error code} {*}{
    -constraints jet||sqlserver
    -setup {
	db allrows {DELETE FROM people}
	db allrows {INSERT INTO people(idnum, name) VALUES(1, 'fred')}
................................................................................
	    rename $resultset {}
	    set results
	} results
	rename $stmt {}
	set results
    }
    -match glob
    -result {{{idnum 2 name wilma}} 0 0 1 {TDBC GENERAL_ERROR HY010 *}}
}

test tdbc::odbc-30.4 {Multiple result sets - foreach} {*}{
    -constraints !jet&&!sqlite
    -setup {
	::db allrows {delete from people}
	set stmt [db prepare {







|







|







 







>
|







 







>
|







 







|







 







|







2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
....
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
....
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
....
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
....
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
}

test tdbc::odbc-14.4 {commit - not in transaction} {*}{
    -body {
	list [catch {::db commit} result] $result $::errorCode
    }
    -match glob
    -result {1 {no transaction is in progress} {TDBC GENERAL_ERROR HY* ODBC *}}
}

test tdbc::odbc-14.5 {rollback - not in transaction} {*}{
    -body {
	list [catch {::db rollback} result] $result $::errorCode
    }
    -match glob
    -result {1 {no transaction is in progress} {TDBC GENERAL_ERROR HY* ODBC *}}
}

test tdbc::odbc-14.6 {empty transaction} {*}{
    -body {
	::db begintransaction
	::db commit
    }
................................................................................
    -result "bad option *"
}

test tdbc::odbc-19.3 {$connection configure - inappropriate arg} {*}{
    -body {
	list [catch {::db configure -parent} result] $::errorCode
    }
    -match glob
    -result {1 {TDBC GENERAL_ERROR HY* ODBC -1}}
}

test tdbc::odbc-19.4 {$connection configure - set unknown arg} {*}{
    -body {
	::db configure -junk morejunk
    }
    -returnCodes error
................................................................................
    -result "bad option *"
}

test tdbc::odbc-19.5 {$connection configure - set inappropriate arg} {*}{
    -body {
	list [catch {::db configure -parent .} result] $::errorCode
    }
    -match glob
    -result {1 {TDBC GENERAL_ERROR HY* ODBC -1}}
}

test tdbc::odbc-19.6 {$connection configure - wrong # args} {*}{
    -body {
	::db configure -parent . -junk
    }
    -returnCodes error
................................................................................
    }
    -body {
	list [catch {
	    db allrows {INSERT INTO people(idnum, name) VALUES(1, 'fred')}
	} result] $result $::errorCode
    }
    -match glob
    -result {1 * {TDBC GENERAL_ERROR HY* ODBC *}}
}

test tbdc::odbc-25.1b {error code} {*}{
    -constraints jet||sqlserver
    -setup {
	db allrows {DELETE FROM people}
	db allrows {INSERT INTO people(idnum, name) VALUES(1, 'fred')}
................................................................................
	    rename $resultset {}
	    set results
	} results
	rename $stmt {}
	set results
    }
    -match glob
    -result {{{idnum 2 name wilma}} 0 0 1 {TDBC GENERAL_ERROR HY* *}}
}

test tdbc::odbc-30.4 {Multiple result sets - foreach} {*}{
    -constraints !jet&&!sqlite
    -setup {
	::db allrows {delete from people}
	set stmt [db prepare {