-
Notifications
You must be signed in to change notification settings - Fork 195
/
test_008_ColumnInfo.py
146 lines (139 loc) · 3.23 KB
/
test_008_ColumnInfo.py
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
99
100
101
102
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#
# Licensed Materials - Property of IBM
#
# (c) Copyright IBM Corp. 2007-2008
#
from __future__ import print_function
import sys
import unittest
import ibm_db
import config
from testfunctions import IbmDbTestFunctions
class IbmDbTestCase(unittest.TestCase):
def test_008_ColumnInfo(self):
obj = IbmDbTestFunctions()
obj.assert_expect(self.run_test_008)
def run_test_008(self):
op = {ibm_db.ATTR_CASE: ibm_db.CASE_NATURAL}
conn = ibm_db.connect(config.database, config.user, config.password, op)
server = ibm_db.server_info( conn )
if (server.DBMS_NAME[0:3] == 'IDS'):
result = ibm_db.columns(conn,None,None,"employee")
else:
result = ibm_db.columns(conn,None,None,"EMPLOYEE")
row = ibm_db.fetch_both(result)
value1 = None
value2 = None
value3 = None
value4 = None
if ('TABLE_NAME' in row):
value1 = row['TABLE_NAME']
if ('COLUMN_NAME' in row):
value2 = row['COLUMN_NAME']
if ('table_name' in row):
value3 = row['table_name']
if ('column_name' in row):
value4 = row['column_name']
print (value1)
print (value2)
print (value3)
print (value4)
op = {ibm_db.ATTR_CASE: ibm_db.CASE_UPPER}
ibm_db.set_option(conn, op, 1)
if (server.DBMS_NAME[0:3] == 'IDS'):
result = ibm_db.columns(conn,None,None,"employee")
else:
result = ibm_db.columns(conn,None,None,"EMPLOYEE")
row = ibm_db.fetch_both(result)
value1 = None
value2 = None
value3 = None
value4 = None
if ('TABLE_NAME' in row):
value1 = row['TABLE_NAME']
if ('COLUMN_NAME' in row):
value2 = row['COLUMN_NAME']
if ('table_name' in row):
value3 = row['table_name']
if ('column_name' in row):
value4 = row['column_name']
print (value1)
print (value2)
print (value3)
print (value4)
op = {ibm_db.ATTR_CASE: ibm_db.CASE_LOWER}
ibm_db.set_option(conn, op, 1)
if (server.DBMS_NAME[0:3] == 'IDS'):
result = ibm_db.columns(conn,None,None,"employee")
else:
result = ibm_db.columns(conn,None,None,"EMPLOYEE")
row = ibm_db.fetch_both(result)
value1 = None
value2 = None
value3 = None
value4 = None
if ('TABLE_NAME' in row):
value1 = row['TABLE_NAME']
if ('COLUMN_NAME' in row):
value2 = row['COLUMN_NAME']
if ('table_name' in row):
value3 = row['table_name']
if ('column_name' in row):
value4 = row['column_name']
print (value1)
print (value2)
print (value3)
print (value4)
#__END__
#__LUW_EXPECTED__
#EMPLOYEE
#EMPNO
#None
#None
#EMPLOYEE
#EMPNO
#None
#None
#None
#None
#EMPLOYEE
#EMPNO
#__ZOS_EXPECTED__
#EMPLOYEE
#EMPNO
#None
#None
#EMPLOYEE
#EMPNO
#None
#None
#None
#None
#EMPLOYEE
#EMPNO
#__SYSTEMI_EXPECTED__
#EMPLOYEE
#EMPNO
#None
#None
#EMPLOYEE
#EMPNO
#None
#None
#None
#None
#EMPLOYEE
#EMPNO
#__IDS_EXPECTED__
#None
#None
#employee
#empno
#employee
#empno
#None
#None
#None
#None
#employee
#empno