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