svn[1737] PvP Log page throwing Database error

Posts from previous Beta sessions

svn[1737] PvP Log page throwing Database error

Postby AnthonyB » Mon Mar 24, 2008 6:08 pm

Easier to go to the page and see it:

http://anthonyb.dyndns.org/roster2/inde ... pvp&a=c:92

Here's the error for forum searchability:
Code: Select all
Database Error0: 
SQL:
SELECT `zone`, COUNT(`zone`) AS countz FROM `roster_addons_pvplog_pvp2` WHERE `member_id` = '92' AND `enemy` = '1' AND `bg` = '0' AND `win` = '0' GROUP BY `zone` ORDER BY countz DESC LIMIT 0,1
File: addons\pvplog\inc\pvp.lib.php
Line: 728
Backtrace (most recent call last):
lib\functions.lib.php
Line: 189
Function Called: backtrace
addons\pvplog\inc\pvp.lib.php
Line: 728
Function Called: die_quietly
Arguments:
0:
Database Error
C:\Inetpub\wwwroot\roster2\addons\pvplog\inc\pvp.lib.php
728
SELECT `zone`, COUNT(`zone`) AS countz FROM `roster_addons_pvplog_pvp2` WHERE `member_id` = '92' AND `enemy` = '1' AND `bg` = '0' AND `win` = '0' GROUP BY `zone` ORDER BY countz DESC LIMIT 0,1
addons\pvplog\inc\pvp.lib.php
Line: 153
Function Called: output_pvplog
Arguments:
Array ( [0] => pvp3 Object ( [data] => Array ( [0] => 92 [member_id] => 92 [1] => 5000 [index] => 5000 [2] => 2007-11-19 23:08:04 [date] => 2007-11-19 23:08:04 [3] => Cheric [name] => Cheric [4] => Nemesis [guild] => Nemesis [5] => [realm] => [6] => Human [race] => Human [7] => Warrior [class] => Warrior [8] => Hillsbrad Foothills [zone] => Hillsbrad Foothills [9] => Hillsbrad Fields [subzone] => Hillsbrad Fields [10] => 1 [enemy] => 1 [11] => 1 [win] => 1 [12] => [rank] => [13] => 0 [bg] => 0 [14] => -3 [leveldiff] => -3 [15] => 0 [honor] => 0 [16] => 1 [column_id] => 1 [17] => Mon Nov 19th, 11:08 PM [date2] => Mon Nov 19th, 11:08 PM ) ) )
addons\pvplog\char\pvp.php
Line: 35
Function Called: show_pvp2
Arguments:
PvP
char-pvplog-pvp&a=c:92
 
 
index.php
Line: 176
Function Called: require
Arguments:
C:\Inetpub\wwwroot\roster2\addons\pvplog\char\pvp.php 
Roster 2.0.2 svn [latest] latest trunk SVN svn [latest] running on IIS7/Windows Server 2008 SP2 | MySQL 5.0.85 | PHP 5.2.10 | Yes, Roster and PHP rocks on IIS! Even run as FastCGI extension!
User avatar
AnthonyB
Gimpy Developer
Gimpy Developer
 
Posts: 346
Joined: Tue Jul 04, 2006 2:44 pm
Location: Sydney, Australia

svn[1737] PvP Log page throwing Database error

Postby zanix » Mon Mar 24, 2008 8:48 pm

Anthony, you know better than to forget to include the version of PvPLog you are using :)

But I think the error checking for the sql data may be catching 0 results as an error
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

svn[1737] PvP Log page throwing Database error

Postby Argusi » Tue Mar 25, 2008 1:29 am

I went through that here I believe:
http://www.wowroster.net/Forums/viewtop ... html#32684

I removed what appeared to be debug statements and it worked. You are correct zanix, I believe it is not matching the case and it dumps at that point instead of continuing.

I make no guarantees for this workaround, but it is working with us so far. So do this at your own risk.

pvp.lib.php
Change lines 722 to 746 from:

