ObjPgSQL  Diff

Differences From Artifact [d7a041d0e4]:

To Artifact [06d3e5a1c9]:


104
105
106
107
108
109
110
































111
112
113
114
115
116
117

- (OFEnumerator*)objectEnumerator
{
	return [[[PGResultRowObjectEnumerator alloc]
	    initWithResult: result
		       row: row] autorelease];
}
































@end

@implementation PGResultRowEnumerator
- initWithResult: (PGResult*)result_
	     row: (int)row_
{
	self = [super init];







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149

- (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);
	}

	if (count > SIZE_MAX - state->state)
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];

	if (state->state + count > state->extra[1])
		count = state->extra[1] - state->state;

	for (i = j = 0; i < count; i++) {
		if (PQgetisnull(res, row, state->state + i))
			continue;

		objects[j++] = [OFString stringWithUTF8String:
		    PQfname(res, state->state + i)];
	}

	state->state += count;
	state->itemsPtr = objects;
	state->mutationsPtr = (unsigned long*)self;

	return j;
}
@end

@implementation PGResultRowEnumerator
- initWithResult: (PGResult*)result_
	     row: (int)row_
{
	self = [super init];