41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
@interface PGResultRowKeyEnumerator: PGResultRowEnumerator
@end
@interface PGResultRowObjectEnumerator: PGResultRowEnumerator
@end
@implementation PGResultRow
+ rowWithResult: (PGResult*)result
row: (int)row
{
return [[[self alloc] initWithResult: result
row: row] autorelease];
}
- initWithResult: (PGResult*)result
row: (int)row
{
self = [super init];
_result = [result retain];
_res = [result PG_result];
_row = row;
|
|
|
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
@interface PGResultRowKeyEnumerator: PGResultRowEnumerator
@end
@interface PGResultRowObjectEnumerator: PGResultRowEnumerator
@end
@implementation PGResultRow
+ rowWithResult: (PGResult *)result
row: (int)row
{
return [[[self alloc] initWithResult: result
row: row] autorelease];
}
- initWithResult: (PGResult *)result
row: (int)row
{
self = [super init];
_result = [result retain];
_res = [result PG_result];
_row = row;
|
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
|
if (PQgetisnull(_res, _row, column))
return nil;
return convertType(_res, column,
[OFString stringWithUTF8String: PQgetvalue(_res, _row, column)]);
}
- (OFEnumerator*)keyEnumerator
{
return [[[PGResultRowKeyEnumerator alloc]
initWithResult: _result
row: _row] autorelease];
}
- (OFEnumerator*)objectEnumerator
{
return [[[PGResultRowObjectEnumerator alloc]
initWithResult: _result
row: _row] autorelease];
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
objects: (id*)objects
count: (int)count
{
int i, j;
if (state->extra[0] == 0) {
state->extra[0] = 1;
state->extra[1] = PQnfields(_res);
|
|
|
|
|
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
|
if (PQgetisnull(_res, _row, column))
return nil;
return convertType(_res, column,
[OFString stringWithUTF8String: PQgetvalue(_res, _row, column)]);
}
- (OFEnumerator *)keyEnumerator
{
return [[[PGResultRowKeyEnumerator alloc]
initWithResult: _result
row: _row] autorelease];
}
- (OFEnumerator *)objectEnumerator
{
return [[[PGResultRowObjectEnumerator alloc]
initWithResult: _result
row: _row] autorelease];
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
objects: (id *)objects
count: (int)count
{
int i, j;
if (state->extra[0] == 0) {
state->extra[0] = 1;
state->extra[1] = PQnfields(_res);
|
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
state->mutationsPtr = (unsigned long*)self;
return j;
}
@end
@implementation PGResultRowEnumerator
- initWithResult: (PGResult*)result
row: (int)row
{
self = [super init];
_result = [result retain];
_res = [result PG_result];
_row = row;
|
|
|
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
state->mutationsPtr = (unsigned long*)self;
return j;
}
@end
@implementation PGResultRowEnumerator
- initWithResult: (PGResult *)result
row: (int)row
{
self = [super init];
_result = [result retain];
_res = [result PG_result];
_row = row;
|