| I think it uses the last one defined in the document, the same as CF would if you were to call
<cfset go = "test"> <cfset go = "test2"> <cfset go = "test3"> <cfset go = "test4"> <cfoutput>#go#</cfoutput>
In this case, #go# would be test4... and Reactor would do the same. Your alias would refer to whatever the last object was it was used in conjunction with.
I THINK... because I think I did this accidentally a couple weeks ago. I remember things weren't working quite as expected and found the issue, but IIRC the net effect was as described above.
Laterz, J
------------------------------------------------ Jared C. Rypka-Hauer Continuum Media Group LLC http://www.web-relevant.com Member, Team Macromedia - ColdFusion
"That which does not kill me makes me stranger." - Yonah Schmeidler On Apr 13, 2006, at 9:29 AM, Brian Kotek wrote: I'll have to do some tests to confirm, but if you give two tables the same alias that would seem to create a problem. If you ask reactor for a gateway and specify an alias that was used more than once in the Reactor XML, how does Reactor know which table you're referring to? I don't see how it could.
On 4/13/06, Bowden, Beth (NIH/NIEHS) [E] < [EMAIL PROTECTED]> wrote: I gave two different tables the same alias and then created a gateway, record, … etc using that alias w/o a problem. This may be a gotcha if you inadvertently use the same alias twice. To: [email protected] Subject: Re: [Reactor For CF] Determine table names in custom query?
To add one thought, maybe the getTableForAlias() (or whatever it would be called) would be at home in the Reactor Config object rather than the base Reactor object, but regardless of where it lives, I think something like this should be available. On 4/13/06, Brian Kotek <[EMAIL PROTECTED]> wrote: Yep, I'm aware of the Query object. But what if your custom query is complex (multiple joins, group by, aggregate or custom SQL functions, etc.)? No matter how we slice it there will certainly be times when you simply have no choice but to write a query out by hand (after all, that is what the custom gateway and DAO components are for). And in those cases, it seems reasonable to want to leverage the configuration information you supplied in the Reactor XML file. After all, I've already told Reactor what aliases map to what tables and it seems like being able to get to that configuration information would be very valuable. I'm saying I think a method like the one I attached earlier should be added to the base Reactor object to make this easy (assuming I'm not missing some existing way to get at this configuration information).
On 4/12/06, João Fernandes < [EMAIL PROTECTED]> wrote: Well I also realized the problem using the alias instead of the table name but if you want to build custom queries with joins you should take a look to the createquery() method. The Query Object have multiple functions that allow you to build all kind of custom queries, including joining tables. João Fernandes -----Original Message----- From: [EMAIL PROTECTED] on behalf of Brian Kotek Sent: Thu 13-Apr-06 12:49 AM To: [email protected] Subject: Re: [Reactor For CF] Determine table names in custom query? Thanks for the response Joao, but there are two problems with that. First, I already know the alias and I want the actual table name that is mapped to the alias. Placing the alias into the SQL statement would result in an error if the alias is different from the table name (which mine is). And second, if my query needs to join to a table outside the current object for some reason, I would want to be able to get the table name for *any* alias that I give it. On 4/12/06, João Fernandes < [EMAIL PROTECTED]> wrote: > > Your gateway has a private function getObjectMetadata() that will return a > reactor.base.abstractMetadata object. > > That object has several methods like getAlias() ;) > > so you could use > > <cffunction name="myCustomGatewayMethod"> > select * > from #getObjectMetadata().getAlias()# where ... > </cffunction> > > Not tested but it should work > > João Fernandes > > -- Reactor for ColdFusion Mailing List -- [email protected] -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/ -- Reactor for ColdFusion Mailing List -- [email protected] -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/ -- Reactor for ColdFusion Mailing List -- [email protected] -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/ -- Reactor for ColdFusion Mailing List -- [email protected] -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/ |