Changeset 4488
- Timestamp:
- 06/08/08 17:59:34 (13 months ago)
- Location:
- branches/0.11
- Files:
-
- 3 modified
-
lib/Doctrine/Query.php (modified) (1 diff)
-
lib/Doctrine/Query/Abstract.php (modified) (2 diffs)
-
tests/Ticket/1116TestCase.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/lib/Doctrine/Query.php
r4478 r4488 288 288 } 289 289 290 /**291 * getParams292 *293 * @return array294 */295 public function getParams()296 {297 return array_merge($this->_params['join'], $this->_params['set'], $this->_params['where'], $this->_params['having']);298 }299 300 /**301 * setParams302 *303 * @param array $params304 */305 public function setParams(array $params = array()) {306 $this->_params = $params;307 }308 290 309 291 /** -
branches/0.11/lib/Doctrine/Query/Abstract.php
r4478 r4488 501 501 502 502 /** 503 * getParams 504 * 505 * @return array 506 */ 507 public function getParams($params = array()) 508 { 509 return array_merge($this->_params['join'], $this->_params['set'], $this->_params['where'], $this->_params['having'], $params); 510 } 511 512 /** 513 * setParams 514 * 515 * @param array $params 516 */ 517 public function setParams(array $params = array()) { 518 $this->_params = $params; 519 } 520 521 /** 503 522 * setView 504 523 * sets a database view this query object uses … … 968 987 } 969 988 970 $params = array_merge($this->_params['join'], 971 $this->_params['set'], 972 $this->_params['where'], 973 $this->_params['having'], 974 $params); 989 $params = $this->getParams($params); 975 990 976 991 if ($this->_resultCache && $this->_type == self::SELECT) { -
branches/0.11/tests/Ticket/1116TestCase.php
r4486 r4488 7 7 $this->dbh = new Doctrine_Adapter_Mock('mysql'); 8 8 //$this->dbh = new PDO("mysql:host=localhost;dbname=testing", 'root', 'password'); 9 9 10 10 $this->conn = Doctrine_Manager::getInstance()->openConnection($this->dbh); 11 11 $this->conn->export->exportClasses(array('Ticket_1116_User')); 12 12 } 13 14 13 15 public function testTicket() 14 16 { … … 17 19 ->from('Ticket_1116_User s') 18 20 ->where('s.username = ?', array('test')); 19 21 20 22 // to see the error switch dbh to a real db, the next line will trigger the error 21 23 $test = $q->fetchOne(); //will only fail with "real" mysql 22 $this->assertFalse($test); 23 24 $this->assertFalse($test); 25 24 26 $sql = $q->getSql(); // just getSql()?!?! and it works ? the params are ok after this call 25 $params = $q->getParams(); 26 $this->assertEqual(count($params),2); // now we have array('test',null) very strange ..... 27 27 $params = $q->getParams(); 28 $this->assertEqual(count($params), 2); // now we have array('test',null) very strange ..... 29 30 $this->assertEqual($sql, "SELECT u.id AS u__id, u.username AS u__username, u.deleted AS u__deleted FROM user u WHERE u.username = ? AND u.deleted = ?"); 31 $this->assertEqual($params, array('test', false)); 32 28 33 //now also this works! (always works witch mock only fails with mysql) 29 34 $test = $q->fetchOne(); 30 $this->assertFalse($test); 35 $this->assertFalse($test); 31 36 } 32 37 } 33 38 39 34 40 class Ticket_1116_User extends Doctrine_Record 35 41 { 36 public function setTableDefinition()42 public function setTableDefinition() 37 43 { 38 44 $this->setTableName('user'); … … 40 46 $this->hasColumn('username', 'string', 255); 41 47 } 48 49 42 50 public function setUp() 43 51 {