Merging fixes and enhancements into trunk

Revision: [1914]
Adding prefix setting to the database config class.
Setting the value here will use the prefix for all models.


git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1915 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-02-03 04:45:08 +00:00
parent d09a48d882
commit 50a71fa777
5 changed files with 17 additions and 4 deletions

View file

@ -6,4 +6,4 @@
// +---------------------------------------------------------------------------------------------------+ //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
0.10.8.1913 RC 4
0.10.8.1915 RC 4

View file

@ -64,14 +64,16 @@ class DATABASE_CONFIG
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'project_name' );
'database' => 'project_name',
'prefix' => '');
var $test = array('driver' => 'mysql',
'connect' => 'mysql_pconnect',
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'project_name-test');
'database' => 'project_name-test',
'prefix' => '');
}
?>

View file

@ -238,7 +238,7 @@ function loadController ($name)
}
if($name === null)
{
return;
return true;
}
if(!class_exists($name.'Controller'))
{

View file

@ -1384,6 +1384,12 @@ class Model extends Object
$dataSource = $this->useDbConfig;
}
$this->db =& ConnectionManager::getDataSource($dataSource);
if(!empty($this->db->config['prefix']))
{
$this->tablePrefix = $this->db->config['prefix'];
}
if(empty($this->db) || $this->db == null || !is_object($this->db))
{
return $this->cakeError('missingConnection',array(array('className' => $this->name)));

View file

@ -1387,6 +1387,11 @@ class Model extends Object
$dataSource = $this->useDbConfig;
}
$this->db =& ConnectionManager::getDataSource($dataSource);
if(!empty($this->db->config['prefix']))
{
$this->tablePrefix = $this->db->config['prefix'];
}
if(empty($this->db) || $this->db == null || !is_object($this->db))
{
return $this->cakeError('missingConnection',array(array('className' => $this->name)));