From e2815b4a5c5de75b0a86bef1e53b7488b87275d5 Mon Sep 17 00:00:00 2001 From: phpnut Date: Mon, 24 Oct 2005 09:54:24 +0000 Subject: [PATCH] [1192] Author: phpnut Date: 4:50:40 AM, Monday, October 24, 2005 Message: Adding comment to doc block with possible settings for the driver configuration [1191] Author: phpnut Date: 4:37:46 AM, Monday, October 24, 2005 Message: Adding configuration setting in database.php to set the type of connection you want to use. Read the comments in the doc block to explain how to set the connection type. doc block also has information on setting the port to connect to. Corrected Html::tableHeaders(); Closing Ticket #98 and Ticket #26 [1190] Author: phpnut Date: 3:25:00 AM, Monday, October 24, 2005 Message: Fix for Ticket #36 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1193 3807eeeb-6ff5-0310-8944-8be069107fe0 --- app/config/database.php.default | 41 ++++++++++++++++++---------- cake/libs/controller/scaffold.php | 2 +- cake/libs/model/dbo/dbo_mysql.php | 2 +- cake/libs/model/dbo/dbo_postgres.php | 2 +- cake/libs/model/dbo/dbo_sqlite.php | 2 +- cake/libs/view/helpers/html.php | 3 +- 6 files changed, 32 insertions(+), 20 deletions(-) diff --git a/app/config/database.php.default b/app/config/database.php.default index 0aaa75939..d65e246de 100644 --- a/app/config/database.php.default +++ b/app/config/database.php.default @@ -38,27 +38,40 @@ * @subpackage cake.config */ + /** * Database configuration class. * You can specify multiple configurations for production, development and testing. + * + * driver => + * mysql, postgres, sqlite, adodb-drivername, pear-drivername + * + * connect => + * MySQL set the connect to either mysql_pconnect of mysql_connect + * PostgreSQL set the connect to either pg_pconnect of pg_connect + * SQLite set the connect to sqlite_popen sqlite_open + * + * host => + * the host you connect to the database + * MySQL 'localhost' to add a port number use 'localhost:port#' + * PostgreSQL 'localhost' to add a port number use 'localhost port=5432' + * */ class DATABASE_CONFIG { - var $default = array( - 'driver' => 'mysql', - 'host' => 'localhost', - 'login' => 'www', - 'password' => '', - 'database' => 'project_name' - ); + var $default = array('driver' => 'mysql', + 'connect' => 'mysql_pconnect', + 'host' => 'localhost', + 'login' => 'user', + 'password' => 'password', + 'database' => 'project_name' ); - var $test = array( - 'driver' => 'mysql', - 'host' => 'localhost', - 'login' => 'www-test', - 'password' => '', - 'database' => 'project_name-test' - ); + var $test = array('driver' => 'mysql', + 'connect' => 'mysql_pconnect', + 'host' => 'localhost', + 'login' => 'user', + 'password' => 'password', + 'database' => 'project_name-test'); } ?> \ No newline at end of file diff --git a/cake/libs/controller/scaffold.php b/cake/libs/controller/scaffold.php index be47961a0..0ad8f4afb 100644 --- a/cake/libs/controller/scaffold.php +++ b/cake/libs/controller/scaffold.php @@ -387,7 +387,7 @@ class Scaffold extends Object { $this->controllerClass->params['data'][$modelKey][$field['name'].'_month'], $this->controllerClass->params['data'][$modelKey][$field['name'].'_day'], $this->controllerClass->params['data'][$modelKey][$field['name'].'_year'] ); - $newDate = date( 'Y-m-d', $newDate ); + $newDate = date( 'Y-m-d H:i:s', $newDate ); $this->controllerClass->params['data'][$modelKey][$field['name']] = $newDate; } else if( 'tinyint(1)' == $field['type'] ) diff --git a/cake/libs/model/dbo/dbo_mysql.php b/cake/libs/model/dbo/dbo_mysql.php index ed10bbe91..fe86d52d7 100644 --- a/cake/libs/model/dbo/dbo_mysql.php +++ b/cake/libs/model/dbo/dbo_mysql.php @@ -60,7 +60,7 @@ class DBO_MySQL extends DBO if ($config) { $this->config = $config; - $this->_conn = mysql_pconnect($config['host'],$config['login'],$config['password']); + $this->_conn = $config['connect']($config['host'],$config['login'],$config['password']); } $this->connected = $this->_conn? true: false; diff --git a/cake/libs/model/dbo/dbo_postgres.php b/cake/libs/model/dbo/dbo_postgres.php index 6ce38ef9f..cbcf62d60 100644 --- a/cake/libs/model/dbo/dbo_postgres.php +++ b/cake/libs/model/dbo/dbo_postgres.php @@ -59,7 +59,7 @@ class DBO_Postgres extends DBO if ($config) { $this->config = $config; - $this->_conn = pg_pconnect("host={$config['host']} dbname={$config['database']} user={$config['login']} password={$config['password']}"); + $this->_conn = $config['connect']("host={$config['host']} dbname={$config['database']} user={$config['login']} password={$config['password']}"); } $this->connected = $this->_conn? true: false; diff --git a/cake/libs/model/dbo/dbo_sqlite.php b/cake/libs/model/dbo/dbo_sqlite.php index 75fed5882..b800c9700 100644 --- a/cake/libs/model/dbo/dbo_sqlite.php +++ b/cake/libs/model/dbo/dbo_sqlite.php @@ -59,7 +59,7 @@ class DBO_SQLite extends DBO if ($config) { $this->config = $config; - $this->_conn = sqlite_open($config['file']); + $this->_conn = $config['connect']($config['file']); } $this->connected = $this->_conn? true: false; diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index 5232c609e..ae97d1b11 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -504,8 +504,7 @@ class HtmlHelper extends Helper { $out[] = sprintf($this->tags['tableheader'], $this->parseHtmlOptions($th_options), $arg); } - - return sprintf($this->tags['tableheader'], $this->parseHtmlOptions($tr_options), join(' ', $out)); + return sprintf($this->tags['tablerow'], $this->parseHtmlOptions($tr_options), join(' ', $out)); }