Glorp and ~~ within queries

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Glorp and ~~ within queries

Maarten Mostert

Good morning,

 

I was wondering why the code below does not give the same results ?

 

 

myColl := (self getGlorpSession readManyOf: Attachement

where: [:each | each hashvalue = eachAtt hashvalue])

select: [:each | each id ~~ eachAtt id].


newQuery := Glorp.Query readManyOf: Attachement

where: [:each | each hashvalue = eachAtt hashvalue].

newQuery := newQuery AND: [:each | each id ~~ eachAtt id].

aColl := self getGlorpSession execute: newQuery.

 

Thanks,

 

@+Maarten,


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Glorp and ~~ within queries

Alan Knight-2
~~ (not identical) is an inlined selector. So it's not being passed to Glorp, it's being directly run as part of the block. That makes the query block overall evaluate to false, so you're getting exactly the same effect as if you wrote
   newQuery AND: [:each | false]
This is the same reason you have to write AND: (or &) instead of and:



[hidden email]
29 October, 2011 5:39 AM


Good morning,

 

I was wondering why the code below does not give the same results ?

 

 

myColl := (self getGlorpSession readManyOf: Attachement

where: [:each | each hashvalue = eachAtt hashvalue])

select: [:each | each id ~~ eachAtt id].


newQuery := Glorp.Query readManyOf: Attachement

where: [:each | each hashvalue = eachAtt hashvalue].

newQuery := newQuery AND: [:each | each id ~~ eachAtt id].

aColl := self getGlorpSession execute: newQuery.

 

Thanks,

 

@+Maarten,

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc