diff options
23 files changed, 585 insertions, 1 deletions
diff --git a/.gitattributes b/.gitattributes index ca665df6..1540fabf 100644 --- a/.gitattributes +++ b/.gitattributes @@ -883,6 +883,23 @@ demos/helloworld/index.php -text  demos/helloworld/protected/.htaccess -text  demos/helloworld/protected/pages/Home.page -text  demos/helloworld/protected/pages/Home.php -text +demos/northwind-db/index.php -text +demos/northwind-db/protected/.htaccess -text +demos/northwind-db/protected/application.xml -text +demos/northwind-db/protected/data/Northwind.db -text +demos/northwind-db/protected/database/Category.php -text +demos/northwind-db/protected/database/Customer.php -text +demos/northwind-db/protected/database/Employee.php -text +demos/northwind-db/protected/database/Order.php -text +demos/northwind-db/protected/database/OrderDetail.php -text +demos/northwind-db/protected/database/Product.php -text +demos/northwind-db/protected/database/Region.php -text +demos/northwind-db/protected/database/Shipper.php -text +demos/northwind-db/protected/database/Supplier.php -text +demos/northwind-db/protected/database/Territory.php -text +demos/northwind-db/protected/pages/Home.page -text +demos/northwind-db/protected/pages/Home.php -text +demos/northwind-db/protected/pages/northwind.gif -text  demos/personal/index.php -text  demos/personal/protected/.htaccess -text  demos/personal/protected/Common/LoginPortlet.php -text @@ -1644,9 +1661,11 @@ framework/Data/Common/Mssql/TMssqlCommandBuilder.php -text  framework/Data/Common/Mssql/TMssqlMetaData.php -text  framework/Data/Common/Mssql/TMssqlTableColumn.php -text  framework/Data/Common/Mssql/TMssqlTableInfo.php -text +framework/Data/Common/Mysql/TMysqlCommandBuilder.php -text  framework/Data/Common/Mysql/TMysqlMetaData.php -text  framework/Data/Common/Mysql/TMysqlTableColumn.php -text  framework/Data/Common/Mysql/TMysqlTableInfo.php -text +framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php -text  framework/Data/Common/Pgsql/TPgsqlMetaData.php -text  framework/Data/Common/Pgsql/TPgsqlTableColumn.php -text  framework/Data/Common/Pgsql/TPgsqlTableInfo.php -text diff --git a/demos/northwind-db/index.php b/demos/northwind-db/index.php new file mode 100644 index 00000000..94e60d49 --- /dev/null +++ b/demos/northwind-db/index.php @@ -0,0 +1,28 @@ +<?php
 +
 +$basePath=dirname(__FILE__);
 +$frameworkPath=$basePath.'/../../framework/prado.php';
 +$assetsPath=$basePath.'/assets';
 +$runtimePath=$basePath.'/protected/runtime';
 +
 +if(!is_file($frameworkPath))
 +	die("Unable to find prado framework path $frameworkPath.");
 +if(!is_writable($assetsPath))
 +	die("Please make sure that the directory $assetsPath is writable by Web server process.");
 +if(!is_writable($runtimePath))
 +	die("Please make sure that the directory $runtimePath is writable by Web server process.");
 +
 +/** SQLite Northwind database file **/
 +$sqlite_dir = $basePath.'/protected/data';
 +$sqlite_db = $sqlite_dir.'/Northwind.db';
 +if(!is_writable($sqlite_dir))
 +	die("Please make sure that the directory $sqlite_dir is writable by Web server process.");
 +if(!is_writable($sqlite_db))
 +	die("Please make sure that the sqlite database file $sqlite_db is writable by Web server process.");
 +
 +require_once($frameworkPath);
 +
 +$application=new TApplication;
 +$application->run();
 +
 +?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/.htaccess b/demos/northwind-db/protected/.htaccess new file mode 100644 index 00000000..3418e55a --- /dev/null +++ b/demos/northwind-db/protected/.htaccess @@ -0,0 +1 @@ +deny from all
