From cf6d284b298c9c383ab468e653f826512ba34410 Mon Sep 17 00:00:00 2001 From: phpnut Date: Tue, 1 Aug 2006 21:58:13 +0000 Subject: [PATCH] Added patch from Ticket #1229 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3350 3807eeeb-6ff5-0310-8944-8be069107fe0 --- .../model/datasources/dbo/dbo_postgres.php | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/cake/libs/model/datasources/dbo/dbo_postgres.php b/cake/libs/model/datasources/dbo/dbo_postgres.php index 538bd7d34..d7390711e 100644 --- a/cake/libs/model/datasources/dbo/dbo_postgres.php +++ b/cake/libs/model/datasources/dbo/dbo_postgres.php @@ -41,34 +41,32 @@ uses ('model' . DS . 'datasources' . DS . 'dbo_source'); * @package cake * @subpackage cake.cake.libs.model.dbo */ -class DboPostgres extends DboSource { - +class DboPostgres extends DboSource{ var $description = "PostgreSQL DBO Driver"; var $_baseConfig = array( + 'connect' => 'pg_pconnect', 'persistent' => true, 'host' => 'localhost', 'login' => 'root', 'password' => '', 'database' => 'cake', - 'port' => 5432, - 'connect' => 'pg_pconnect' + 'port' => 5432 ); - var $columns = array( - 'primary_key' => array('name' => 'serial NOT NULL'), - 'string' => array('name' => 'varchar', 'limit' => '255'), - 'text' => array('name' => 'text'), - 'integer' => array('name' => 'integer'), - 'float' => array('name' => 'float'), - 'datetime' => array('name' => 'timestamp'), - 'timestamp' => array('name' => 'timestamp'), - 'time' => array('name' => 'time'), - 'date' => array('name' => 'date'), - 'binary' => array('name' => 'bytea'), - 'boolean' => array('name' => 'boolean'), - 'number' => array('name' => 'numeric') - ); + var $columns = array('primary_key' => array('name' => 'serial NOT NULL'), + 'string' => array('name' => 'varchar', 'limit' => '255'), + 'text' => array('name' => 'text'), + 'integer' => array('name' => 'integer'), + 'float' => array('name' => 'float'), + 'datetime' => array('name' => 'timestamp'), + 'timestamp' => array('name' => 'timestamp'), + 'time' => array('name' => 'time'), + 'date' => array('name' => 'date'), + 'binary' => array('name' => 'bytea'), + 'boolean' => array('name' => 'boolean'), + 'number' => array('name' => 'numeric'), + 'inet' => array('name' => 'inet')); var $startQuote = '"'; @@ -224,6 +222,13 @@ class DboPostgres extends DboSource { } switch($column) { + case 'inet': + if (!strlen($data)){ + return 'DEFAULT'; + } else { + $data = pg_escape_string($data); + } + break; case 'integer': if ($data === '') { return 'DEFAULT'; @@ -445,6 +450,9 @@ class DboPostgres extends DboSource { if (strpos($col, 'timestamp') !== false) { return 'datetime'; } + if ($col == 'inet') { + return('inet'); + } if ($col == 'boolean') { return 'boolean'; }