Thursday, December 23, 2010

A Deeper Insights to Database Config Settings

class DATABASE_CONFIG {

var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'blog',
'prefix' => '',
);

var $test = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'test_database_name',
'prefix' => '',
);
}

-------------------------------------------------
Dear veterans,

Above is a sample database configuration. Can we set it to connect to
more than a database ? Is it fixed to only one ? What I learned is
Cake uses the default array by the name; whatever setting inside, var
$default = array();

What's the second array for?, var $test = array(); ? I accidentally
entered some wrong setting for this second array and it doesn't affect
the $default performance. Explanation ?

If I want to test many tutorials' codes, I would not be able to change
the default setting to another database, hence creating another table,
e.g. Members, instead of Users if I already have Users table in the
existing database which my Cake's default config is pointing to.
Therefore, the Controller, Model, and View would all have to be
different, by the file named, e.g., controllers
\members_controller.php, models\member.php, views\members\index.ctp

Is this how we test codes? because it may flood the MVC with many
names that may not be reflective, e.g. what if I am testing the 3rd
code by the table name Users as well ? and the 4th code with same
table's name.. and so on..?

How do we usually go about this, suggested way?

Thanks in advance.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate