<commit_before><?php 
if (!defined('BASEPATH')) exit ('No direct script access allowed');

/**
  * Add new album.
  *
  * @param array $opts.
  *          'artist_name'  => Artist name
  *          'user_id'      => User ID
  *
  * @return array Artist ID or boolean FALSE.
  */
if (!function_exists('addArtist')) {
  function addArtist($opts = array()) {
    $ci=& get_instance();
    $ci->load->database();

    // Load helpers.
    $data['artist_name'] = !empty($opts['artist_name']) ? ucwords($opts['artist_name']) : '';
    $data['user_id'] = !empty($opts['user_id']) ? $opts['user_id'] : '';

    if (!empty($data['artist_name'])) {
      $sql = "INSERT
                INTO " . TBL_artist . " (`user_id`, `artist_name`, `created`)
                VALUES (?, ?, CURRENT_TIMESTAMP())";
      $query = $ci->db->query($sql, array($data['user_id'], $data['artist_name']));
      if ($ci->db->affected_rows() === 1) {
        return $ci->db->insert_id();
      }
    }
    return FALSE;
  }
}

/**
  * Gets artist's info.
  *
  * @param array $opts.
  *          'artist_name'  => Artist name
  *
  * @return array Artist information or boolean FALSE.
  */
if (!function_exists('getArtistInfo')) {
  function getArtistInfo($opts = array()) {
    $ci=& get_instance();
    $ci->load->database();

    $artist_name = !empty($opts['artist_name']) ? $opts['artist_name'] : FALSE;
    if ($artist_name === FALSE) {
      $artist_id = !empty($opts['artist_id']) ? $opts['artist_id'] : FALSE;
      $sql = "SELECT " . TBL_artist . ".`id` as `artist_id`,
                     " . TBL_artist . ".`artist_name`,
                     " . TBL_artist . ".`spotify_uri`,
                     YEAR(" . TBL_artist . ".`created`) as `created`
              FROM " . TBL_artist . "
              WHERE " . TBL_artist . ".`id` = ?";
      $query = $ci->db->query($sql, array($artist_id));
    }
    else {
      $sql = "SELECT " . TBL_artist . ".`id` as `artist_id`,
                     " . TBL_artist . ".`artist_name`,
                     " . TBL_artist . ".`spotify_uri`,
                     YEAR(" . TBL_artist . ".`created`) as `created`
              FROM " . TBL_artist . "
              WHERE " . TBL_artist . ".`artist_name` LIKE ?
              COLLATE utf8_swedish_ci";
      $query = $ci->db->query($sql, array($artist_name));
    }
    return ($query->num_rows() > 0) ? $query->result_array()[0] : FALSE;
  }
}

/**
  * Gets artist's bio.
  *
  * @param array $opts.
  *          'artist_id'  => Artist ID
  *
  * @return array Artist bio
  */
