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
|
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
|
-
-
-
-
+
+
+
+
-
+
-
-
-
+
+
+
-
+
-
+
|
stmt = [conn prepareStatement: @"SELECT * FROM test"];
for (size_t i = 0; [stmt step]; i++) {
OFNumber *a;
OFString *b;
OFData *c;
OF_ENSURE([stmt columnCount] == 3);
OF_ENSURE([[stmt nameForColumn: 0] isEqual: @"a"]);
OF_ENSURE([[stmt nameForColumn: 1] isEqual: @"b"]);
OF_ENSURE([[stmt nameForColumn: 2] isEqual: @"c"]);
OFEnsure([stmt columnCount] == 3);
OFEnsure([[stmt nameForColumn: 0] isEqual: @"a"]);
OFEnsure([[stmt nameForColumn: 1] isEqual: @"b"]);
OFEnsure([[stmt nameForColumn: 2] isEqual: @"c"]);
switch (i) {
case 0:
a = [OFNumber numberWithInt: 5];
b = @"String";
c = [OFData dataWithItems: "abc"
count: 3];
break;
case 1:
a = [OFNumber numberWithInt: 7];
b = @"Test";
c = [OFData dataWithItems: "xyz"
count: 3];
break;
default:
OF_ENSURE(0);
OFEnsure(0);
}
OF_ENSURE([[stmt objectForColumn: 0] isEqual: a]);
OF_ENSURE([[stmt objectForColumn: 1] isEqual: b]);
OF_ENSURE([[stmt objectForColumn: 2] isEqual: c]);
OFEnsure([[stmt objectForColumn: 0] isEqual: a]);
OFEnsure([[stmt objectForColumn: 1] isEqual: b]);
OFEnsure([[stmt objectForColumn: 2] isEqual: c]);
OF_ENSURE([[stmt rowArray] isEqual: ([OFArray arrayWithObjects:
OFEnsure([[stmt rowArray] isEqual: ([OFArray arrayWithObjects:
a, b, c, nil])]);
OF_ENSURE([[stmt rowDictionary] isEqual:
OFEnsure([[stmt rowDictionary] isEqual:
([OFDictionary dictionaryWithKeysAndObjects:
@"a", a, @"b", b, @"c", c, nil])]);
}
[OFApplication terminate];
}
@end
|