On Wed, Feb 20, 2008 at 4:57 AM, phantz <[EMAIL PROTECTED]> wrote: > > Hey, > > I understand that you "shouldn't" use spaces in field names when using > cake. But the problem is that I have been given a huge amount of data > that is filled with field names containing spaces. I can't remove > these spaces and I can't alter the structure of the db at all. > > Is there a way to use cake with field names that have spaces? > > Basically any query with spaces end up with the ` in the wrong place. > > For example this is from an association generated query: > > " .. LEFT JOIN `new vehicles` AS `NewVehicles` ON > (`VehiclesTrims`.`Vehicle` ID = `NewVehicles`.`Vehicle` ID) .." > > Should be: > > " .. LEFT JOIN `new vehicles` AS `NewVehicles` ON > (`VehiclesTrims`.`Vehicle ID` = `NewVehicles`.`Vehicle ID`) .." > > Basically it puts the second ` in between the words instead of at the > end of the field name. `Vehicle` ID as apposed to `Vehicle ID` >
Database column names should never have spaces. Is this an MSAcces file? Is there some existing application that will be sharing the data with Cake? If the data will be fetched by Cake from a different store (say, copied from Access to MySQL) you could translate the column names on the fly whenever you dump data from one to the other. But, if both applications will be fetching from the same DB this will be a problem (and, if it is MSAccess that your web app uses you have other problems to begin with). --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
