getSelect() public method

public getSelect ( )
Example #1
0
	/**
	 * @internal
	 * @param  string|NULL column name or NULL to reload all columns
	 * @param  bool
	 */
	public function accessColumn($key, $selectColumn = TRUE)
	{
		if (!$this->cache) {
			return;
		}

		if ($key === NULL) {
			$this->accessedColumns = FALSE;
			$currentKey = key((array) $this->data);
		} elseif ($this->accessedColumns !== FALSE) {
			$this->accessedColumns[$key] = $selectColumn;
		}

		if ($selectColumn && !$this->sqlBuilder->getSelect() && $this->previousAccessedColumns && ($key === NULL || !isset($this->previousAccessedColumns[$key]))) {
			$this->previousAccessedColumns = array();

			if ($this->sqlBuilder->getLimit()) {
				$generalCacheKey = $this->generalCacheKey;
				$sqlBuilder = $this->sqlBuilder;

				$primaryValues = array();
				foreach ((array) $this->rows as $row) {
					$primary = $row->getPrimary();
					$primaryValues[] = is_array($primary) ? array_values($primary) : $primary;
				}

				$this->emptyResultSet(FALSE);
				$this->sqlBuilder = clone $this->sqlBuilder;
				$this->sqlBuilder->setLimit(NULL, NULL);
				$this->wherePrimary($primaryValues);

				$this->generalCacheKey = $generalCacheKey;
				$this->execute();
				$this->sqlBuilder = $sqlBuilder;
			} else {
				$this->emptyResultSet(FALSE);
				$this->execute();
			}

			$this->dataRefreshed = TRUE;

			// move iterator to specific key
			if (isset($currentKey)) {
				while (key($this->data) !== $currentKey) {
					next($this->data);
				}
			}
		}
	}
 /**
  * @internal
  * @param  string|NULL column name or (NULL to reload all columns & disable columns cache)
  * @param  bool
  */
 public function accessColumn($key, $selectColumn = TRUE)
 {
     if (!$this->cache) {
         return;
     }
     if ($key === NULL) {
         $this->accessedColumns = FALSE;
     } elseif ($this->accessedColumns !== FALSE) {
         $this->accessedColumns[$key] = $selectColumn;
     }
     if ($selectColumn && !$this->sqlBuilder->getSelect() && $this->previousAccessedColumns && ($key === NULL || !isset($this->previousAccessedColumns[$key]))) {
         $this->previousAccessedColumns = FALSE;
         $this->emptyResultSet();
         $this->dataRefreshed = TRUE;
     }
 }
 /**
  * @internal
  *
  * @param            string column name
  * @param  bool|NULL TRUE   - cache, FALSE - don't cache, NULL - remove
  *
  * @return bool
  */
 public function access($key, $cache = true)
 {
     if ($cache === null) {
         if (is_array($this->accessed)) {
             $this->accessed[$key] = false;
         }
         return false;
     }
     if ($key === null) {
         $this->accessed = '';
     } elseif (!is_string($this->accessed)) {
         $this->accessed[$key] = $cache;
     }
     if ($cache && !$this->sqlBuilder->getSelect() && $this->prevAccessed && ($key === null || !isset($this->prevAccessed[$key]))) {
         $this->prevAccessed = '';
         $this->emptyResultSet();
         return true;
     }
     return false;
 }
Example #4
0
 /**
  * @internal
  * @param  string column name
  * @param  bool|NULL TRUE - cache, FALSE - don't cache, NULL - remove
  * @return bool
  */
 public function access($key, $cache = TRUE)
 {
     if ($cache === NULL) {
         if (is_array($this->accessed)) {
             $this->accessed[$key] = FALSE;
         }
         return FALSE;
     }
     if ($key === NULL) {
         $this->accessed = '';
     } elseif (!is_string($this->accessed)) {
         $this->accessed[$key] = $cache;
     }
     if ($cache && !$this->sqlBuilder->getSelect() && $this->prevAccessed && ($key === NULL || !isset($this->prevAccessed[$key]))) {
         $this->prevAccessed = '';
         $this->emptyResultSet();
         return TRUE;
     }
     return FALSE;
 }
Example #5
0
 /**
  * @internal
  * @param  string|NULL column name or (NULL to reload all columns & disable columns cache)
  * @param  bool
  */
 public function accessColumn($key, $selectColumn = TRUE)
 {
     if (!$this->cache) {
         return;
     }
     if ($key === NULL) {
         $this->accessedColumns = FALSE;
         $currentKey = key((array) $this->data);
     } elseif ($this->accessedColumns !== FALSE) {
         $this->accessedColumns[$key] = $selectColumn;
     }
     if ($selectColumn && !$this->sqlBuilder->getSelect() && $this->previousAccessedColumns && ($key === NULL || !isset($this->previousAccessedColumns[$key]))) {
         $this->previousAccessedColumns = FALSE;
         $this->emptyResultSet();
         $this->dataRefreshed = TRUE;
         if ($key === NULL) {
             // we need to move iterator in resultset
             $this->execute();
             while (key($this->data) !== $currentKey) {
                 next($this->data);
             }
         }
     }
 }