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

Reply via email to