Code: Select all
   // Get the world best zone
   $query = "SELECT `zone`, COUNT(`zone`) AS countz FROM " . $roster->db->table('pvp2',$addon['basename']) . " WHERE `member_id` = '" . $roster->data['member_id'] . "' AND `enemy` = '1' AND `bg` = '0' AND `win` = '1' GROUP BY `zone` ORDER BY countz DESC LIMIT 0,1";
   $wbzone = $roster->db->query_first($query) or die_quietly($roster->db->error(),'Database Error',__FILE__,__LINE__,$query);

   // Get the world worst zone
   $query = "SELECT `zone`, COUNT(`zone`) AS countz FROM `" . $roster->db->table('pvp2',$addon['basename']) . "` WHERE `member_id` = '" . $roster->data['member_id'] . "' AND `enemy` = '1' AND `bg` = '0' AND `win` = '0' GROUP BY `zone` ORDER BY countz DESC LIMIT 0,1";
   $wwzone = $roster->db->query_first($query) or die_quietly($roster->db->error(),'Database Error',__FILE__,__LINE__,$query);

   // Get vs guild best zone
   $query = "SELECT guild, COUNT(guild) AS countg FROM `" . $roster->db->table('pvp2',$addon['basename']) . "` WHERE `member_id` = '" . $roster->data['member_id'] . "' AND `enemy` = '1' AND `bg` = '0' AND `win` = '1' GROUP BY guild ORDER BY countg DESC LIMIT 0,1";
   $gbzone = $roster->db->query_first($query) or die_quietly($roster->db->error(),'Database Error',__FILE__,__LINE__,$query);

   // Get vs guild worst zone
   $query = "SELECT guild, COUNT(guild) AS countg FROM `" . $roster->db->table('pvp2',$addon['basename']) . "` WHERE `member_id` = '" . $roster->data['member_id'] . "' AND `enemy` = '1' AND `bg` = '0' AND `win` = '0' GROUP BY guild ORDER BY countg DESC LIMIT 0,1";
   $gwzone = $roster->db->query_first($query) or die_quietly($roster->db->error(),'Database Error',__FILE__,__LINE__,$query);

   // Get vs player loss stats
   $query = "SELECT name, guild, race, class, leveldiff, COUNT(name) AS countn FROM `" . $roster->db->table('pvp2',$addon['basename']) . "` WHERE `member_id` = '" . $roster->data['member_id'] . "' AND `enemy` = '1' AND `bg` = '0' AND `win` = '0' GROUP BY name ORDER BY countn DESC LIMIT 0,1";
   $result = $roster->db->query($query) or die_quietly($roster->db->error(),'Database Error',__FILE__,__LINE__,$query);
   $data['loss'] = $roster->db->fetch($result);
   $roster->db->free_result($result);

   // Get vs player win stats
   $query = "SELECT name, guild, race, class, leveldiff, COUNT(name) AS countn FROM `" . $roster->db->table('pvp2',$addon['basename']) . "` WHERE `member_id` = '" . $roster->data['member_id'] . "' AND `enemy` = '1' AND `bg` = '0' AND `win` = '1' GROUP BY name ORDER BY countn DESC LIMIT 0,1";
   $result = $roster->db->query($query) or die_quietly($roster->db->error(),'Database Error',__FILE__,__LINE__,$query);


