59
60
61
62
63
64
65
66
67
68
69
|
[stmt bindWithDictionary: [OFDictionary dictionaryWithKeysAndObjects:
@"$a", [OFNumber numberWithInt: 7],
@"$b", @"Test",
@"$c", [OFData dataWithItems: "xyz"
count: 3],
nil]];
[stmt step];
[OFApplication terminate];
}
@end
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
|
[stmt bindWithDictionary: [OFDictionary dictionaryWithKeysAndObjects:
@"$a", [OFNumber numberWithInt: 7],
@"$b", @"Test",
@"$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
|