Skip to content
Permalink
Browse files

Postgres datasource support regular expression operators.

  • Loading branch information...
nojimage committed Feb 22, 2013
1 parent 9f25da4 commit 84725993e56b184e40e808eaffadfa3bc934b85c
@@ -94,6 +94,13 @@ class Postgres extends DboSource {
*/
protected $_sequenceMap = array();
/**
* The set of valid SQL operations usable in a WHERE statement
*
* @var array
*/
protected $_sqlOps = array('like', 'ilike', 'or', 'not', 'in', 'between', '~', '~*', '!~', '!~*', 'similar to');
/**
* Connects to the database using options in the given configuration array.
*
@@ -486,6 +486,18 @@ public function testBinaryDataIntegrity() {
$this->assertEquals($data, $result['BinaryTest']['data']);
}
/**
* Tests passing PostgreSQL regular expression operators when building queries
*
* @return void
*/
public function testRegexpOperatorConditionsParsing() {
$this->assertSame(' WHERE "name" ~ \'[a-z_]+\'', $this->Dbo->conditions(array('name ~' => '[a-z_]+')));
$this->assertSame(' WHERE "name" ~* \'[a-z_]+\'', $this->Dbo->conditions(array('name ~*' => '[a-z_]+')));
$this->assertSame(' WHERE "name" !~ \'[a-z_]+\'', $this->Dbo->conditions(array('name !~' => '[a-z_]+')));
$this->assertSame(' WHERE "name" !~* \'[a-z_]+\'', $this->Dbo->conditions(array('name !~*' => '[a-z_]+')));
}
/**
* Tests the syntax of generated schema indexes
*

0 comments on commit 8472599

Please sign in to comment.
You can’t perform that action at this time.