Thanks for the suggestion, that worked out for me. I was disappointed to have to finally use a custom query, but it seemed necessary this time. I have to go about 3 levels deep through the models to get everything I need, which resulted in over 8000 queries per page of results. It was done the Cake way (as best as I could tell), but just seemed unreasonable since a single fairly simple query could be written to accomplish the same thing.
-Blake On May 29, 10:42 am, jperras <[email protected]> wrote: > > Determine which database driver is being used > > http://api.cakephp.org/class/model#method-ModelgetDataSource > > As for your custom query, it really depends. Cake does a lot for you, > but sometimes it makes sense to drop down to the bare metal and write > a custom query. > > -j. > > On May 28, 12:46 pm, blake <[email protected]> wrote: > > > Hello, > > > Not sure if this has been discussed before, but I couldn't find it. As > > much as I hate to do it, I think I may need to use my first custom > > query out of this entire website (either that or use a recursive > > search, which is running thousands of queries instead of just 1). > > > My biggest issue with a custom query is that for my local development > > machine, I use MySQL and the production server uses MS SQL (not my > > choice). Obviously a custom query won't work when copying code between > > these two, so I wanted to try coding something like: > > > if ($database_driver == 'mssql') { > > $query = 'select....';} > > > elseif ($database_driver == 'mysql') { > > $query = 'select....'; > > > } > > > I'm open to suggestions if there's a way to avoid a custom query here, > > but if not, is there at least a good way I can determine which DB > > driver is being used so I can do something similar to the above? > > > Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---
