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

Sebastian Reitenbach gnustep-port@opengroupware.org
Wed, 06 Jun 2007 08:51:00 +0200


Hi,

gnustep-port@opengroupware.org wrote: 
> On Jun 4, 2007, at 06:55, Sebastian Reitenbach wrote:
> > This is the outcome:
> >
> > 2007-06-04 06:43:09.312 ogo-webui-1.1[1563]
> > sope/sope-gdl1/PostgreSQL/NSNumber+PGVal.m: here in  
> > GNUSTEP_BASE_LIBRARY!!!
> > self class: NSIntNumber
> > 2007-06-04 06:43:09.312 ogo-webui-1.1[1563]
> > sope/sope-gdl1/PostgreSQL/NSNumber+PGVal.m: not a   
> > GNUSTEP_BASE_LIBRARY!!!
> >
> >
> > obviously       if ([self isKindOfClass:BoolClass])
> >         return [self boolValue] ? @"1" : @"0";
> >
> > doesn't work.
> 
> Hm, just checked, should be NSBoolNumber. I suppose your log is from  
> a real int number.
> 

I had to make the following changes to make it work:

===================================================================
LSFetchTeamRelationCommand.m: unmodified: line 41
  qualifier = [[EOSQLQualifier alloc] initWithEntity:personEntity
                                   qualifierFormat:
                                     @"(%A = %@) AND (%A = %@)",
                                     
@"toProjectCompanyAssignment.projectId",
                                     key,
                                     
@"toProjectCompanyAssignment.hasAccess",
                                     [NSNumber numberWithInt:YES]];
===================================================================
./OGoDatabaseProject/SkyProjectFileManagerCache.m
    qualifier = [[EOSQLQualifier alloc] initWithEntity:entity
                                        qualifierFormat:@"%A = %i",
                                        @"isPerson", @"1",nil];
===================================================================
./SkyProjectFileManagerCache+Internals.m
  qualifier = [[EOSQLQualifier alloc] initWithEntity:entity
                                      qualifierFormat:@"%A = %@ AND %A 
= %@",
                                      @"projectId",
                                      [self->project 
valueForKey:@"projectId"],
                                      @"isFolder", @"1"];
===================================================================
./Logic/LSProject/LSFetchPersonRelationCommand.m
  qualifier = [[EOSQLQualifier alloc] initWithEntity:personEntity
                                   qualifierFormat:
                                     @"(%A = %@) AND (%A = %@)",
                                     
@"toProjectCompanyAssignment.projectId",
                                     key,
                                     
@"toProjectCompanyAssignment.hasAccess",
                                     [NSNumber numberWithInt:0]];
===================================================================
./Logic/LSProject/LSFetchAccountRelationCommand.m: unmodified: line 44
 personEntity = [[self databaseModel] entityNamed:@"Person"];
  qualifier = [[EOSQLQualifier alloc] initWithEntity:personEntity
                                   qualifierFormat:
                                     @"(%A = %@) AND (%A = %@)",
                                     
@"toProjectCompanyAssignment.projectId",
                                     key,
                                     
@"toProjectCompanyAssignment.hasAccess",
                                     [NSNumber numberWithInt:1]];

========================================================================
I had to change the [NSNumber numberWithBool:YES] to [NSNumber 
numberWithInt:1] or numberWithInt:YES to make it work.

Maybe It should be changed from [NSNumber numberWithBool:YES] to 
[NSBoolNumber numberWithBool:YES] and then check for Bool in 
NSNumber+PGVal.m

this at least works for me, with gnustep-base now, but dunno, whether this 
will break sth. with libFoundation or cocoa. Don't know whether there is a 
better place to make the changes. 

kind regards
Sebastian