ObjPgSQL  Check-in [cf2fe18597]

Overview
Comment:Add Xcode project.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cf2fe185976eb9af8c8437fb68da475cdf47944bef02a89114dc3ea285b97552
User & Date: js on 2012-10-05 21:19:22
Other Links: manifest | tags
Context
2012-10-05
21:26
Install all headers into one place. check-in: 86adc6aab9 user: js tags: trunk
21:19
Add Xcode project. check-in: cf2fe18597 user: js tags: trunk
20:17
Nicer API. check-in: d2fe40f160 user: js tags: trunk
Changes

Modified .gitignore from [988e7455dc] to [bb7fa7dc62].

1
2
3
4
5
6






1
2
3
4
5
6
7
8
-
-




+
+
+
+
build
test
*.dll
*.dylib
*.so
*~
build
test
ObjPgSQL.xcodeproj/project.xcworkspace
ObjPgSQL.xcodeproj/xcuserdata

Added Info.plist version [e42c7911de].

Modified Makefile from [796e46f897] to [4e78bfc4e0].

40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
40
41
42
43
44
45
46

47
48
49
50
51
52
53
54







-
+







		--builddir build	\
		-L.			\
		-lobjpgsql		\
		${CPPFLAGS}		\
		test.m

clean:
	rm -f libobjpgsql.* exceptions/*~ *~
	rm -f test libobjpgsql.* exceptions/*~ *~
	rm -fr build

install:
	mkdir -p ${destdir}${prefix}/include/ObjPgSQL/exceptions
	for i in ${HEADERS}; do \
		${INSTALL} -m 644 $$i \
			${destdir}${prefix}/include/ObjPgSQL/$$i; \

Added ObjPgSQL.xcodeproj/project.pbxproj version [b6ba7e5a00].

Modified PGConnection.m from [d345fef3f0] to [26ac0b68bf].

80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
80
81
82
83
84
85
86

87
88
89
90
91
92
93
94







-
+







- (PGResult*)executeCommand: (OFString*)command
		 parameters: (id)parameter, ...
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	PGresult *result;
	const char **values;
	va_list args, args2;
	size_t argsCount;
	int argsCount;

	va_start(args, parameter);
	va_copy(args2, args);

	for (argsCount = 1; va_arg(args2, id) != nil; argsCount++);

	values = [self allocMemoryWithSize: sizeof(*values)

Modified PGResult.m from [b4a5cbfd43] to [8d3497daef].

32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46







-
+







- (id)objectAtIndex: (size_t)index
{
	if (index > PQntuples(result))
		@throw [OFOutOfRangeException
		    exceptionWithClass: [self class]];

	return [PGResultRow rowWithResult: self
				      row: index];
				      row: (int)index];
}

- (PGresult*)PG_result
{
	return result;
}
@end

Modified PGResultRow.h from [63d46bca55] to [da0166d00f].

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15

16
17

18
1
2
3
4
5
6
7
8
9
10

11
12
13
14

15
16

17
18










-
+



-
+

-
+

#include <libpq-fe.h>

#import <ObjFW/ObjFW.h>

#import "PGResult.h"

@interface PGResultRow: OFDictionary
{
	PGResult *result;
	PGresult *res;
	size_t row;
	int row;
}

+ rowWithResult: (PGResult*)result
	    row: (size_t)row;
	    row: (int)row;
- initWithResult: (PGResult*)result
	     row: (size_t)row;
	     row: (int)row;
@end

Modified PGResultRow.m from [a383c54406] to [28af410d0c].

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
29

30
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
56
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

29
30
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
56






-
+



-
+










-
+






-
+



















-
+







#import "PGResultRow.h"

@interface PGResultRowEnumerator: OFEnumerator
{
	PGResult *result;
	PGresult *res;
	size_t row, pos, count;
	int row, pos, count;
}

- initWithResult: (PGResult*)result
	     row: (size_t)row;
	     row: (int)row;
@end

@interface PGResultRowKeyEnumerator: PGResultRowEnumerator
@end

@interface PGResultRowObjectEnumerator: PGResultRowEnumerator
@end

@implementation PGResultRow
+ rowWithResult: (PGResult*)result
	    row: (size_t)row
	    row: (int)row
{
	return [[[self alloc] initWithResult: result
					 row: row] autorelease];
}

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

	result = [result_ retain];
	res = [result PG_result];
	row = row_;

	return self;
}

- (void)dealloc
{
	[result release];

	[super dealloc];
}

- (size_t)count
{
	size_t i, count, fields = PQnfields(res);
	int i, count, fields = PQnfields(res);

	for (i = count = 0; i < fields; i++)
		if (!PQgetisnull(res, row, i))
			count++;

	return count;
}
83
84
85
86
87
88
89
90

91
92
93
94
95
96
97
83
84
85
86
87
88
89

90
91
92
93
94
95
96
97







-
+







	    initWithResult: result
		       row: row] autorelease];
}
@end

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

	result = [result_ retain];
	res = [result PG_result];
	row = row_;
	count = PQnfields(res);