Tests query to determine if expressions or aliases columns exist.

@return boolean
358404
public function isReadOnly()
    {
        $readOnly = false;
        $fields   = $this->getPart(Zend_Db_Table_Select::COLUMNS);
        $cols     = $this->_info[Zend_Db_Table_Abstract::COLS];

        if (!count($fields)) {
            return $readOnly;
        }

        foreach ($fields as $columnEntry) {
            $column = $columnEntry[1];
            $alias = $columnEntry[2];

            if ($alias !== null) {
                $column = $alias;
            }

            switch (true) {
                case ($column == self::SQL_WILDCARD):
                    break;

                case ($column instanceof Zend_Db_Expr):
                case (!in_array($column, $cols)):
                    $readOnly = true;
                    break 2;
            }
        }

        return $readOnly;
    }
704936
public function ColumnExists($ColumnName) {
      $Result = array_key_exists($ColumnName, $this->ExistingColumns());
      if (!$Result) {
         foreach ($this->ExistingColumns() as $ColName => $Def) {
            if (strcasecmp($ColumnName, $ColName) == 0)
               return TRUE;
         }
         return FALSE;
      }
      return $Result;
   }
755081
public function table_exists() {
		return (bool) $this->db->get_row( $this->db->prepare('SHOW TABLES LIKE %s', $this->table ) );
	}
309307
public function select($columns = [])
    {
        $expr = new ColumnExpression($this->sql);

        if ($columns instanceof Closure) {
            $columns($expr);
        } else {
            if (!is_array($columns)) {
                $columns = [$columns];
            }
            $expr->columns($columns);
        }
    }
36823
public function select($columns = [])
    {
        $expr = new ColumnExpression($this->getSQLStatement());

        if ($columns instanceof Closure) {
            $columns($expr);
        } else {
            if (!is_array($columns)) {
                $columns = [$columns];
            }
            $expr->columns($columns);
        }
    }
585497
public function exists()
    {
        // By default all fields
        foreach ($this->compositeDatabaseFields() as $field => $spec) {
            $fieldObject = $this->dbObject($field);
            if (!$fieldObject->exists()) {
                return false;
            }
        }
        return true;
    }
655190
public function isLocalColumnsRequired()
    {
        foreach ($this->localColumns as $columnName) {
            if (!$this->parentTable->getColumn($columnName)->isNotNull()) {
                return false;
            }
        }

        return true;
    }
1162052
protected function checkTableExists()
  {
    $m = $this->getManager();

    $q = 'SHOW TABLES LIKE "' . $m->getPrefix() . $this->getTable() . '"';

    return (bool)$m->query($q)->rowCount();
  }
874951
public static function hasColumn($column)
    {
        $cls  = get_called_class();
        $key  = null;
        $keys = self::$_columns[$cls];

        foreach ($keys as $ckey) {
            $col1 = self::isIgnoringCase() ? strtolower($ckey)   : $ckey;
            $col2 = self::isIgnoringCase() ? strtolower($column) : $column;
            if ($col1==$col2) {
                $key = $ckey;
                break;
            }
        }
        return $key;
    }
1023547
public function indexExists( $table, $columns = [ ] )
    {
        $indexes = $this->getTableIndexes( $table );

        $name = '';

        $this->prepareIndexName( $columns, $name );

        foreach ( $indexes as $index )
        {
            if ( $index === $name )
            {
                return TRUE;
            }
        }

        return FALSE;
    }
1215288
public function checkDbTableExists() {
		$ds = $this->getDataSource();
		$existsTables = $ds->listSources();
		if (empty($existsTables)) {
			return false;
		}

		$schemaList = [];
		$schemaCheckingList = [''];
		$schemaCheckingListCfg = $this->_modelConfigInstaller->getListSchemaChecking();
		if (!empty($schemaCheckingList)) {
			$schemaCheckingList = array_merge($schemaCheckingList, $schemaCheckingListCfg);
		}
		foreach ($schemaCheckingList as $schemaCheckingListItem) {
			$name = null;
			$path = null;
			$file = null;
			$connection = null;
			$plugin = null;

			if (preg_match('/[\s\b]?\-\-name\s+(\w+)/', $schemaCheckingListItem, $matches) && (count($matches) == 2)) {
				list($plugin, $name) = pluginSplit($matches[1]);
			} elseif (preg_match('/^(\w+)/', $schemaCheckingListItem, $matches) && (count($matches) == 2)) {
				$name = $matches[1];
			}

			if (preg_match('/[\s\b]?(?:\-p|\-\-plugin)\s+(\w+)/', $schemaCheckingListItem, $matches) && (count($matches) == 2)) {
				$plugin = $matches[1];
			}

			if (preg_match('/[\s\b]?(?:\-c|\-\-connection)\s+(\w+)/', $schemaCheckingListItem, $matches) && (count($matches) == 2)) {
				$connection = $matches[1];
			}

			if (preg_match('/[\s\b]?\-\-path\s+(\w+)/', $schemaCheckingListItem, $matches) && (count($matches) == 2)) {
				$path = $matches[1];
			}

			if (preg_match('/[\s\b]?\-\-file\s+(\w+)/', $schemaCheckingListItem, $matches) && (count($matches) == 2)) {
				$file = $matches[1];
			}

			if (!empty($name)) {
				$file = Inflector::underscore($name);
			} elseif (empty($file)) {
				$file = 'schema.php';
			}

			if (strpos($file, '.php') === false) {
				$file .= '.php';
			}

			if (!empty($plugin) && empty($name)) {
				$name = $plugin;
			}

			$name = Inflector::camelize($name);
			$schemaList[] = compact('name', 'path', 'file', 'connection', 'plugin');
		}

		$existsTables = array_flip($existsTables);
		foreach ($schemaList as $schemaListItem) {
			$Schema = new CakeSchema($schemaListItem);
			$oldSchema = $Schema->load();
			if (!$oldSchema) {
				return false;
			}

			$diffTables = array_diff_key($oldSchema->tables, $existsTables);
			if (!empty($diffTables)) {
				return false;
			}
			unset($Schema);
		}

		return true;
	}
1363725
public function exists()
    {
        $existsQuery = new Exists($this);

        // set the current select for the exists query
        $existsQuery->setSelect($this);

        // run the callbacks to retirve the results
        $result = $existsQuery->executeResultFetcher();

        if (isset($result[0]['exists']))
        {
            return (bool) $result[0]['exists'];
        }
        
        return false;
    }
573815
public function exists($alias)
    {
        $repo = $this->getItemsName();
        $loc = &$this->$repo;
        foreach (explode('.', $alias) as $step) {
            if (!isset($loc[$step])) {
                return false;
            } else {
                $loc = &$loc[$step];
            }
        }
        return true;
    }
17859
protected function hasAggregates() {
		if ($this->groups) {
			return true;
		}
		foreach ($this->columns as $column) {
			if (strpos($column, '(') !== false) {
				return true;
			}
		}
		return false;
	}
1255097
public function hasAliasedContent()
    {
        $db = Loader::db();
        // aliased content is content on the particular page that is being
        // used elsewhere - but the content on the PAGE is the original version
        $v = [$this->cID];
        $q = 'select bID from CollectionVersionBlocks where cID = ? and isOriginal = 1';
        $r = $db->query($q, $v);
        $bIDArray = [];
        if ($r) {
            while ($row = $r->fetchRow()) {
                $bIDArray[] = $row['bID'];
            }
            if (count($bIDArray) > 0) {
                $bIDList = implode(',', $bIDArray);
                $v2 = [$bIDList, $this->cID];
                $q2 = 'select cID from CollectionVersionBlocks where bID in (?) and cID <> ? limit 1';
                $aliasedCID = $db->getOne($q2, $v2);
                if ($aliasedCID > 0) {
                    return true;
                }
            }
        }

        return false;
    }
838571
public function isFilterable()
    {
        $hasFilters = false;

        foreach ($this->columns as $column) {
            if ($column->isFilterable()) {
                $hasFilters = true;
                break;
            }
        }

        return $hasFilters;
    }
219456
public function exists()
    {
        $sql = 'SELECT count(*) FROM INFORMATION_SCHEMA.TABLES WHERE Table_Name=? ';
        $params = array($this->_name->table);

        if (is_null($this->_name->database)) {
            $sql .= 'AND TABLE_SCHEMA=database() ';
        } else {
            $sql .= 'AND TABLE_SCHEMA=? ';
            $params []= $this->_name->database;
        }

        return (bool) $this->_connection->execute($sql, $params)->scalar();
    }