if (!function_exists('getArtistBio')) {
  function getArtistBio($opts = array()) {
    $ci=& get_instance();
    $ci->load->database();

    $artist_id = !empty($opts['artist_id']) ? $opts['artist_id'] : '';
    $sql = "SELECT " . TBL_artist_biography . ".`id` as `biography_id`,
                   " . TBL_artist_biography . ".`summary` as `bio_summary`, 
                   " . TBL_artist_biography . ".`text` as `bio_content`, 
                   " . TBL_artist_biography . ".`updated` as `bio_updated`,
                   'false' as `update_bio`
            FROM " . TBL_artist_biography . "
            WHERE " . TBL_artist_biography . ".`artist_id` = ?";
    $query = $ci->db->query($sql, array($artist_id));
    return ($query->num_rows() > 0) ? $query->result_array()[0] : array('update_bio' => false);<commit_msg>Fixed collate problem.<commit_after><?php 
if (!defined('BASEPATH')) exit ('No direct script access allowed');

/**
  * Add new album.
  *
  * @param array $opts.
  *          'artist_name'  => Artist name
  *          'user_id'      => User ID
  *
  * @return array Artist ID or boolean FALSE.
  */
if (!function_exists('addArtist')) {
  function addArtist($opts = array()) {
    $ci=& get_instance();
    $ci->load->database();

    // Load helpers.
    $data['artist_name'] = !empty($opts['artist_name']) ? ucwords($opts['artist_name']) : '';
    $data['user_id'] = !empty($opts['user_id']) ? $opts['user_id'] : '';

    if (!empty($data['artist_name'])) {
      $sql = "INSERT
                INTO " . TBL_artist . " (`user_id`, `artist_name`, `created`)
                VALUES (?, ?, CURRENT_TIMESTAMP())";
      $query = $ci->db->query($sql, array($data['user_id'], $data['artist_name']));
      if ($ci->db->affected_rows() === 1) {
        return $ci->db->insert_id();
      }
    }
    return FALSE;
  }
}

/**
  * Gets artist's info.
  *
  * @param array $opts.
  *          'artist_name'  => Artist name
  *
  * @return array Artist information or boolean FALSE.
  */
if (!function_exists('getArtistInfo')) {
  function getArtistInfo($opts = array()) {
    $ci=& get_instance();
    $ci->load->database();

    $artist_name = !empty($opts['artist_name']) ? $opts['artist_name'] : FALSE;
    if ($artist_name === FALSE) {
      $artist_id = !empty($opts['artist_id']) ? $opts['artist_id'] : FALSE;
      $sql = "SELECT " . TBL_artist . ".`id` as `artist_id`,
                     " . TBL_artist . ".`artist_name`,
                     " . TBL_artist . ".`spotify_uri`,
                     YEAR(" . TBL_artist . ".`created`) as `created`
              FROM " . TBL_artist . "
              WHERE " . TBL_artist . ".`id` = ?";
      $query = $ci->db->query($sql, array($artist_id));
    }
    else {
      $sql = "SELECT " . TBL_artist . ".`id` as `artist_id`,
                     " . TBL_artist . ".`artist_name`,
                     " . TBL_artist . ".`spotify_uri`,
                     YEAR(" . TBL_artist . ".`created`) as `created`
              FROM " . TBL_artist . "
              WHERE " . TBL_artist . ".`artist_name` LIKE ?";
      $query = $ci->db->query($sql, array($artist_name));
      if ($query->num_rows() > 0) {
        return $query->result_array()[0]
      }
      else {
        $sql = "SELECT " . TBL_artist . ".`id` as `artist_id`,
                       " . TBL_artist . ".`artist_name`,
                       " . TBL_artist . ".`spotify_uri`,
                       YEAR(" . TBL_artist . ".`created`) as `created`
                FROM " . TBL_artist . "
                WHERE " . TBL_artist . ".`artist_name` LIKE ?
                COLLATE utf8_swedish_ci";
        $query = $ci->db->query($sql, array($artist_name));
      }
    }
    return ($query->num_rows() > 0) ? $query->result_array()[0] : FALSE;
  }
}

/**
  * Gets artist's bio.
  *
  * @param array $opts.
  *          'artist_id'  => Artist ID
  *
  * @return array Artist bio
  */
if (!function_exists('getArtistBio')) {
  function getArtistBio($opts = array()) {
    $ci=& get_instance();
    $ci->load->database();

    $artist_id = !empty($opts['artist_id']) ? $opts['artist_id'] : '';
    $sql = "SELECT " . TBL_artist_biography . ".`id` as `biography_id`,
                   " . TBL_artist_biography . ".`summary` as `bio_summary`, 
                   " . TBL_artist_biography . ".`text` as `bio_content`, 
                   " . TBL_artist_biography . ".`updated` as `bio_updated`,
                   'false' as `update_bio`
            FROM " . TBL_artist_biography . "
            WHERE " . TBL_artist_biography . ".`artist_id` = ?";
    $query = $ci->db->query($sql, array($artist_id));
    return ($query->num_rows() > 0) ? $query->result_array()[0] : array('update_bio' => false);
{'fraction_non_alphanumeric': 0.1889210417527904, 'fraction_numerical': 0.0019291718340912222, 'mean_word_length': 2.128448275862069, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 66, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2121816', 'n_tokens_mistral': 2573, 'n_tokens_neox': 2495, 'n_words': 461}