Command Request. /SQL

Dawn of Light related news and announcements.

Moderator: Developer Team

Command Request. /SQL

Postby Overdriven » Mon Jul 02, 2007 1:30 pm

As I'm becoming more and more lazy (Well, not really the reason) lately and actually feel like logging in to do some database changes. I thought of a command which COULD actually be quite useful.
Code: Select all
Command: /sql
Usage example: /sql "UPDATE `Spell` SET `Field` = `Value`" (with the quotations around it)
PrivLevel: None. - ArrayList in the file so only certain accounts can do it, or have it work when a new priv system gets added in

Just to make stuff like setting spells easier really, so if you see a bug; you can fix in game... Most probably reasons why this is bad. But, I can see it a a good thing if done properly.[/i]
Overdriven
Inactive Staff Member
 
Posts: 1736
Joined: Wed Sep 07, 2005 8:49 pm
Website: http://www.jasonbenedetti.co.uk
Location: Surrey, UK.

Postby Etaew » Mon Jul 02, 2007 1:31 pm

You'd have to be so sure of what your entering though.
Retired DOL Enthusiast | Blog
User avatar
Etaew
Inactive Staff Member
 
Posts: 7602
Joined: Mon Oct 13, 2003 5:04 pm
Website: http://etaew.net
Location: England

Postby Overdriven » Mon Jul 02, 2007 1:35 pm

You'd have to be so sure of what your entering though.
Yeah, that's why I can see people screwing up with it. Would be a useful command, but it's not necessary. (I mean, I'd use it if I found a wrong value in game, or fix it through the DB if I didn't know the field name) - Suppose it's just to make it easier than code.

It's a catch 22 sort of thing.
Overdriven
Inactive Staff Member
 
Posts: 1736
Joined: Wed Sep 07, 2005 8:49 pm
Website: http://www.jasonbenedetti.co.uk
Location: Surrey, UK.

Postby Luhz » Wed Jul 11, 2007 5:09 pm

That would pretty much be passing the given string from the user to SQL function.

I can write this for you if you want, just put it as an admin level script and if people fail, then it's their own fault.
Luhz
Inactive Staff Member
 
Posts: 164
Joined: Sat Dec 02, 2006 8:55 pm

Postby Tolakram » Wed Jul 11, 2007 5:39 pm

Might be a good idea to log all changes, maybe via a trigger or just plain SQL and store the old values somewhere so things can be rolled back if needed.

In my opinion, for this to really be useful, you would need a way to re-read whatever gets changed so it can be tested, otherwise you might as well run DAOC in a window and do the changes in another tool.
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9189
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA

Postby Luhz » Wed Jul 11, 2007 6:18 pm

Logging changes would only help for things that COULD be rolled back. If you're fail enough to delete a database or something like that, there's issues.

As for reading back changes, I imagine that would just be done by issuing a SELECT statement.
Luhz
Inactive Staff Member
 
Posts: 164
Joined: Sat Dec 02, 2006 8:55 pm

Postby Tolakram » Wed Jul 11, 2007 7:27 pm

That's a good point.

/sqlupdate and /sqlinsert might be a better idea than /sql

As far as logs, I wasn't clear. I mean something that will take the existing data and save it to another backup table. It's probably overkill, but always helpful.

So lets say an /sqlupdate is issued on table fred. First command would be insert into backup_fred select * from fred where ...

and then run the update on the primary table.

Like I said, probably overkill, but my job is to manage a 70G database that contains medical research data, so I'm pretty appropriately paranoid. Whenever I implement a feature that can remove data I also implement a backup table so we can recover from mistakes. It's easier that going to backups and provides that extra level of insurance.
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9189
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA

Postby Etaew » Wed Jul 11, 2007 8:06 pm

I agree with you tolakram, which is why I'm so hesitant for something as powerful as this to be written.
Retired DOL Enthusiast | Blog
User avatar
Etaew
Inactive Staff Member
 
Posts: 7602
Joined: Mon Oct 13, 2003 5:04 pm
Website: http://etaew.net
Location: England

Postby Overdriven » Wed Jul 11, 2007 9:28 pm

Don't write it, even I'm cautious about it and I'm the one who'd use it the most.

I'd rather edit the database directly.
Overdriven
Inactive Staff Member
 
Posts: 1736
Joined: Wed Sep 07, 2005 8:49 pm
Website: http://www.jasonbenedetti.co.uk
Location: Surrey, UK.


Return to “%s” Announcements

Who is online

Users browsing this forum: No registered users and 1 guest