tdbc::postgres

Check-in [16d25624e1]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:When environment doesn't permit complete testing, drop out gently.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 16d25624e1aff17b4cd10f3f68ea1b8047a84c51
User & Date: dgp 2012-12-03 19:47:57
Context
2012-12-06
17:03
Attempt to add MSVC support via copy/paste/modify from other drivers. check-in: 6d35680f71 user: dgp tags: trunk
2012-12-03
19:47
When environment doesn't permit complete testing, drop out gently. check-in: 16d25624e1 user: dgp tags: trunk
2012-11-15
22:39
Changed the configurator so that `make test` will function correctly even when testing against an uninstalled TDBC. check-in: 4f2bd4c386 user: kennykb tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/tdbcpostgres.test.

24
25
26
27
28
29
30

31
32

33
34
35
36
37
38
39
..
72
73
74
75
76
77
78

79
80
81
82
83
84
85
86
...
103
104
105
106
107
108
109

110
111
112
113
114
115
116
117
118
119
120
121
122






123
124
125
126
127
128
129
    lappend connFlags -user $env(TDBCPOSTGRES_USER)
}
if {[info exists env(TDBCPOSTGRES_PASSWD)]} {
    lappend connFlags -password $env(TDBCPOSTGRES_PASSWD)
}
if {[info exists env(TDBCPOSTGRES_DB)]} {
    lappend connFlags -db $env(TDBCPOSTGRES_DB)

} else {
    lappend connFlags -db tdbc_test

}
if {[info exists env(TDBCPOSTGRES_PORT)]} {
    lappend connFlags -port $env(TDBCPOSTGRES_PORT)
}

#------------------------------------------------------------------------------
test tdbc::postgres-1.1 {create a connection, wrong # args} {*}{
................................................................................
}

test tdbc::postgres-1.5 {create a connection, bad port} {*}{
    -body {
	tdbc::postgres::connection create db -port 999999999999
    }
    -returnCodes error

    -result {integer value too large to represent}
}

test tdbc::postgres-1.6 {create a connection, bad port} {*}{
    -body {
	tdbc::postgres::connection create db -port -1
    }
    -returnCodes error
................................................................................
	list $status $result $::errorCode
    }
    -match glob
    -result {1 {could not translate host name*} {TDBC GENERAL_ERROR HY000 POSTGRES *}}
}

test tdbc::postgres-1.9 {create a connection, successful} {*}{

    -body {
	tdbc::postgres::connection create ::db {*}$connFlags
    }
    -result ::db
    -cleanup {
	catch {rename ::db {}}
    }
}


#------------------------------------------------------------------------------
#
# The tests that follow all require a connection to a database.







tdbc::postgres::connection create ::db {*}$connFlags
catch {::db allrows {DROP TABLE people}}

#------------------------------------------------------------------------------

test tdbc::postgres-2.1 {prepare statement, wrong # args} {*}{






>

<
>







 







>
|







 







>













>
>
>
>
>
>







24
25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
...
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
    lappend connFlags -user $env(TDBCPOSTGRES_USER)
}
if {[info exists env(TDBCPOSTGRES_PASSWD)]} {
    lappend connFlags -password $env(TDBCPOSTGRES_PASSWD)
}
if {[info exists env(TDBCPOSTGRES_DB)]} {
    lappend connFlags -db $env(TDBCPOSTGRES_DB)
    tcltest::testConstraint connect 1
} else {

    tcltest::testConstraint connect 0
}
if {[info exists env(TDBCPOSTGRES_PORT)]} {
    lappend connFlags -port $env(TDBCPOSTGRES_PORT)
}

#------------------------------------------------------------------------------
test tdbc::postgres-1.1 {create a connection, wrong # args} {*}{
................................................................................
}

test tdbc::postgres-1.5 {create a connection, bad port} {*}{
    -body {
	tdbc::postgres::connection create db -port 999999999999
    }
    -returnCodes error
    -match glob
    -result {integer value too large to represent*}
}

test tdbc::postgres-1.6 {create a connection, bad port} {*}{
    -body {
	tdbc::postgres::connection create db -port -1
    }
    -returnCodes error
................................................................................
	list $status $result $::errorCode
    }
    -match glob
    -result {1 {could not translate host name*} {TDBC GENERAL_ERROR HY000 POSTGRES *}}
}

test tdbc::postgres-1.9 {create a connection, successful} {*}{
    -constraints connect
    -body {
	tdbc::postgres::connection create ::db {*}$connFlags
    }
    -result ::db
    -cleanup {
	catch {rename ::db {}}
    }
}


#------------------------------------------------------------------------------
#
# The tests that follow all require a connection to a database.

if {![tcltest::testConstraint connect]} {
    puts "tests requiring a db connection skipped."
    cleanupTests
    return
}

tdbc::postgres::connection create ::db {*}$connFlags
catch {::db allrows {DROP TABLE people}}

#------------------------------------------------------------------------------

test tdbc::postgres-2.1 {prepare statement, wrong # args} {*}{