[Solar-talk] RE: Interesting SQL Error from Model

Paul M Jones pmjones at paul-m-jones.com
Fri May 2 09:34:57 CDT 2008


On May 2, 2008, at 09:58 , Kilbride, James P. wrote:
> So I figured out the problem. It's in the name of the relationship  
> I'm using(which is called currently procedure, since it's pulling  
> back the parent procedure). Apparently you can't use reserved words  
> even in the names of the foreign relationships because the model  
> code uses it as the as statement in the query which is why procedure  
> ends up in the select query even though I didn't name the table  
> procedure. I'm not sure what I think about this since solar should  
> either capture that the relationship is a 'reserved word' and  
> complain rather than going to the sql before it does, or it  
> shouldn't be using the relationship name in the sql query. I'm  
> actually more on the lines that it shouldn't be using the  
> relationship name in the query myself but perhaps there is a reason  
> for it.
>

The reason for using the relationship name in the query is as a table  
alias; that way you can add WHERE and HAVING conditions based on the  
relationship alias name without having to know the actual table name.   
With that in mind, the model fix*() methods should check against  
reserved words in relationship names -- good call, and thanks for  
pointing it out.

If you have time, could you enter that as a bug in Trac?  <http://solarphp.com/trac/newticket 
 >  I'm pretty sure I can remember it, but my memory has been known to  
be imperfect.

Thanks for following up with the solution.


-- pmj


More information about the Solar-talk mailing list