MySQL Error?

  • In Progress
    Posted in: BlackFyre  
  • Member
    scarecr0w12
    September 24, 2015 at 4:06 pm #67616

    I use newrelic for monitoring and such, and i am getting a 100% error rate, and it is pointing to the following block of code in wp-clanwars.php inside of “/wp-content/themes/blackfyre/addons/clan-wars/”

    Block of code being:

    $dbstruct1 .= "CREATE TABLE IF NOT EXISTS{$this->tables[‘games’]}` (
    id int(11) unsigned NOT NULL AUTO_INCREMENT,
    title varchar(200) NOT NULL,
    abbr varchar(20) DEFAULT NULL,
    icon bigint(20) unsigned DEFAULT NULL,
    g_banner_file bigint(20) unsigned DEFAULT NULL,
    PRIMARY KEY (id),
    KEY g_banner_file (g_banner_file),
    KEY icon (icon),
    KEY title (title),
    KEY abbr (abbr)
    ) CHARACTER SET utf8 COLLATE utf8_general_ci;”;

    dbDelta($dbstruct1);
    $EZSQL_ERROR = array();

    $dbstruct2 .= “CREATE TABLE IF NOT EXISTS {$this->tables['maps']} (
    id int(10) unsigned NOT NULL AUTO_INCREMENT,
    game_id int(10) unsigned NOT NULL,
    title varchar(200) NOT NULL,
    screenshot bigint(20) unsigned DEFAULT NULL,
    PRIMARY KEY (id),
    KEY game_id (game_id,screenshot)
    ) CHARACTER SET utf8 COLLATE utf8_general_ci;”;

    dbDelta($dbstruct2);
    $EZSQL_ERROR = array();

    $dbstruct3 .= “CREATE TABLE IF NOT EXISTS {$this->tables['matches']} (
    id int(10) unsigned NOT NULL AUTO_INCREMENT,
    title varchar(200) DEFAULT NULL,
    date timestamp NULL DEFAULT CURRENT_TIMESTAMP,
    post_id bigint(20) unsigned DEFAULT NULL,
    team1 int(11) unsigned NOT NULL,
    team2 int(11) unsigned NOT NULL,
    game_id int(11) unsigned NOT NULL,
    match_status tinyint(1) DEFAULT ‘0’,
    description text NOT NULL,
    external_url varchar(200) DEFAULT NULL,
    status varchar(20) DEFAULT NULL,
    reported_reason text DEFAULT NULL,
    locked tinyint(1) DEFAULT ‘0’,
    PRIMARY KEY (id),
    KEY post_id (post_id),
    KEY post_title (title),
    KEY game_id (game_id),
    KEY team1 (team1),
    KEY team2 (team2),
    KEY match_status (match_status),
    KEY date (date)

    ) CHARACTER SET utf8 COLLATE utf8_general_ci ;”;

    dbDelta($dbstruct3);
    $EZSQL_ERROR = array();

    $dbstruct4 .= “CREATE TABLE IF NOT EXISTS {$this->tables['rounds']} (
    id int(10) unsigned NOT NULL AUTO_INCREMENT,
    match_id int(10) unsigned NOT NULL,
    group_n int(11) NOT NULL,
    map_id int(10) unsigned NOT NULL,
    tickets1 int(11) NOT NULL,
    tickets2 int(11) NOT NULL,
    PRIMARY KEY (id),
    KEY match_id (match_id),
    KEY group_n (group_n),
    KEY map_id (map_id)
    ) CHARACTER SET utf8 COLLATE utf8_general_ci;”;

    dbDelta($dbstruct4);
    $EZSQL_ERROR = array();

    $dbstruct5 .= “CREATE TABLE IF NOT EXISTS {$this->tables['teams']} (
    id int(11) NOT NULL AUTO_INCREMENT,
    title varchar(200) NOT NULL,
    logo bigint(20) unsigned DEFAULT NULL,
    home_team tinyint(1) DEFAULT ‘0’,
    post_id int(30) DEFAULT ‘0’,
    PRIMARY KEY (id),
    KEY home_team (home_team),
    KEY title (title)
    ) CHARACTER SET utf8 COLLATE utf8_general_ci;”;

    dbDelta($dbstruct5);
    $EZSQL_ERROR = array();`

    Error from newrelic:

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘IF’ at line 1

    From what i have gathered, The error does not create any issues that i can find, its just rather bothersome. However, commenting out that block of code resolves, but creates a memory issues, where it begins eating away the ram and swap of the server. From the looks of the Query code, all this is, is creating the tables on start, so it creating the error as it does coudl pose a problem.

    I request an immediate fix for this issue.

    Sorry, this forum is for verified users only. Please Login or Register to continue

Comments are closed.