Dear Glorp Community
-- I am unable to find my error given a seemingly simple query: mySession read: Invoice where: [:inv| inv claim payments isEmpty]. (Invoice 1:1 Claim 0:n Payments) Glorp cannot generate the correct NOT EXISTS subquery, although I can read and navigate claims and invoices and payments without any problems in our application (so I guess the OneToManyMapping and its OneToOneMapping counterpart as well as their JOIN expression are correct). The Exception I am getting is: SimpleQuery does not understand #asSymbol. The exception is thrown in MappingExpression(ObjectExpression)>>#get: get: aSymbol "Return the mapping expression corresponding to the named attribute" | reallyASymbol functionExpression | reallyASymbol := aSymbol asSymbol. functionExpression := self getFunction: aSymbol withArguments: #(). functionExpression isNil ifFalse: [^functionExpression]. ^self mappingExpressions at: reallyASymbol ifAbsentPut: [MappingExpression named: reallyASymbol basedOn: self] aSymbol, however, is not a Symbol, but "a SimpleQuery for Payment". What can I do now? Any tips where to look, what to change? Thanks in advance Joachim You received this message because you are subscribed to the Google Groups "glorp-group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/glorp-group. For more options, visit https://groups.google.com/d/optout. |
Nevermind, I found a "solution"
-- mySession read: Invoice where: [:inv| inv claim payments sqlCount = 0]. But looking at Slide 13 of http://www.esug.org/data/ESUG2007/Wed/glorpesug2007.pdf I thought isEmpty/notEmpty yields the same query. But it doesn't. Is this a bug or am I wrong about this isEmpty/notEmpty thing? Joachim Am Donnerstag, 12. April 2018 10:23:30 UTC+2 schrieb jtuchel:
You received this message because you are subscribed to the Google Groups "glorp-group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/glorp-group. For more options, visit https://groups.google.com/d/optout. |
So while the result of
-- sqlCount=0 is equivalent to an isEmpty, the queries are of course different. One creates a subquery that does a COUNT(*) = 0, while I would expect the other to create a WHERE NOT EXISTS subquery. I am not an SQL expert, so I cannot say anything useful if any of these is more efficient. At first sight, I'd guess a COUNT(*) is slower, comparable to Smalltalk's (select: [:each| ...]) isEmpty as compared to anySatisfy: or detect: Still wondering if my expectations towards isEmpty are wrong. Joachim Am Donnerstag, 12. April 2018 11:21:46 UTC+2 schrieb jtuchel:
You received this message because you are subscribed to the Google Groups "glorp-group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/glorp-group. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |