Gdn_DatabaseStructure::executeQuery PHP Method

executeQuery() protected method

Send a query to the database and return the result.
protected executeQuery ( string $sql, boolean $checkThreshold = false ) : boolean
$sql string The sql to execute.
$checkThreshold boolean Whether or not to check the alter table threshold before altering the table.
return boolean Whether or not the query succeeded.
    protected function executeQuery($sql, $checkThreshold = false)
    {
        if ($this->CaptureOnly) {
            if (!property_exists($this->Database, 'CapturedSql')) {
                $this->Database->CapturedSql = array();
            }
            $this->Database->CapturedSql[] = $sql;
            return true;
        } elseif ($checkThreshold && $this->getAlterTableThreshold() && $this->getRowCountEstimate($this->tableName()) >= $this->getAlterTableThreshold()) {
            $this->addIssue("The table was past its threshold. Run the alter manually.", $sql);
            // Log an event to be captured and analysed later.
            Logger::event('structure_threshold', Logger::ALERT, "Cannot alter table {tableName}. Its count of {rowCount,number} is past the {rowThreshold,number} threshold.", ['tableName' => $this->tableName(), 'rowCount' => $this->getRowCountEstimate($this->tableName()), 'rowThreshold' => $this->getAlterTableThreshold()]);
            return true;
        } else {
            $Result = $this->Database->query($sql);
            return $Result;
        }
    }