To:
Code: Select all
   // Get the world best zone
   $query = "SELECT `zone`, COUNT(`zone`) AS countz FROM " . $roster->db->table('pvp2',$addon['basename']) . " WHERE `member_id` = '" . $roster->data['member_id'] . "' AND `enemy` = '1' AND `bg` = '0' AND `win` = '1' GROUP BY `zone` ORDER BY countz DESC LIMIT 0,1";
   $wbzone = $roster->db->query_first($query);

   // Get the world worst zone
   $query = "SELECT `zone`, COUNT(`zone`) AS countz FROM `" . $roster->db->table('pvp2',$addon['basename']) . "` WHERE `member_id` = '" . $roster->data['member_id'] . "' AND `enemy` = '1' AND `bg` = '0' AND `win` = '0' GROUP BY `zone` ORDER BY countz DESC LIMIT 0,1";
   $wwzone = $roster->db->query_first($query);

   // Get vs guild best zone
   $query = "SELECT guild, COUNT(guild) AS countg FROM `" . $roster->db->table('pvp2',$addon['basename']) . "` WHERE `member_id` = '" . $roster->data['member_id'] . "' AND `enemy` = '1' AND `bg` = '0' AND `win` = '1' GROUP BY guild ORDER BY countg DESC LIMIT 0,1";
   $gbzone = $roster->db->query_first($query);

   // Get vs guild worst zone
   $query = "SELECT guild, COUNT(guild) AS countg FROM `" . $roster->db->table('pvp2',$addon['basename']) . "` WHERE `member_id` = '" . $roster->data['member_id'] . "' AND `enemy` = '1' AND `bg` = '0' AND `win` = '0' GROUP BY guild ORDER BY countg DESC LIMIT 0,1";
   $gwzone = $roster->db->query_first($query);

   // Get vs player loss stats
   $query = "SELECT name, guild, race, class, leveldiff, COUNT(name) AS countn FROM `" . $roster->db->table('pvp2',$addon['basename']) . "` WHERE `member_id` = '" . $roster->data['member_id'] . "' AND `enemy` = '1' AND `bg` = '0' AND `win` = '0' GROUP BY name ORDER BY countn DESC LIMIT 0,1";
   $result = $roster->db->query($query);
   $data['loss'] = $roster->db->fetch($result);
   $roster->db->free_result($result);

   // Get vs player win stats
   $query = "SELECT name, guild, race, class, leveldiff, COUNT(name) AS countn FROM `" . $roster->db->table('pvp2',$addon['basename']) . "` WHERE `member_id` = '" . $roster->data['member_id'] . "' AND `enemy` = '1' AND `bg` = '0' AND `win` = '1' GROUP BY name ORDER BY countn DESC LIMIT 0,1";
   $result = $roster->db->query($query);


Basically, just removed what looks like a debug. If you continue to PVP, you will eventually match all the cases at one point or another, but I couldn't wait to start looking at my stats.

Sorry if this is not clear, I'm in a bit of a rush. If there are any problems, I'll check back later.
Argusi
WR.net Apprentice
WR.net Apprentice
 
Posts: 9
Joined: Tue Mar 04, 2008 11:28 pm

svn[1737] PvP Log page throwing Database error

Postby zanix » Tue Mar 25, 2008 4:34 am

Your fixes appear to be correct
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

svn[1737] PvP Log page throwing Database error

Postby AnthonyB » Tue Mar 25, 2008 12:18 pm

OK, so doing a diff on the above it was simply a matter of removing all the instances of
Code: Select all
 or die_quietly($roster->db->error(),'Database Error',__FILE__,__LINE__,$query)


which is in lines 724, 728, 732, 736, 740, 746

This worked for me as well.

Is this something that should be added to SVN or does someone want to investigate why this is breaking and fix properly?
Roster 2.0.2 svn [latest] latest trunk SVN svn [latest] running on IIS7/Windows Server 2008 SP2 | MySQL 5.0.85 | PHP 5.2.10 | Yes, Roster and PHP rocks on IIS! Even run as FastCGI extension!
User avatar
AnthonyB
Gimpy Developer
Gimpy Developer
 
Posts: 346
Joined: Tue Jul 04, 2006 2:44 pm
Location: Sydney, Australia

svn[1737] PvP Log page throwing Database error

Postby zanix » Tue Mar 25, 2008 11:17 pm

I definitely want to rewrite how this handles errors, make sure that it stops when query_first returns a false and not when it returns 0
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

svn[1737] PvP Log page throwing Database error

Postby zanix » Tue May 27, 2008 7:59 am

svn[1780]
Changed these to check for false, then die
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US


Return to Archived

Who is online

Users browsing this forum: No registered users and 0 guests

cron