\ No newline at end of file diff --git a/demos/northwind-db/protected/application.xml b/demos/northwind-db/protected/application.xml new file mode 100644 index 00000000..3ac9c67c --- /dev/null +++ b/demos/northwind-db/protected/application.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?>
 +
 +<application id="northwind-db" mode="Debug">
 +  <!-- alias definitions and namespace usings -->
 +  <paths>
 +	<using namespace="System.Data.*" />
 +	<using namespace="System.Data.ActiveRecord.*" />
 +	<using namespace="System.Data.ActiveRecord.Scaffold.*" />
 +	<using namespace="Application.database.*" />
 +  </paths>
 +
 +  <modules>
 +	<module class="TActiveRecordConfig">
 +		<!-- db file is relative to the index.php -->
 +		<database ConnectionString="sqlite:protected/data/Northwind.db" />	
 +	</module>
 +	<module class="System.I18N.TGlobalization" DefaultCharset="UTF-8" />
 +  </modules>
 +
 +</application>
\ No newline at end of file diff --git a/demos/northwind-db/protected/data/Northwind.db b/demos/northwind-db/protected/data/Northwind.db Binary files differnew file mode 100644 index 00000000..9d6b08b4 --- /dev/null +++ b/demos/northwind-db/protected/data/Northwind.db diff --git a/demos/northwind-db/protected/database/Category.php b/demos/northwind-db/protected/database/Category.php new file mode 100644 index 00000000..05fa7ed0 --- /dev/null +++ b/demos/northwind-db/protected/database/Category.php @@ -0,0 +1,26 @@ +<?php
 +/**
 + * Auto generated by prado-cli.php on 2007-05-01 05:24:53.
 + */
 +class Category extends TActiveRecord
 +{
 +	const TABLE='Categories';
 +
 +	public $CategoryID;
 +	public $CategoryName;
 +	public $Description;
 +	public $Picture;
 +
 +	public $Products=array();
 +
 +	protected static $RELATIONS=array
 +	(
 +		'Products' => array(self::HAS_MANY, 'Product'),
 +	);
 +
 +	public static function finder($className=__CLASS__)
 +	{
 +		return parent::finder($className);
 +	}
 +}
 +?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Customer.php b/demos/northwind-db/protected/database/Customer.php new file mode 100644 index 00000000..356dd02f --- /dev/null +++ b/demos/northwind-db/protected/database/Customer.php @@ -0,0 +1,33 @@ +<?php
 +/**
 + * Auto generated by prado-cli.php on 2007-05-01 05:28:47.
 + */
 +class Customer extends TActiveRecord
 +{
 +	const TABLE='Customers';
 +
 +	public $CustomerID;
 +	public $CompanyName;
 +	public $ContactName;
 +	public $ContactTitle;
 +	public $Address;
 +	public $City;
 +	public $Region;
 +	public $PostalCode;
 +	public $Country;
 +	public $Phone;
 +	public $Fax;
 +
 +	public $Orders=array();
 +
 +	protected static $RELATIONS = array
 +	(
 +		'Orders' => array(self::HAS_MANY, 'Order'),
 +	);
 +
 +	public static function finder($className=__CLASS__)
 +	{
 +		return parent::finder($className);
 +	}
 +}
 +?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Employee.php b/demos/northwind-db/protected/database/Employee.php new file mode 100644 index 00000000..7a678f57 --- /dev/null +++ b/demos/northwind-db/protected/database/Employee.php @@ -0,0 +1,48 @@ +<?php
 +/**
 + * Auto generated by prado-cli.php on 2007-05-01 05:29:32.
 + */
 +class Employee extends TActiveRecord
 +{
 +	const TABLE='Employees';
 +
 +	public $EmployeeID;
 +	public $LastName;
 +	public $FirstName;
 +	public $Title;
 +	public $TitleOfCourtesy;
 +	public $BirthDate;
 +	public $HireDate;
 +	public $Address;
 +	public $City;
 +	public $Region;
 +	public $PostalCode;
 +	public $Country;
 +	public $HomePhone;
 +	public $Extension;
 +	public $Photo;
 +	public $Notes;
 +	public $ReportsTo;
 +	public $PhotoPath;
 +
 +	public $Territories=array();
 +	public $Orders=array();
 +	public $Subordinates=array();
 +	public $Superior;
 +
 +	protected static $RELATIONS = array
 +	(
 +		'Territories' => array(self::HAS_MANY, 'Territory', 'EmployeeTerritories'),
 +		'Orders' => array(self::HAS_MANY, 'Order'),
 +
 +		//parent children relationship
 +		'Subordinates' => array(self::HAS_MANY, 'Employee'),
 +		'Superior' => array(self::BELONGS_TO, 'Employee')
 +	);
 +
 +	public static function finder($className=__CLASS__)
 +	{
 +		return parent::finder($className);
 +	}
 +}
 +?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Order.php b/demos/northwind-db/protected/database/Order.php new file mode 100644 index 00000000..fa865e61 --- /dev/null +++ b/demos/northwind-db/protected/database/Order.php @@ -0,0 +1,42 @@ +<?php
 +/**
 + * Auto generated by prado-cli.php on 2007-05-01 05:29:47.
 + */
 +class Order extends TActiveRecord
 +{
 +	const TABLE='Orders';
 +
 +	public $OrderID;
 +	public $CustomerID;
 +	public $EmployeeID;
 +	public $OrderDate;
 +	public $RequiredDate;
 +	public $ShippedDate;
 +	public $ShipVia;
 +	public $Freight;
 +	public $ShipName;
 +	public $ShipAddress;
 +	public $ShipCity;
 +	public $ShipRegion;
 +	public $ShipPostalCode;
 +	public $ShipCountry;
 +
 +	public $OrderDetails=array();
 +	public $Customer;
 +	public $Shipper;
 +	public $Employee;
 +
 +	protected static $RELATIONS = array
 +	(
 +		'OrderDetails' => array(self::HAS_MANY, 'OrderDetail'),
 +		'Customer' => array(self::BELONGS_TO, 'Customer'),
 +		'Shipper' => array(self::BELONGS_TO, 'Shipper'),
 +		'Employee' => array(self::BELONGS_TO, 'Employee'),
 +	);
 +
 +	public static function finder($className=__CLASS__)
 +	{
 +		return parent::finder($className);
 +	}
 +}
 +?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/OrderDetail.php b/demos/northwind-db/protected/database/OrderDetail.php new file mode 100644 index 00000000..9415e33e --- /dev/null +++ b/demos/northwind-db/protected/database/OrderDetail.php @@ -0,0 +1,27 @@ +<?php
 +
 +class OrderDetail extends TActiveRecord
 +{
 +	const TABLE='Order Details';
 +
 +	public $OrderID;
 +	public $ProductID;
 +	public $UnitPrice;
 +	public $Quantity;
 +	public $Discount;
 +
 +	public $Product;
 +	public $Order;
 +
 +	protected static $RELATIONS = array
 +	(
 +		'Product' => array(self::BELONGS_TO, 'Product'),
 +		'Order' => array(self::BELONGS_TO, 'Order'),
 +	);
 +
 +	public static function finder($className=__CLASS__)
 +	{
 +		return parent::finder($className);
 +	}
 +}
 +?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Product.php b/demos/northwind-db/protected/database/Product.php new file mode 100644 index 00000000..75d01c02 --- /dev/null +++ b/demos/northwind-db/protected/database/Product.php @@ -0,0 +1,36 @@ +<?php
 +/**
 + * Auto generated by prado-cli.php on 2007-05-01 05:31:51.
 + */
 +class Product extends TActiveRecord
 +{
 +	const TABLE='Products';
 +
 +	public $ProductID;
 +	public $ProductName;
 +	public $SupplierID;
 +	public $CategoryID;
 +	public $QuantityPerUnit;
 +	public $UnitPrice;
 +	public $UnitsInStock;
 +	public $UnitsOnOrder;
 +	public $ReorderLevel;
 +	public $Discontinued;
 +
 +	public $Supplier;
 +	public $Category;
 +	public $OrderDetails=array();
 +
 +	protected static $RELATIONS = array
 +	(
 +		'Supplier' => array(self::BELONGS_TO, 'Supplier'),
 +		'Category' => array(self::BELONGS_TO, 'Category'),
 +		'OrderDetails' => array(self::HAS_MANY, 'OrderDetail'),
 +	);
 +
 +	public static function finder($className=__CLASS__)
 +	{
 +		return parent::finder($className);
 +	}
 +}
 +?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Region.php b/demos/northwind-db/protected/database/Region.php new file mode 100644 index 00000000..2afa3501 --- /dev/null +++ b/demos/northwind-db/protected/database/Region.php @@ -0,0 +1,24 @@ +<?php
 +/**
 + * Auto generated by prado-cli.php on 2007-05-01 05:32:34.
 + */
 +class Region extends TActiveRecord
 +{
 +	const TABLE='Region';
 +
 +	public $RegionID;
 +	public $RegionDescription;
 +
 +	public $Territories=array();
 +
 +	protected static $RELATIONS = array
 +	(
 +		'Territories' => array(self::HAS_MANY, 'Territory')
 +	);
 +
 +	public static function finder($className=__CLASS__)
 +	{
 +		return parent::finder($className);
 +	}
 +}
 +?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Shipper.php b/demos/northwind-db/protected/database/Shipper.php new file mode 100644 index 00000000..6ac8a929 --- /dev/null +++ b/demos/northwind-db/protected/database/Shipper.php @@ -0,0 +1,25 @@ +<?php
 +/**
 + * Auto generated by prado-cli.php on 2007-05-01 05:32:57.
 + */
 +class Shipper extends TActiveRecord
 +{
 +	const TABLE='Shippers';
 +
 +	public $ShipperID;
 +	public $CompanyName;
 +	public $Phone;
 +
 +	public $Orders = array();
 +
 +	protected static $RELATIONS = array
 +	(
 +		'Orders' => array(self::HAS_MANY, 'Order'),
 +	);
 +
 +	public static function finder($className=__CLASS__)
 +	{
 +		return parent::finder($className);
 +	}
 +}
 +?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Supplier.php b/demos/northwind-db/protected/database/Supplier.php new file mode 100644 index 00000000..537daade --- /dev/null +++ b/demos/northwind-db/protected/database/Supplier.php @@ -0,0 +1,34 @@ +<?php
 +/**
 + * Auto generated by prado-cli.php on 2007-05-01 05:33:08.
 + */
 +class Supplier extends TActiveRecord
 +{
 +	const TABLE='Suppliers';
 +
 +	public $SupplierID;
 +	public $CompanyName;
 +	public $ContactName;
 +	public $ContactTitle;
 +	public $Address;
 +	public $City;
 +	public $Region;
 +	public $PostalCode;
 +	public $Country;
 +	public $Phone;
 +	public $Fax;
 +	public $HomePage;
 +
 +	public $Products=array();
 +
 +	protected static $RELATIONS=array
 +	(
 +		'Products' => array(self::HAS_MANY, 'Product')
 +	);
 +
 +	public static function finder($className=__CLASS__)
 +	{
 +		return parent::finder($className);
 +	}
 +}
 +?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Territory.php b/demos/northwind-db/protected/database/Territory.php new file mode 100644 index 00000000..4da0ff46 --- /dev/null +++ b/demos/northwind-db/protected/database/Territory.php @@ -0,0 +1,60 @@ +<?php
 +/**
 + * Auto generated by prado-cli.php on 2007-05-01 05:33:28.
 + */
 +class Territory extends TActiveRecord
 +{
 +	const TABLE='Territories';
 +
 +	public $TerritoryID;
 +	public $TerritoryDescription;
 +	public $RegionID;
 +
 +	private $_region;
 +	private $_employees;
 +
 +	protected static $RELATIONS = array
 +	(
 +		'Region' => array(self::BELONGS_TO, 'Region'),
 +		'Employees' => array(self::HAS_MANY, 'Employee', 'EmployeeTerritories')
 +	);
 +
 +	/**
 +	 * @return Region
 +	 */
 +	public function getRegion()
 +	{
 +		//lazy load the region
 +		if($this->_region===null)
 +			$this->_region = Region::finder()->findByPk($this->RegionID);
 +		return $this->_region;
 +	}
 +
 +	public function setRegion($value)
 +	{
 +		$this->_region=$value;
 +	}
 +
 +	/**
 +	 * @return Employee[]
 +	 */
 +	public function getEmployees()
 +	{
 +		//lazy load
 +		if($this->_employees==null)
 +			$this->setEmployees($this->withEmployees()->findByPk($this->TerritoryID)->getEmployees());
 +		return $this->_employees;
 +	}
 +
 +	public function setEmployees($value)
 +	{
 +		//ensure TList
 +		$this->_employees = $value instanceof TList ? $value : new TList($value);
 +	}
 +
 +	public static function finder($className=__CLASS__)
 +	{
 +		return parent::finder($className);
 +	}
 +}
 +?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/pages/Home.page b/demos/northwind-db/protected/pages/Home.page new file mode 100644 index 00000000..e2c3668e --- /dev/null +++ b/demos/northwind-db/protected/pages/Home.page @@ -0,0 +1,12 @@ +<html>
 +<com:THead Title="Welcome to Prado" />
 +<body>
 +<h1>Welcome to PRADO!</h1>
 +<com:TForm>
 +	
 +	<com:TDropDownList ID="class_list" AutoPostBack="true"/>
 +	<com:TScaffoldView ID="scaffold1" RecordClass="<%= $this->class_list->selectedItem->Text %>" />
 +
 +</com:TForm>
 +</body>
 +</html>
