[OGo-GNUstep-Port] postgresql adapter exception while entering a project

Helge Hess gnustep-port@opengroupware.org
Sun, 3 Jun 2007 23:37:22 +0200


On Jun 3, 2007, at 21:37, Sebastian Reitenbach wrote:
>   <PostgreSQL72Exception: 0x83eb7288> NAME:PostgreSQL72FatalError
> REASON:fatal pgsql error (channel=<0x0x8a255108[PostgreSQL72Channel]:
> connection=<0x0x7ecb4628[PGConnection]:   
> connection=0x0x7e4d0800>>): ERROR:
> column "yes" does not exist
> LINE 1: ...ompany_id, t1.login FROM  person t1 WHERE t1.is_person =  
> YES
>                                                                     ^

Hm, OK. Thats probably the stringValue of a boolean NSNumber. Which  
probably is YES on GNUstep and 1 on libFoundation/Cocoa. Would need  
to check.

This is in NSNumber+PGVal.m:
---snip---
- (NSString *)stringValueForPostgreSQLType:(NSString *)_type
   attribute:(EOAttribute *)_attribute
{
   // TODO: can we avoid the lowercaseString?
   unsigned len;
   unichar  c1;

   if (debugOn)
     NSLog(@"%s(type=%@,attr=%@)", __PRETTY_FUNCTION__, _type,  
_attribute);

   if ((len = [_type length]) == 0) {
     if (debugOn) NSLog(@"  no type, return string");
     return [self stringValue];
   }
   if (len < 4) { /* apparently this is 'INT'? */
     if (debugOn) NSLog(@"  type len < 4 (%@), return string", _type);
#if GNUSTEP_BASE_LIBRARY
     /*
        on gstep-base -stringValue of bool's return YES or NO, which  
seems to
        be different on Cocoa and liBFoundation.
     */
     {
       Class BoolClass = Nil;

       if (BoolClass == Nil) BoolClass = NSClassFromString 
(@"NSBoolNumber");
       if ([self isKindOfClass:BoolClass])
	return [self boolValue] ? @"1" : @"0";
     }
#endif
     return [self stringValue];
   }
---snap---

Greets,
   Helge
-- 
Helge Hess
http://www.helgehess.eu/