ObjPgSQL  Check-in [30ae6044d9]

Overview
Comment:Use the description for unknown parameter types.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 30ae6044d9f9c0594496cf85ef782c14908ada7b242db6a7ea68bee32716240b
User & Date: js on 2012-10-08 18:53:49
Other Links: manifest | tags
Context
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
18:53
Stricter error checking. check-in: cbc15fadc1 user: js tags: trunk
Changes

Modified PGConnection.m from [bb03b3bd80] to [19a3e925ca].

101
102
103
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

	values = [self allocMemoryWithSize: sizeof(*values)
				     count: argsCount];
	@try {
		size_t i = 0;

		do {
			if ([parameter isKindOfClass: [OFNull class]])
				values[i++] = NULL;
			else if ([parameter isKindOfClass: [OFNumber class]]) {
				switch ([parameter type]) {
				case OF_NUMBER_BOOL:
					if ([parameter boolValue])
						values[i++] = "t";
					else
						values[i++] = "f";
					break;
				default:
					values[i++] = [[parameter description]
					    UTF8String];
					break;
				}


			} else

				values[i++] = [parameter UTF8String];
		} while ((parameter = va_arg(args, id)) != nil);

		result = PQexecParams(conn, [command UTF8String],
		    argsCount, NULL, values, NULL, NULL, 0);
	} @finally {
		[self freeMemory: values];
	}







|
|













>
>
|
>
|







101
102
103
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

	values = [self allocMemoryWithSize: sizeof(*values)
				     count: argsCount];
	@try {
		size_t i = 0;

		do {
			if ([parameter isKindOfClass: [OFString class]])
				values[i++] = [parameter UTF8String];
			else if ([parameter isKindOfClass: [OFNumber class]]) {
				switch ([parameter type]) {
				case OF_NUMBER_BOOL:
					if ([parameter boolValue])
						values[i++] = "t";
					else
						values[i++] = "f";
					break;
				default:
					values[i++] = [[parameter description]
					    UTF8String];
					break;
				}
			} else if ([parameter isKindOfClass: [OFNull class]])
				values[i++] = NULL;
			else
				values[i++] = [[parameter description]
				    UTF8String];
		} while ((parameter = va_arg(args, id)) != nil);

		result = PQexecParams(conn, [command UTF8String],
		    argsCount, NULL, values, NULL, NULL, 0);
	} @finally {
		[self freeMemory: values];
	}