\ No newline at end of file diff --git a/demos/northwind-db/protected/pages/Home.php b/demos/northwind-db/protected/pages/Home.php new file mode 100644 index 00000000..06035069 --- /dev/null +++ b/demos/northwind-db/protected/pages/Home.php @@ -0,0 +1,28 @@ +<?php
 +
 +class Home extends TPage
 +{
 +	function onInit($param)
 +	{
 +		$classes = $this->getRecordClassList(Prado::getPathOfNamespace('Application.database.*'));
 +		$this->class_list->dataSource = $classes;
 +		$this->class_list->dataBind();
 +	}
 +
 +	protected function getRecordClassList($directory)
 +	{
 +		$list=array();
 +		$folder=@opendir($directory);
 +		while($entry=@readdir($folder))
 +		{
 +			if($entry[0]==='.')
 +				continue;
 +			else if(is_file($directory.'/'.$entry))
 +				$list[] = str_replace('.php', '', $entry);
 +		}
 +		closedir($folder);
 +		return $list;
 +	}
 +}
 +
 +?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/pages/northwind.gif b/demos/northwind-db/protected/pages/northwind.gif Binary files differnew file mode 100644 index 00000000..34e1f2ed --- /dev/null +++ b/demos/northwind-db/protected/pages/northwind.gif diff --git a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TMssqlScaffoldInput.php b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TMssqlScaffoldInput.php index 840e5b63..2f06368e 100644 --- a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TMssqlScaffoldInput.php +++ b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TMssqlScaffoldInput.php @@ -35,7 +35,11 @@ class TMssqlScaffoldInput extends TScaffoldInputCommon  			case 'datetime': case 'smalldatetime':
  				return $this->getDateTimeValue($container,$column, $record);
  			default:
 -				return $this->getDefaultControlValue($container,$column, $record);
 +				$value = $this->getDefaultControlValue($container,$column, $record);
 +				if(trim($value)==='' && $column->getAllowNull())
 +					return null;
 +				else
 +					return $value;
  		}
  	}
  }
 diff --git a/framework/Data/Common/Mysql/TMysqlCommandBuilder.php b/framework/Data/Common/Mysql/TMysqlCommandBuilder.php new file mode 100644 index 00000000..9fd02d32 --- /dev/null +++ b/framework/Data/Common/Mysql/TMysqlCommandBuilder.php @@ -0,0 +1,27 @@ +<?php
 +/**
 + * TMysqlCommandBuilder class file.
 + *
 + * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
 + * @link http://www.pradosoft.com/
 + * @copyright Copyright © 2005-2007 PradoSoft
 + * @license http://www.pradosoft.com/license/
 + * @version $Id: TDbCommandBuilder.php 1863 2007-04-12 12:43:49Z wei $
 + * @package System.Data.Common
 + */
 +
 +Prado::using('System.Data.Common.TDbCommandBuilder');
 +
 +/**
 + * TMysqlCommandBuilder implements default TDbCommandBuilder
 + *
 + * @author Wei Zhuo <weizho[at]gmail[dot]com>
 + * @version $Id: TDbCommandBuilder.php 1863 2007-04-12 12:43:49Z wei $
 + * @package System.Data.Common
 + * @since 3.1
 + */
 +class TMysqlCommandBuilder extends TDbCommandBuilder
 +{
 +}
 +
 +?>
