1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017
* Jonathan Schleifer <js@heap.zone>
*
* https://heap.zone/git/objpgsql.git
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice is present in all copies.
|
|
|
1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019
* Jonathan Schleifer <js@heap.zone>
*
* https://heap.zone/git/objpgsql.git
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice is present in all copies.
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
case 16: /* BOOLOID */
if ([string isEqual: @"t"])
return [OFNumber numberWithBool: YES];
else
return [OFNumber numberWithBool: NO];
case 21: /* INT2OID */
return [OFNumber numberWithInt16:
(int16_t)[string decimalValue]];
case 23: /* INT4OID */
return [OFNumber numberWithInt32:
(int32_t)[string decimalValue]];
case 20: /* INT8OID */
return [OFNumber numberWithInt64:
(int64_t)[string decimalValue]];
case 700: /* FLOAT4OID */
return [OFNumber numberWithFloat: [string floatValue]];
case 701: /* FLOAT8OID */
return [OFNumber numberWithDouble: [string doubleValue]];
}
return string;
}
@interface PGResultRowEnumerator: OFEnumerator
{
|
|
|
|
|
|
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
case 16: /* BOOLOID */
if ([string isEqual: @"t"])
return [OFNumber numberWithBool: YES];
else
return [OFNumber numberWithBool: NO];
case 21: /* INT2OID */
return [OFNumber numberWithInt16:
(int16_t)string.decimalValue];
case 23: /* INT4OID */
return [OFNumber numberWithInt32:
(int32_t)string.decimalValue];
case 20: /* INT8OID */
return [OFNumber numberWithInt64:
(int64_t)string.decimalValue];
case 700: /* FLOAT4OID */
return [OFNumber numberWithFloat: string.floatValue];
case 701: /* FLOAT8OID */
return [OFNumber numberWithDouble: string.doubleValue];
}
return string;
}
@interface PGResultRowEnumerator: OFEnumerator
{
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
+ (instancetype)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;
return self;
}
- (void)dealloc
{
|
|
|
|
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
+ (instancetype)rowWithResult: (PGResult *)result
row: (int)row
{
return [[[self alloc] initWithResult: result
row: row] autorelease];
}
- (instancetype)initWithResult: (PGResult *)result
row: (int)row
{
self = [super init];
_result = [result retain];
_res = result.pg_result;
_row = row;
return self;
}
- (void)dealloc
{
|
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
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;
_count = PQnfields(_res);
return self;
}
- (void)dealloc
|
|
|
|
|
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
state->mutationsPtr = (unsigned long *)self;
return j;
}
@end
@implementation PGResultRowEnumerator
- (instancetype)initWithResult: (PGResult *)result
row: (int)row
{
self = [super init];
_result = [result retain];
_res = result.pg_result;
_row = row;
_count = PQnfields(_res);
return self;
}
- (void)dealloc
|