Commits

Tuukka Norri committed 84d4f88

Fixed a bug which caused a warning to be printed when NSNull was passed as a query parameter
- Added a separate implementation for getting a NULL parameter for NSNull values.
- Wrote a test for it.
- References #204.

Comments (0)

Files changed (2)

Sources/PGTSFoundationObjects.m

 	return retval;
 }
 @end
+
+
+@implementation NSNull (PGTSFoundationObjects)
+- (const char *) PGTSParameterLength: (int *) length connection: (PGTSConnection *) connection
+{
+	if (length)
+		*length = 0;
+	return NULL;
+}
+@end

UnitTests/Sources/PGTSParameterTests.m

 	MKCAssertThrowsSpecificNamed ([value PGTSParameterLength: &length connection: mConnection], NSException, NSInvalidArgumentException);
 }
 
+- (void) test8Null
+{
+	NSNull* value = [NSNull null];
+	
+	int length = 0;
+	id objectValue = [value PGTSParameter: mConnection];
+	const char* paramValue = [objectValue PGTSParameterLength: &length connection: mConnection];
+	
+	CFRetain (objectValue);
+	MKCAssertTrue (NULL == paramValue);
+	CFRelease (objectValue);
+}
+
 - (void) testTimestamp
 {
 	NSTimeInterval interval = 263856941.04633799; //This caused problems.