Back to MysqlChangeItem class

Method checkNull

private string
checkNull
(mixed $changesArray)
Create query clause for column changes/modifications for NULL attribute
Parameters
  • array $changesArray The array of words after COLUMN name
Returns
  • string The query clause for NULL check in the check query
Since
  • 3.8.6

Method checkNull - Source code

/**
 * Create query clause for column changes/modifications for NULL attribute
 *
 * @param   array  $changesArray  The array of words after COLUMN name
 *
 * @return  string  The query clause for NULL check in the check query
 *
 * @since   3.8.6
 */
private function checkNull($changesArray)
{
    // Find NULL keyword
    $index = array_search('null', array_map('strtolower', $changesArray));
    // Create the check
    if ($index !== false) {
        if ($index == 0 || strtolower($changesArray[$index - 1]) !== 'not') {
            return ' `null` = ' . $this->db->quote('YES');
        } else {
            return ' `null` = ' . $this->db->quote('NO');
        }
    }
    return false;
}