ObjPgSQL  Check-in [7a033e34c4]

Overview
Comment:Convert floats to native objects as well.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7a033e34c4e334f5b663b7c5e2f10eb8e3fe9a8a0de96a64b352fc4a1e37b410
User & Date: js on 2012-10-08 18:54:17
Other Links: manifest | tags
Context
2012-10-30
17:51
Make use of OF_SENTINEL. check-in: 455ca009cd user: js tags: trunk
2012-10-08
18:54
Convert floats to native objects as well. check-in: 7a033e34c4 user: js tags: trunk
18:53
Use the description for unknown parameter types. check-in: 30ae6044d9 user: js tags: trunk
Changes

Modified PGResultRow.m from [77d330bc63] to [d7a041d0e4].

1
2
3
4
5
6
7

8
9
10
11
12

13
14

15
16

17




18
19
20
21
22
23
24
1
2
3
4
5
6

7
8
9
10
11

12
13

14
15

16
17
18
19
20
21
22
23
24
25
26
27
28






-
+




-
+

-
+

-
+

+
+
+
+







#import "PGResultRow.h"

static id
convert_type(PGresult *res, int col, OFString *str)
{
	switch (PQftype(res, col)) {
	case 16: /* BOOLOID */
	case 16:  /* BOOLOID */
		if ([str isEqual: @"t"])
			return [OFNumber numberWithBool: YES];
		else
			return [OFNumber numberWithBool: NO];
	case 21: /* INT2OID */
	case 21:  /* INT2OID */
		return [OFNumber numberWithInt16: (int16_t)[str decimalValue]];
	case 23: /* INT4OID */
	case 23:  /* INT4OID */
		return [OFNumber numberWithInt32: (int32_t)[str decimalValue]];
	case 20: /* INT8OID */
	case 20:  /* INT8OID */
		return [OFNumber numberWithInt64: (int64_t)[str decimalValue]];
	case 700: /* FLOAT4OID */
		return [OFNumber numberWithFloat: [str floatValue]];
	case 701: /* FLOAT8OID */
		return [OFNumber numberWithDouble: [str doubleValue]];
	}

	return str;
}

@interface PGResultRowEnumerator: OFEnumerator
{