ObjPgSQL  Check-in [455ca009cd]

Overview
Comment:Make use of OF_SENTINEL.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 455ca009cddd89b64802c95292b969127474f1dd22ede2ce56d5eba16fb1b517
User & Date: js 2012-10-30 17:51:16
Context
2012-10-30
22:33
Implement fast enumeration. check-in: 2da674855b user: js tags: trunk
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
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to PGConnection.h.

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

- (void)setParameters: (OFDictionary*)parameters;
- (OFDictionary*)parameters;
- (void)connect;
- (void)reset;
- (PGResult*)executeCommand: (OFConstantString*)command;
- (PGResult*)executeCommand: (OFConstantString*)command
		 parameters: (id)firstParameter, ...;
- (PGconn*)PG_connection;
- (void)insertRow: (OFDictionary*)row
	intoTable: (OFString*)table;
- (void)insertRows: (OFArray*)rows
	 intoTable: (OFString*)table;
@end







|






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

- (void)setParameters: (OFDictionary*)parameters;
- (OFDictionary*)parameters;
- (void)connect;
- (void)reset;
- (PGResult*)executeCommand: (OFConstantString*)command;
- (PGResult*)executeCommand: (OFConstantString*)command
		 parameters: (id)firstParameter, ... OF_SENTINEL;
- (PGconn*)PG_connection;
- (void)insertRow: (OFDictionary*)row
	intoTable: (OFString*)table;
- (void)insertRows: (OFArray*)rows
	 intoTable: (OFString*)table;
@end

Changes to test.m.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
				    @"    success boolean"
				    @")"];
	[connection executeCommand: @"INSERT INTO test (id, name, content) "
				    @"VALUES ($1, $2, $3)"
			parameters: @1, @"foo", @"Hallo Welt!", nil];
	[connection executeCommand: @"INSERT INTO test (id, content, success) "
				    @"VALUES ($1, $2, $3)"
			parameters: @2, @2, @YES];
	[connection insertRow: @{ @"content": @"Hallo!", @"name": @"foo" }
		    intoTable: @"test"];

	result = [connection executeCommand: @"SELECT * FROM test"];
	of_log(@"%@", result);
	of_log(@"JSON: %@", [result JSONRepresentation]);








|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
				    @"    success boolean"
				    @")"];
	[connection executeCommand: @"INSERT INTO test (id, name, content) "
				    @"VALUES ($1, $2, $3)"
			parameters: @1, @"foo", @"Hallo Welt!", nil];
	[connection executeCommand: @"INSERT INTO test (id, content, success) "
				    @"VALUES ($1, $2, $3)"
			parameters: @2, @2, @YES, nil];
	[connection insertRow: @{ @"content": @"Hallo!", @"name": @"foo" }
		    intoTable: @"test"];

	result = [connection executeCommand: @"SELECT * FROM test"];
	of_log(@"%@", result);
	of_log(@"JSON: %@", [result JSONRepresentation]);