Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!portc01.blue.aol.com!newsxfer2.itd.umich.edu!howland.erols.net!newsfeed.internetmci.com!mr.net!newshub.tc.umn.edu!fu-berlin.de!unlisys!blackbush.xlink.net!ins.net!heeg.de!uucp
From: Hasko Heinecke <hasko@heeg.de>
Subject: Re: selectionBlock in Gemstone
Content-Type: text/plain; charset=us-ascii
Message-ID: <328C8550.1CFBAE39@heeg.de>
Sender: uucp@heeg.de
Content-Transfer-Encoding: 7bit
Organization: Georg Heeg - Object-Oriented Systems
References: <3263331D.5B7@uni-koblenz.de> <5468mb$kur@newsbf02.news.aol.com>
Mime-Version: 1.0
Date: Fri, 15 Nov 1996 14:59:28 GMT
X-Mailer: Mozilla 3.01Gold (X11; I; SunOS 4.1.3 sun4c)
Lines: 51

Cpraber wrote:
> 
> In article <3263331D.5B7@uni-koblenz.de>, Michael Prasse
> <prass@uni-koblenz.de> writes:
> 
> >Subject:       selectionBlock in Gemstone
> >From:  Michael Prasse <prass@uni-koblenz.de>
> >Date:  Tue, 15 Oct 1996 08:45:49 +0200
> >
> >Hi,
> >
> >Is there any possibility to create selectionBlock's dynamically at run
> >time in Gemstone?
> >There is often the following situation:
> >       aColl select: {:item| item.aspect = something}
> >        aspect (instance variable) = { name, value, identifier ... .}
> >
> >It would be nice if I could use a method to create the needed block for
> >the current aspect.
> >
> >bye  Michael
> >
> >
> 
> Place the query you want to execute in aString, then
> 
> Look at:
> 
> aString #_compileInContext:symbolList:
> 
> The result of of this expression is a GsMethod.
> 
> Send #_executeInContext: to the GsMethod instance to execute the resulting
> query block.
> 
> You can use this to build up queries dynamically, and execute them on the
> fly. Try this with C++ !!!

An easier way would be to take the result of:

  gsBlock := GSI currentSession execute: '{:x | blurb.aspect > x}'

This works for GemStone 4.1, for 5.0 you'll have to replace GSI by GBSM
or so. I don't have GS 5.0 running right now...

Hasko
-- 
+------------------------------------------------------+
| Hasko Heinecke, Georg Heeg - Object-Oriented Systems |
| mailto:hasko@heeg.de or try http://www.heeg.de/      |
+------------------------------------------------------+