\ No newline at end of file diff --git a/framework/Data/Common/Mysql/TMysqlTableInfo.php b/framework/Data/Common/Mysql/TMysqlTableInfo.php index 9bc01717..3584bb3b 100644 --- a/framework/Data/Common/Mysql/TMysqlTableInfo.php +++ b/framework/Data/Common/Mysql/TMysqlTableInfo.php @@ -44,6 +44,16 @@ class TMysqlTableInfo extends TDbTableInfo  		else
  			return '`'.$this->getTableName().'`';
  	}
 +
 +	/**
 +	 * @param TDbConnection database connection.
 +	 * @return TDbCommandBuilder new command builder
 +	 */
 +	public function createCommandBuilder($connection)
 +	{
 +		Prado::using('System.Data.Common.Mysql.TMysqlCommandBuilder');
 +		return new TMysqlCommandBuilder($connection,$this);
 +	}
  }
  ?>
\ No newline at end of file diff --git a/framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php b/framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php new file mode 100644 index 00000000..9a818ab9 --- /dev/null +++ b/framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php @@ -0,0 +1,70 @@ +<?php
 +/**
 + * TPgsqlCommandBuilder class file.
 + *
 + * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
 + * @link http://www.pradosoft.com/
 + * @copyright Copyright © 2005-2007 PradoSoft
 + * @license http://www.pradosoft.com/license/
 + * @version $Id: TDbCommandBuilder.php 1863 2007-04-12 12:43:49Z wei $
 + * @package System.Data.Common
 + */
 +
 +Prado::using('System.Data.Common.TDbCommandBuilder');
 +
 +/**
 + * TPgsqlCommandBuilder provides specifics methods to create limit/offset query commands
 + * for Pgsql database.
 + *
 + * @author Wei Zhuo <weizho[at]gmail[dot]com>
 + * @version $Id: TDbCommandBuilder.php 1863 2007-04-12 12:43:49Z wei $
 + * @package System.Data.Common
 + * @since 3.1
 + */
 +class TPgsqlCommandBuilder extends TDbCommandBuilder
 +{
 +	/**
 +	 * Overrides parent implementation. Only column of type text or character (and its variants)
 +	 * accepts the LIKE criteria.
 +	 * @param array list of column id for potential search condition.
 +	 * @param string string of keywords
 +	 * @return string SQL search condition matching on a set of columns.
 +	 */
 +	public function getSearchExpression($fields, $keywords)
 +	{
 +		$columns = array();
 +		foreach($fields as $field)
 +		{
 +			if($this->isSearchableColumn($this->getTableInfo()->getColumn($field)))
 +				$columns[] = $field;
 +		}
 +		return parent::getSearchExpression($columns, $keywords);
 +	}
 +	/**
 +	 *
 +	 * @return boolean true if column can be used for LIKE searching.
 +	 */
 +	protected function isSearchableColumn($column)
 +	{
 +		$type = strtolower($column->getDbType());
 +		return $type === 'character varying' || $type === 'varchar' ||
 +				$type === 'character' || $type === 'char' || $type === 'text';
 +	}
 +
 +	/**
 +	 * Overrides parent implementation to use PostgreSQL's ILIKE instead of LIKE (case-sensitive).
 +	 * @param string column name.
 +	 * @param array keywords
 +	 * @return string search condition for all words in one column.
 +	 */
 +	protected function getSearchCondition($column, $words)
 +	{
 +		$conditions=array();
 +		foreach($words as $word)
 +			$conditions[] = $column.' ILIKE '.$this->getDbConnection()->quoteString('%'.$word.'%');
 +		return '('.implode(' AND ', $conditions).')';
 +	}
 +
 +}
 +
 +?>
\ No newline at end of file diff --git a/framework/Data/Common/Pgsql/TPgsqlTableInfo.php b/framework/Data/Common/Pgsql/TPgsqlTableInfo.php index a2670fe0..c25fbdf4 100644 --- a/framework/Data/Common/Pgsql/TPgsqlTableInfo.php +++ b/framework/Data/Common/Pgsql/TPgsqlTableInfo.php @@ -44,6 +44,16 @@ class TPgsqlTableInfo extends TDbTableInfo  		else
  			$this->getTableName();
  	}
 +
 +	/**
 +	 * @param TDbConnection database connection.
 +	 * @return TDbCommandBuilder new command builder
 +	 */
 +	public function createCommandBuilder($connection)
 +	{
 +		Prado::using('System.Data.Common.Pgsql.TPgsqlCommandBuilder');
 +		return new TPgsqlCommandBuilder($connection,$this);
 +	}
  }
  ?>
\ No newline at end of file  | 
