Changeset 4303

Show
Ignore:
Timestamp:
04/30/08 06:12:50 (14 months ago)
Author:
jwage
Message:

fixes #987

Location:
branches/0.11/lib/Doctrine
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/lib/Doctrine/Query/Abstract.php

    r4264 r4303  
    932932                $query = $this->getSqlQuery($params); 
    933933            } 
     934            $params = $this->convertEnums($params); 
    934935        } else { 
    935936            $query = $this->_view->getSelectSql(); 
    936937        } 
    937  
    938         $params = $this->convertEnums($params); 
    939938 
    940939        if ($this->isLimitSubqueryUsed() && 
  • branches/0.11/lib/Doctrine/View.php

    r3884 r4303  
    5353     * @var string $name                the name of the view 
    5454     */ 
    55     protected $name; 
     55    protected $_name; 
    5656 
    5757    /** 
    5858     * @var Doctrine_Query $query       the DQL query object this view is hooked into 
    5959     */ 
    60     protected $query; 
     60    protected $_query; 
    6161 
    6262    /** 
    6363     * @var Doctrine_Connection $conn   the connection object 
    6464     */ 
    65     protected $conn; 
     65    protected $_conn; 
     66 
     67    /** 
     68     * @var string $_dql The view dql string 
     69     */ 
     70    protected $_dql; 
     71 
     72    /** 
     73     * @var string $_sql The view sql string 
     74     */ 
     75    protected $_sql; 
    6676 
    6777    /** 
     
    7282    public function __construct(Doctrine_Query $query, $viewName) 
    7383    { 
    74         $this->name  = $viewName; 
    75         $this->query = $query; 
    76         $this->query->setView($this); 
    77         $this->conn   = $query->getConnection(); 
     84        $this->_name  = $viewName; 
     85        $this->_query = $query; 
     86        $this->_query->setView($this); 
     87        $this->_conn   = $query->getConnection(); 
     88        $this->_dql = $query->getDql(); 
     89        $this->_sql = $query->getSql(); 
    7890    } 
    7991 
    8092    /** 
    81      * getQuery 
    8293     * returns the associated query object 
    8394     * 
     
    8697    public function getQuery() 
    8798    { 
    88         return $this->query; 
     99        return $this->_query; 
    89100    } 
    90101 
    91102    /** 
    92      * getName 
    93103     * returns the name of this view 
    94104     * 
     
    97107    public function getName() 
    98108    { 
    99         return $this->name; 
     109        return $this->_name; 
    100110    } 
    101111 
    102112    /** 
    103      * getConnection 
    104113     * returns the connection object 
    105114     * 
     
    108117    public function getConnection() 
    109118    { 
    110         return $this->conn; 
     119        return $this->_conn; 
    111120    } 
    112121 
    113122    /** 
    114      * create 
    115123     * creates this view 
    116124     * 
     
    120128    public function create() 
    121129    { 
    122         $sql = sprintf(self::CREATE, $this->name, $this->query->getQuery()); 
     130        $sql = sprintf(self::CREATE, $this->_name, $this->_query->getQuery()); 
    123131        try { 
    124             $this->conn->execute($sql); 
     132            $this->_conn->execute($sql); 
    125133        } catch(Doctrine_Exception $e) { 
    126134            throw new Doctrine_View_Exception($e->__toString()); 
     
    129137 
    130138    /** 
    131      * drop 
    132139     * drops this view from the database 
    133140     * 
     
    138145    { 
    139146        try { 
    140             $this->conn->execute(sprintf(self::DROP, $this->name)); 
     147            $this->_conn->execute(sprintf(self::DROP, $this->_name)); 
    141148        } catch(Doctrine_Exception $e) { 
    142149            throw new Doctrine_View_Exception($e->__toString()); 
     
    145152 
    146153    /** 
    147      * execute 
    148      * executes the view 
    149154     * returns a collection of Doctrine_Record objects 
    150155     * 
     
    153158    public function execute() 
    154159    { 
    155         return $this->query->execute(); 
     160        return $this->_query->execute(); 
    156161    } 
    157162 
    158163    /** 
    159      * getSelectSql 
    160164     * returns the select sql for this view 
    161165     * 
     
    164168    public function getSelectSql() 
    165169    { 
    166         return sprintf(self::SELECT, $this->name); 
     170        return sprintf(self::SELECT, $this->_name); 
     171    } 
     172 
     173    /** 
     174     * Get the view sql string 
     175     * 
     176     * @return string $sql 
     177     */ 
     178    public function getViewSql() 
     179    { 
     180        return $this->_sql; 
     181    } 
     182 
     183    /** 
     184     * Get the view dql string 
     185     * 
     186     * @return string $dql 
     187     */ 
     188    public function getViewDql() 
     189    { 
     190        return $this->_dql; 
    167191    } 
    168192}