I was able to successfully submit this as Ticket #13.

Christopher Bradford
Alive! LLP
----- Original Message -----
Sent: Monday, June 05, 2006 6:00 PM
Subject: SPAM-LOW: [Reactor for CF] MSSQL bug with field aliases

I just tried to submit this to the Trac site, but it's timing out when I try to submit the ticket:
 
Using changeset 269 and MSSQL 2000 (but 2005 exhibits the same behavior).
 
 
I have a field alias defined for a particular table (BookPagesID --> ID), and when Reactor generates the SQL for loading a Record of that type (reactorFactory.createRecord("Page").load(ID=1)), it uses the alias in the where clause. This is the Reactor-generated query:
 
SELECT [page].[BookPagesID] AS [ID], [page].[Active] AS [Active], [page].[ProjectID] AS [ProjectID], [page].[BookPageTypeID] AS [BookPageTypeID], [page].[PageNum] AS [PageNum], [page].[BackgroundImageID] AS [BackgroundImageID], [page].[BGAlpha] AS [BGAlpha], [page].[SubLayoutCatID] AS [SubLayoutCatID], [page].[TemplateTitle] AS [TemplateTitle], [page].[TemplateImage] AS [TemplateImage] FROM [BookPages] AS [page] WHERE [page].[ID] = (param 1)
 
MSSQL Server returns an error (it doesn't allow aliases in where clauses):
 
[Macromedia][SQLServer JDBC Driver][SQLServer]Invalid column name 'ID'.
 
The same error occurs when running this query in Query Analyzer (substituting in the param value). Changing "WHERE [page].[ID]" to "WHERE [page].[BookPagesID]" works just fine.
 
For MSSQL, Reactor should use the original column name in all where clauses.

Christopher Bradford
Alive! LLP

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