add SelectHandle in Db service

This commit is contained in:
Jianxuan Li 2015-03-21 11:15:44 +08:00
parent 5c8e3d8ccb
commit 2199a26b83
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,24 @@
<?php
/**
* Created by PhpStorm.
* User: liujin834
* Date: 3/8/15
* Time: 2:29 PM
*/
namespace Westdc\Db\Record;
use Zend\Db\Sql;
use Westdc\Db\Db;
class Select {
public function ResultSetToArray(Sql\Select $select){
$adapter = Db::getInstance();
$result = $adapter->query($select->getSqlString($adapter->getPlatform()),$adapter::QUERY_MODE_EXECUTE);
return $result->toArray();
}
}

View File

@ -32,6 +32,11 @@ class Db {
return new WestdcDb\Record\Record; return new WestdcDb\Record\Record;
} }
public function getSelectHandle()
{
return new WestdcDb\Record\Select;
}
public function getRecordDecorate($decorateName){ public function getRecordDecorate($decorateName){
$className = "RecordDecorate\\".$decorateName; $className = "RecordDecorate\\".$decorateName;
return new $className; return new $className;