Skip to content

Commit

Permalink
Fixed the bug that CDbCommand::setFetchMode wasn't accepting addition…
Browse files Browse the repository at this point in the history
…al arguments needed for PDO::FETCH_CLASS (reverse-merged from commit d0154ef)
  • Loading branch information
samdark committed Oct 20, 2012
1 parent d0154ef commit 425284b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
1 change: 0 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Version 1.1.13 work in progress
- Bug #1499: Fixed CVarDumper highlighting "\" (antoncpu)
- Bug #1552: Fixed potential vulnerability in CJavaScript::encode(): $safe parameter didn't used to be passed to the recursive method calls (resurtm)
- Bug: Table schema is refreshed on Gii model generation when schemaCachingDuration is used (SonkoDmitry)
- Bug: CDbCommand::setFetchMode wasn't accepting additional arguments needed for PDO::FETCH_CLASS (samdark)
- Enh #84: Log route categories are now accepted in form of array. Added CLogRoute::except and parameter to CLogRoute::getLogs that allows you to exclude specific categories (paystey)
- Enh #104: Added CWebLogRoute::$collapsedInFireBug property to control whether the log should be collapsed by default in Firebug (marcovtwout)
- Enh #117: Added CPhpMessageSource::$extensionPaths to allow extensions, that do not have a base class to use as category prefix, to register message source (rcoelho, cebe)
Expand Down
3 changes: 1 addition & 2 deletions framework/db/CDbCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,7 @@ private function queryInternal($method,$mode,$params=array())
else
{
$mode=(array)$mode;
call_user_func_array(array($this->_statement, 'setFetchMode'), $mode);
$result=$this->_statement->$method();
$result=call_user_func_array(array($this->_statement, $method), $mode);
$this->_statement->closeCursor();
}

Expand Down
10 changes: 1 addition & 9 deletions tests/framework/db/CDbCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,5 @@ public function testFetchMode(){
$command->setFetchMode(PDO::FETCH_OBJ);
$result = $command->queryRow();
$this->assertTrue(is_object($result));

$sql='SELECT * FROM posts';
$command=$this->_connection->createCommand($sql);
$command->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'TestClass');
$result = $command->queryRow();
$this->assertTrue($result instanceof TestClass);
}
}

class TestClass {}
}

0 comments on commit 425284b

Please sign in to comment.