web/lib/Zend/Service/WindowsAzure/Storage/TableEntityQuery.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Service_WindowsAzure
    16  * @package    Zend_Service_WindowsAzure
    17  * @subpackage Storage
    17  * @subpackage Storage
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @version    $Id: TableEntityQuery.php 23167 2010-10-19 17:53:31Z mabe $
    20  * @version    $Id: TableEntityQuery.php 24593 2012-01-05 20:35:02Z matthew $
    21  */
    21  */
    22 
    22 
    23 /**
    23 /**
    24  * @category   Zend
    24  * @category   Zend
    25  * @package    Zend_Service_WindowsAzure
    25  * @package    Zend_Service_WindowsAzure
    26  * @subpackage Storage
    26  * @subpackage Storage
    27  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    27  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    28  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    28  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    29  */
    29  */
    30 class Zend_Service_WindowsAzure_Storage_TableEntityQuery
    30 class Zend_Service_WindowsAzure_Storage_TableEntityQuery
    31 {
    31 {
    32     /**
    32     /**
   127 	 */
   127 	 */
   128 	public function where($condition, $value = null, $cond = '')
   128 	public function where($condition, $value = null, $cond = '')
   129 	{
   129 	{
   130 	    $condition = $this->_replaceOperators($condition);
   130 	    $condition = $this->_replaceOperators($condition);
   131 	    
   131 	    
   132 	    if ($value !== null) {
   132 	    if (!is_null($value)) {
   133 	        $condition = $this->_quoteInto($condition, $value);
   133 	        $condition = $this->_quoteInto($condition, $value);
   134 	    }
   134 	    }
   135 	    
   135 	    
   136 		if (count($this->_where) == 0) {
   136 		if (count($this->_where) == 0) {
   137 			$cond = '';
   137 			$cond = '';
   209 		if (count($this->_orderBy) != 0) {
   209 		if (count($this->_orderBy) != 0) {
   210 		    $orderBy = implode(',', $this->_orderBy);
   210 		    $orderBy = implode(',', $this->_orderBy);
   211 			$query[] = '$orderby=' . ($urlEncode ? self::encodeQuery($orderBy) : $orderBy);
   211 			$query[] = '$orderby=' . ($urlEncode ? self::encodeQuery($orderBy) : $orderBy);
   212 		}
   212 		}
   213 		
   213 		
   214 		if ($this->_top !== null) {
   214 		if (!is_null($this->_top)) {
   215 			$query[] = '$top=' . $this->_top;
   215 			$query[] = '$top=' . $this->_top;
   216 		}
   216 		}
   217 		
   217 		
   218 		if (count($query) != 0) {
   218 		if (count($query) != 0) {
   219 			return '?' . implode('&', $query);
   219 			return '?' . implode('&', $query);
   232 	{
   232 	{
   233 	    $identifier = '';
   233 	    $identifier = '';
   234 	    if ($includeParentheses) {
   234 	    if ($includeParentheses) {
   235 	        $identifier .= '(';
   235 	        $identifier .= '(';
   236 	        
   236 	        
   237 	        if ($this->_partitionKey !== null) {
   237 	        if (!is_null($this->_partitionKey)) {
   238 	            $identifier .= 'PartitionKey=\'' . $this->_partitionKey . '\'';
   238 	            $identifier .= 'PartitionKey=\'' . self::encodeQuery($this->_partitionKey) . '\'';
   239 	        }
   239 	        }
   240 	            
   240 	            
   241 	        if ($this->_partitionKey !== null && $this->_rowKey !== null) {
   241 	        if (!is_null($this->_partitionKey) && !is_null($this->_rowKey)) {
   242 	            $identifier .= ', ';
   242 	            $identifier .= ', ';
   243 	        }
   243 	        }
   244 	            
   244 	            
   245 	        if ($this->_rowKey !== null) {
   245 	        if (!is_null($this->_rowKey)) {
   246 	            $identifier .= 'RowKey=\'' . $this->_rowKey . '\'';
   246 	            $identifier .= 'RowKey=\'' . self::encodeQuery($this->_rowKey) . '\'';
   247 	        }
   247 	        }
   248 	            
   248 	            
   249 	        $identifier .= ')';
   249 	        $identifier .= ')';
   250 	    }
   250 	    }
   251 		return $this->_from . $identifier;
   251 		return $this->_from . $identifier;
   329 		$query = str_replace('&', '%26', $query);
   329 		$query = str_replace('&', '%26', $query);
   330 		$query = str_replace('=', '%3D', $query);
   330 		$query = str_replace('=', '%3D', $query);
   331 		$query = str_replace('+', '%2B', $query);
   331 		$query = str_replace('+', '%2B', $query);
   332 		$query = str_replace(',', '%2C', $query);
   332 		$query = str_replace(',', '%2C', $query);
   333 		$query = str_replace('$', '%24', $query);
   333 		$query = str_replace('$', '%24', $query);
   334 		
   334 		$query = str_replace('{', '%7B', $query);
   335 		
   335 		$query = str_replace('}', '%7D', $query);
       
   336 
   336 		$query = str_replace(' ', '%20', $query);
   337 		$query = str_replace(' ', '%20', $query);
   337 		
   338 		
   338 		return $query;
   339 		return $query;
   339 	}
   340 	}
   340 	
   341