collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Proposed MySQL.php changes  (Read 2526 times)

0 Members and 1 Guest are viewing this topic.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Proposed MySQL.php changes
« on: June 08, 2006, 08:25:01 pm »
I currently have one major issue with the MySQL layer we use, the fact that you have no way of determining if there was an error based on the return from the MySQL functions. Sure, the error function kicks in and dumps the error to file, but the calling function has absolutely NFI.

Now this isn't the biggest of problem usually, until you start doing things where you depend on the query actually going trough, raid points and joins being one such instance.
If the player doesn't actually get added to the raid, that's a big problem as 1) he will never know 2) there wont even be an error logged 3) he wont get points when the time comes.

Theres currently the returnQuery to allow for this as an alternative to query function, but its not widely used, nor am i entirely satisfied with the fact that all the error handling and parsing will then have to be done inside the function which ultimately means you'll have loads of repetitions.

The real question at this point is, should one merely enhance the returnQuery to return an array (see the new get_site for a demonstration), thus doing all the repetitive error handling in the MySQL layer, or should one do this for all the functions so that even SELECT can benefit from proper error returns. Right now the select function does not differentiate between an empty result and an error as far as the calling function is concerned. The downside is that such a change will break ALL current select calls and will require modifications.

I feel its a small price to pay to get consistent error handling across the line though even if it breaks backwards compatibility.
Were gonna end up breaking 0.2 module compatibility anyways due to the new hooking.
So while we are breaking stuff, we should take advantage of trying to fix as many broken things as possible so that we don't have to keep breaking backwards compatibility later on if it can be avoided.
« Last Edit: June 08, 2006, 08:27:33 pm by Khalem »
BeBot Founder and Fixer Kingpin

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Proposed MySQL.php changes
« Reply #1 on: June 08, 2006, 08:52:46 pm »
Returning an array with values and errorcode instead of just the values won't involve much modification. We'll just have to change all calls to $result (or whatever the variable for the return is called) to $result['return']. Or something similar.

Or if the result is used too often, use a temp var for the return value, and set the old var afterwards to the array.

Basically I don't see any reason not to add decent error codes.

Even though I usually don't get any errors or warnings after the initial testing.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Proposed MySQL.php changes
« Reply #2 on: June 09, 2006, 01:35:04 am »
It's not a hard modification to do in terms of the modules, just extensive :)
BeBot Founder and Fixer Kingpin

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Proposed MySQL.php changes
« Reply #3 on: June 09, 2006, 04:08:20 am »
If something like my tablename functions are added, all db calls have to be modified anyways.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Proposed MySQL.php changes
« Reply #4 on: June 09, 2006, 12:44:47 pm »
Tablenames are going in as soon as i get around to it, and yes, my thoughts on MySQL error handling have been one of the reasons i haven't done it yet.
BeBot Founder and Fixer Kingpin

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Proposed MySQL.php changes
« Reply #5 on: June 09, 2006, 01:03:41 pm »
I vote for the same scheme you used for the get_site() function. Even the same field names would work.

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 765
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal