Thanks for clarifying your application's context, Rick. I am more used
the the kind of application where you decide to build a web-app and
then create the database schema you need. When dealing with corporate
databases I have previously either synchronized a subset of that data
to a "web database" (only data relevant to the app and none of those
important secrets they don't want to leak out) or been given an API-
access to a web-service.
I can relate to the bewildering experience starting to poke around
inside Cakes internal-classes. At first, it is certainly a bit
overwhelming and it takes a while to figure out the flow of logic. You
could certainly make your request into an enhancement ticket and see
how it is received by the core team. But as the road-map is laid out
I'd say your best hope is v2.0 which is not likely to become
production-worthy for quite some time.
It does sound like you have one or two pieces of the puzzle already.
Hopefully someone a bit closer to the core development can guide you
in the right direction. If you do not get a response here, try irc.
There is usually someone with insight into the core of Cake online
there.
/Martin
On Sep 23, 4:02 pm, Rick <[EMAIL PROTECTED]> wrote:
> Thanks for your response Martin.
>
> Maybe that was too harsh. Perhaps it was just that the developers
> never thought of an application spanning multiple databases.
>
> For a medium to large company it is common practice to seperate
> related data into different databases within the same db instance.
> (MySql uses this naming - Oracle says multiple schemas in a single
> instance.)
>
> For example customer information may be in the customer database.
> This might contain addresses, previous sale info etc.. Product info
> may be in a product database with tables for description, sales,
> etc.. In my former company we had many databases containing
> production data with each database and its' tables containing the data
> for a particular part of our production process. There were many
> occasions there where a report or view would combine data from
> multiple production areas. So we did this frequently (with raw
> queries of course).
>
> In any case it is a common enough practice for Cake to support it. It
> seems to be simply a matter of the proper construction of the table
> names before a query.
>
> I actually got the naming working somewhat (with tables in the same
> database) by commenting out a small piece code that got table
> descriptions that could not handle tables like "database.table". Once
> that was commented out the query worked fine with the model
> constructing queries like
>
> select something from 'database'.'tableA' as 'TableA,
> 'database'.'tableB' as 'TableB' ....
>
> You are correct that there may be a problem if two tables in different
> databases had the same name. Other than that I can't think of any
> reason why this wouldn't work fairly easily.
>
> I don't know how many engines support it. All that I have been
> exposed to do have it.
>
> I looked at the Model code and I really don't feel that I understand
> enough about what is going on there to make modifications or even
> suggestions. I'm sure that the developers can target the correct code
> with a minimum of effort. (I wish the code was commented a little
> more)
>
> Rick
>
> On Sep 23, 9:37 am, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > To call it an arbitrary limitation is a bit harsh.
> > Having Cake support queries and associations across multiple databases
> > would be a cool feature but I struggle to find a very good reason for
> > willingly design an application in this way. CakePHP was never
> > designes to be compatible with any and all legacy databases possible.
>
> > Can you explain why you would want to design an application in this
> > way?
>
> > You are in a great position to take a stab at extending CakePHP's
> > Model class (and probably dbo classes?) to handle this.
>
> > I can vaguely see how it might be done but you would definitely loose
> > backwards compatibility.
> > All Models would have to be prefixed with its database
> > "Data1.Table1.id" or you would probably very quickly run into naming
> > conflicts.
> > In database.php I would make the "database" value into an array
> > 'database'=>array('data1','data2')
> > Then you would have to modify the sql-generating methods to take the
> > database into account.
>
> > I have no idea how many database-engines support this? Is it supported
> > by all common SQL databases Cake has engines for?
>
> > /Martin
>
> > On Sep 23, 3:10 pm, Rick <[EMAIL PROTECTED]> wrote:
>
> > > As I said before I do NOT want to use raw queries.
>
> > > Seems like Cake is applying arbitrary limitations. Do any of the
> > > developers read these posts?
>
> > > Be nice to have an opinion from one or more cake developers.
>
> > > Rick
>
> > > On Sep 23, 3:00 am, Bookrock <[EMAIL PROTECTED]> wrote:
>
> > > > Thanks for your suggestions.
>
> > > > Raw queries for multiplae datbase is working fine $this->query("select
> > > > * from caketoodoo.tasks as t2, test.stores as t1 where t2.id =
> > > > t1.id");
>
> > > > But my database name is depends on user input. How can I set
> > > > $useDbConfig variable value.
> > > > Like I made a module Task and controller TasksController. Suppose I
> > > > get database name from URL and set $this->Task->useDbConfig =
> > > > 'multiple'; (here , multiple is datbase name) that is already
> > > > configure in datbase.php
> > > > var $multiple = array(
> > > > 'driver' => 'mysql',
> > > > 'persistent' => false,
> > > > 'host' => 'localhost',
> > > > 'login' => 'root',
> > > > 'password' => '',
> > > > 'database' => 'caketoodoo',
> > > > 'prefix' => '',
> > > > );
>
> > > > then it show error Database table tasks for model Task was not found.
> > > > because task module not getting value of useDbConfig.
>
> > > > Please tell me how can I set useDbConfig value from controller or is
> > > > there any other way to pass datbase name for module.
>
> > > > Thanks
>
> > > > On Sep 22, 9:17 pm, Rick <[EMAIL PROTECTED]> wrote:
>
> > > > > Anotherdatabasereally isn't an option as I said this is an existing
> > > > > MySql instance.
>
> > > > > Yeah, I could do raw queries but I wanted to taste the cakey goodness.
>
> > > > > Rick
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---