and again make sure you are not using a persistant db connection On 5/30/07, francky06l <[EMAIL PROTECTED]> wrote: > > > You could setup different database into the config.php, and set the > $useDbConfig to point to the desired database into the model. After > login, if all models are use the same DB you can put this into the > app_model.php. > > On May 30, 11:07 am, davo <[EMAIL PROTECTED]> wrote: > > Hi Guys, > > > > We're trying to introduce cake into an existing php app, with the aim > > of gradually porting the old legacy spaghetti code into cake. We have > > to add some new features so this seems like a good time to start > > migrating. > > > > A bit of background - the application has a single 'master' database > > that holds login and profile information. Each user belongs to a > > 'profile' (basically a customer) with their own database, so after the > > initial login they use their own separate database for customer- > > specific data like crm, stats etc. So for example, if i am customer_x, > > i might login using a master database called 'my_app', then after i'm > > logged in use a database called 'my_app_customer_x'. I will still use > > the master 'my_app' database for some things, such as user > > administration etc. > > > > The problem I'm running into is this - depending on the user's > > 'profile' the model needs to use a different database. I can get the > > name of the database i want inside the model, but i can't figure out > > how to use it. > > > > I have overcome a similar problem before with rails by setting the > > table_prefix in the model to the database name (yes very hacky!), so > > for a 'daily_stats' model for 'customer_x', the model name is set to > > 'my_app_customer_x.daily_stats' at runtime, which works fine with > > mysql. > > > > This hack doesn't work at all in cake because the model keeps a list > > of it's tables (in $db->listSources() i think), and i am banging my > > head against the wall trying to think of a clean way to do this. I > > don't care about any DB except MySQL if that makes any difference. > > We'd like to avoid doing a separate mysql connection per request if > > possible, because we tried that before with rails and it brought the > > DB server down pretty quickly under load. > > > > I hope you guys & gals can follow what i'm getting at - any & all help > > would be greatly appreciated! > > > > thanks > > > > dave > > > > >
-- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
