-
Notifications
You must be signed in to change notification settings - Fork 195
/
test_151_FetchAssocSelect_02.py
214 lines (206 loc) · 9.16 KB
/
test_151_FetchAssocSelect_02.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#
# 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_151_FetchAssocSelect_02(self):
obj = IbmDbTestFunctions()
obj.assert_expect(self.run_test_151)
def run_test_151(self):
conn = ibm_db.connect(config.database, config.user, config.password)
server = ibm_db.server_info( conn )
if (server.DBMS_NAME[0:3] == 'IDS'):
op = {ibm_db.ATTR_CASE: ibm_db.CASE_UPPER}
ibm_db.set_option(conn, op, 1)
result = ibm_db.exec_immediate(conn, "select * from sales")
row = ibm_db.fetch_assoc(result)
while ( row ):
#printf("%-10s ",row['SALES_DATE'])
#printf("%-15s ",row['SALES_PERSON'])
#printf("%-15s ",row['REGION'])
#printf("%4s",row['SALES'])
#puts ""
if (row['SALES'] == None):
row['SALES'] = ''
print("%-10s %-15s %-15s %4s" % (row['SALES_DATE'], row['SALES_PERSON'], row['REGION'], row['SALES']))
row = ibm_db.fetch_assoc(result)
#__END__
#__LUW_EXPECTED__
#
#1995-12-31 LUCCHESSI Ontario-South 1
#1995-12-31 LEE Ontario-South 3
#1995-12-31 LEE Quebec 1
#1995-12-31 LEE Manitoba 2
#1995-12-31 GOUNOT Quebec 1
#1996-03-29 LUCCHESSI Ontario-South 3
#1996-03-29 LUCCHESSI Quebec 1
#1996-03-29 LEE Ontario-South 2
#1996-03-29 LEE Ontario-North 2
#1996-03-29 LEE Quebec 3
#1996-03-29 LEE Manitoba 5
#1996-03-29 GOUNOT Ontario-South 3
#1996-03-29 GOUNOT Quebec 1
#1996-03-29 GOUNOT Manitoba 7
#1996-03-30 LUCCHESSI Ontario-South 1
#1996-03-30 LUCCHESSI Quebec 2
#1996-03-30 LUCCHESSI Manitoba 1
#1996-03-30 LEE Ontario-South 7
#1996-03-30 LEE Ontario-North 3
#1996-03-30 LEE Quebec 7
#1996-03-30 LEE Manitoba 4
#1996-03-30 GOUNOT Ontario-South 2
#1996-03-30 GOUNOT Quebec 18
#1996-03-30 GOUNOT Manitoba 1
#1996-03-31 LUCCHESSI Manitoba 1
#1996-03-31 LEE Ontario-South 14
#1996-03-31 LEE Ontario-North 3
#1996-03-31 LEE Quebec 7
#1996-03-31 LEE Manitoba 3
#1996-03-31 GOUNOT Ontario-South 2
#1996-03-31 GOUNOT Quebec 1
#1996-04-01 LUCCHESSI Ontario-South 3
#1996-04-01 LUCCHESSI Manitoba 1
#1996-04-01 LEE Ontario-South 8
#1996-04-01 LEE Ontario-North
#1996-04-01 LEE Quebec 8
#1996-04-01 LEE Manitoba 9
#1996-04-01 GOUNOT Ontario-South 3
#1996-04-01 GOUNOT Ontario-North 1
#1996-04-01 GOUNOT Quebec 3
#1996-04-01 GOUNOT Manitoba 7
#__ZOS_EXPECTED__
#
#1995-12-31 LUCCHESSI Ontario-South 1
#1995-12-31 LEE Ontario-South 3
#1995-12-31 LEE Quebec 1
#1995-12-31 LEE Manitoba 2
#1995-12-31 GOUNOT Quebec 1
#1996-03-29 LUCCHESSI Ontario-South 3
#1996-03-29 LUCCHESSI Quebec 1
#1996-03-29 LEE Ontario-South 2
#1996-03-29 LEE Ontario-North 2
#1996-03-29 LEE Quebec 3
#1996-03-29 LEE Manitoba 5
#1996-03-29 GOUNOT Ontario-South 3
#1996-03-29 GOUNOT Quebec 1
#1996-03-29 GOUNOT Manitoba 7
#1996-03-30 LUCCHESSI Ontario-South 1
#1996-03-30 LUCCHESSI Quebec 2
#1996-03-30 LUCCHESSI Manitoba 1
#1996-03-30 LEE Ontario-South 7
#1996-03-30 LEE Ontario-North 3
#1996-03-30 LEE Quebec 7
#1996-03-30 LEE Manitoba 4
#1996-03-30 GOUNOT Ontario-South 2
#1996-03-30 GOUNOT Quebec 18
#1996-03-30 GOUNOT Manitoba 1
#1996-03-31 LUCCHESSI Manitoba 1
#1996-03-31 LEE Ontario-South 14
#1996-03-31 LEE Ontario-North 3
#1996-03-31 LEE Quebec 7
#1996-03-31 LEE Manitoba 3
#1996-03-31 GOUNOT Ontario-South 2
#1996-03-31 GOUNOT Quebec 1
#1996-04-01 LUCCHESSI Ontario-South 3
#1996-04-01 LUCCHESSI Manitoba 1
#1996-04-01 LEE Ontario-South 8
#1996-04-01 LEE Ontario-North
#1996-04-01 LEE Quebec 8
#1996-04-01 LEE Manitoba 9
#1996-04-01 GOUNOT Ontario-South 3
#1996-04-01 GOUNOT Ontario-North 1
#1996-04-01 GOUNOT Quebec 3
#1996-04-01 GOUNOT Manitoba 7
#__SYSTEMI_EXPECTED__
#
#1995-12-31 LUCCHESSI Ontario-South 1
#1995-12-31 LEE Ontario-South 3
#1995-12-31 LEE Quebec 1
#1995-12-31 LEE Manitoba 2
#1995-12-31 GOUNOT Quebec 1
#1996-03-29 LUCCHESSI Ontario-South 3
#1996-03-29 LUCCHESSI Quebec 1
#1996-03-29 LEE Ontario-South 2
#1996-03-29 LEE Ontario-North 2
#1996-03-29 LEE Quebec 3
#1996-03-29 LEE Manitoba 5
#1996-03-29 GOUNOT Ontario-South 3
#1996-03-29 GOUNOT Quebec 1
#1996-03-29 GOUNOT Manitoba 7
#1996-03-30 LUCCHESSI Ontario-South 1
#1996-03-30 LUCCHESSI Quebec 2
#1996-03-30 LUCCHESSI Manitoba 1
#1996-03-30 LEE Ontario-South 7
#1996-03-30 LEE Ontario-North 3
#1996-03-30 LEE Quebec 7
#1996-03-30 LEE Manitoba 4
#1996-03-30 GOUNOT Ontario-South 2
#1996-03-30 GOUNOT Quebec 18
#1996-03-30 GOUNOT Manitoba 1
#1996-03-31 LUCCHESSI Manitoba 1
#1996-03-31 LEE Ontario-South 14
#1996-03-31 LEE Ontario-North 3
#1996-03-31 LEE Quebec 7
#1996-03-31 LEE Manitoba 3
#1996-03-31 GOUNOT Ontario-South 2
#1996-03-31 GOUNOT Quebec 1
#1996-04-01 LUCCHESSI Ontario-South 3
#1996-04-01 LUCCHESSI Manitoba 1
#1996-04-01 LEE Ontario-South 8
#1996-04-01 LEE Ontario-North
#1996-04-01 LEE Quebec 8
#1996-04-01 LEE Manitoba 9
#1996-04-01 GOUNOT Ontario-South 3
#1996-04-01 GOUNOT Ontario-North 1
#1996-04-01 GOUNOT Quebec 3
#1996-04-01 GOUNOT Manitoba 7
#__IDS_EXPECTED__
#
#1995-12-31 LUCCHESSI Ontario-South 1
#1995-12-31 LEE Ontario-South 3
#1995-12-31 LEE Quebec 1
#1995-12-31 LEE Manitoba 2
#1995-12-31 GOUNOT Quebec 1
#1996-03-29 LUCCHESSI Ontario-South 3
#1996-03-29 LUCCHESSI Quebec 1
#1996-03-29 LEE Ontario-South 2
#1996-03-29 LEE Ontario-North 2
#1996-03-29 LEE Quebec 3
#1996-03-29 LEE Manitoba 5
#1996-03-29 GOUNOT Ontario-South 3
#1996-03-29 GOUNOT Quebec 1
#1996-03-29 GOUNOT Manitoba 7
#1996-03-30 LUCCHESSI Ontario-South 1
#1996-03-30 LUCCHESSI Quebec 2
#1996-03-30 LUCCHESSI Manitoba 1
#1996-03-30 LEE Ontario-South 7
#1996-03-30 LEE Ontario-North 3
#1996-03-30 LEE Quebec 7
#1996-03-30 LEE Manitoba 4
#1996-03-30 GOUNOT Ontario-South 2
#1996-03-30 GOUNOT Quebec 18
#1996-03-30 GOUNOT Manitoba 1
#1996-03-31 LUCCHESSI Manitoba 1
#1996-03-31 LEE Ontario-South 14
#1996-03-31 LEE Ontario-North 3
#1996-03-31 LEE Quebec 7
#1996-03-31 LEE Manitoba 3
#1996-03-31 GOUNOT Ontario-South 2
#1996-03-31 GOUNOT Quebec 1
#1996-04-01 LUCCHESSI Ontario-South 3
#1996-04-01 LUCCHESSI Manitoba 1
#1996-04-01 LEE Ontario-South 8
#1996-04-01 LEE Ontario-North
#1996-04-01 LEE Quebec 8
#1996-04-01 LEE Manitoba 9
#1996-04-01 GOUNOT Ontario-South 3
#1996-04-01 GOUNOT Ontario-North 1
#1996-04-01 GOUNOT Quebec 3
#1996-04-01 GOUNOT Manitoba 7