Logically speaking, the gateway for a specific table should know the name (and the alias) of the table... Is it possible to add a getName() method next to the getAlias() ? (I don't have the code here, and besides I'm not very familiar with the core code, so I  can't figure it out myself right now...)

Wouter

On Sep 1, 2006, at 21:00, Mr. Darby wrote:

Brian,

That's a great idea.  Currently, I have found the method getAlias, that returns either the tables' name if an alias is not defined or the alias for the table object as defined in the reactor.xml.  Having another method that ensures you are returned the table's name regardless of an alias defined would be better.


On 9/1/06, Brian Kotek < [EMAIL PROTECTED]> wrote:
Hi folks, I had posted about this a long time back but I don't think anything came of it so I wanted to bring it up again.

In a custom gateway query, currently you have to explictly specify the name(s) of the tables you want to use in the query, such as:

select userID
from mydb.myschema.user

Now since we've gone through the trouble of defining aliases for our tables in the Reactor XML, I find this undesirable. I'd rather do something like this:

select userID
from #getTableName('user')#


The function to do this is very simple (though if we go the route of adding a separate "schema" attribute to the object tag it would have to take that into consideration):

    <cffunction name="getTableName" access="private" returntype="string" output="false" hint="I return the table name for the passed table alias.">
        <cfargument name="tableAlias" type="string" required="true" hint="Alias of target table." />
        <cfreturn _getConfig().getObjectConfig(arguments.tableAlias).object.xmlAttributes.name />
    </cffunction>

Now I ask, wouldn't it be quite easy to add this to a base class within Reactor somewhere? I can only imagine that many, many people have hardcoded table names in their custom queries and it seems that this could be avoided very easily. Thoughts?

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
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/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to