168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
-
+
|
@throw [SL3ExecuteStatementFailedException
exceptionWithStatement: self
errorCode: code];
return (code == SQLITE_ROW);
}
- (id)objectForColumn: (size_t)column
- (id)objectForCurrentRowAtColumn: (size_t)column
{
if (column > INT_MAX)
@throw [OFOutOfRangeException exception];
switch (sqlite3_column_type(_stmt, column)) {
case SQLITE_INTEGER:
return [OFNumber numberWithLongLong:
|
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
-
+
-
+
-
+
-
+
|
if ((name = sqlite3_column_name(_stmt, column)) == NULL)
@throw [OFOutOfMemoryException exception];
return [OFString stringWithUTF8String: name];
}
- (OFArray *)rowArray
- (OFArray *)currentRowArray
{
size_t count = [self columnCount];
OFMutableArray *array = [OFMutableArray arrayWithCapacity: count];
for (size_t i = 0; i < count; i++)
[array addObject: [self objectForColumn: i]];
[array addObject: [self objectForCurrentRowAtColumn: i]];
[array makeImmutable];
return array;
}
- (OFDictionary OF_GENERIC(OFString *, id) *)rowDictionary
- (OFDictionary OF_GENERIC(OFString *, id) *)currentRowDictionary
{
size_t count = [self columnCount];
OFMutableDictionary *dictionary =
[OFMutableDictionary dictionaryWithCapacity: count];
for (size_t i = 0; i < count; i++)
[dictionary setObject: [self objectForColumn: i]
[dictionary setObject: [self objectForCurrentRowAtColumn: i]
forKey: [self nameForColumn: i]];
[dictionary makeImmutable];
return dictionary;
}
|