Changeset 5327
- Timestamp:
- 12/31/08 20:29:51 (6 months ago)
- Location:
- branches/1.1
- Files:
-
- 1 added
- 3 modified
-
lib/Doctrine/Query/Where.php (modified) (2 diffs)
-
tests/models/QueryTest_Subscription.php (added)
-
tests/models/QueryTest_User.php (modified) (2 diffs)
-
tests/QueryTestCase.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.1/lib/Doctrine/Query/Where.php
r5265 r5327 80 80 81 81 $sql = $this->_buildSql($leftExpr, $operator, $rightExpr); 82 82 83 83 84 //echo '<pre>Built SQL: '.$sql.'</pre>'; … … 92 93 protected function _buildSql($leftExpr, $operator, $rightExpr) 93 94 { 94 // Left Expression95 95 96 $leftExpr = $this->query->parseClause($leftExpr); 96 97 98 // BETWEEN operation 99 if ('BETWEEN' == strtoupper(substr($operator, 0, 7))) { 100 $midExpr = trim(substr($operator, 7, -3)); 101 $operator = 'BETWEEN ' . $this->query->parseClause($midExpr) . ' AND'; 102 } 103 97 104 $op = strtolower($operator); 98 105 -
branches/1.1/tests/models/QueryTest_User.php
r4857 r5327 8 8 array('notnull')); 9 9 $this->hasColumn('visibleRankId', 'integer', 4); 10 $this->hasColumn('subscriptionId', 'integer', 4); 10 11 } 11 12 … … 18 19 'local' => 'visibleRankId', 'foreign' => 'id' 19 20 )); 21 22 $this->hasOne('QueryTest_Subscription', array( 23 'local' => 'subscriptionId', 'foreign' => 'id' 24 )); 20 25 21 26 $this->hasMany('QueryTest_Rank as ranks', array( -
branches/1.1/tests/QueryTestCase.php
r5014 r5327 33 33 class Doctrine_Query_TestCase extends Doctrine_UnitTestCase 34 34 { 35 35 36 36 public function testWhereInSupportInDql() 37 37 { … … 301 301 $q2->free(); 302 302 } 303 304 public function testParseTableAliasesWithBetweenInWhereClause() 305 { 306 307 $q1 = Doctrine_Query::create() 308 ->select('u.id') 309 ->from('QueryTest_User u') 310 ->where("CURRENT_DATE() BETWEEN u.QueryTest_Subscription.begin AND u.QueryTest_Subscription.begin") 311 ->addWhere( 'u.id != 5' ) 312 ; 313 314 $expected = 'SELECT q.id AS q__id FROM query_test__user q LEFT JOIN query_test__subscription q2 ON q.subscriptionid = q2.id WHERE CURRENT_DATE() BETWEEN q2.begin AND q2.begin AND q.id != 5'; 315 316 $this->assertEqual( $q1->getSql(), $expected ); 317 318 } 303 319 } 304 320