Raised This Month: $51 Target: $400
 12% 

Fix the mixed SteamIDs in your database


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 08-24-2014 , 20:39   Fix the mixed SteamIDs in your database
Reply With Quote #1

There were a lot of people who flipped out about the recent steamid change in tf2.
A lot of them have mixed steamids in their database or used scripts to convert them on purpose before the issue was handled in the snapshots.
A few specific tools for specific problems were released (mostly to convert to the new steamid), but i think this is more flexible, at least for mysql specific stuff.
I've written 2 mysql functions to convert from the old to the new format and vise versa. I'm not terrible experienced in writing mysql functions, so please be kind to me.
Before you begin, i take no responsibility for any damage done to your data.

Log into your phpmyadmin account or use your favorite mysql client and execute/import the attached file.

Lets say you have a table named sometable that looks like this:


To convert the new steamids to old ones you can use this query
PHP Code:
UPDATE sometable AS t
    SET t
.somesteamid SteamID3ToSteamID(t.somesteamid)
WHERE
    t
.somesteamid LIKE '[U:1:%' 
This converts all new steamids (ones that begin with '[U:1:') to the old format.

To convert old id's to the new format (which you probably shouldn't do) you would use this query:
PHP Code:
UPDATE sometable AS t
    SET t
.somesteamid SteamIDToSteamID3(t.somesteamid)
WHERE
    t
.somesteamid LIKE 'STEAM_%' 
That's about it.

Remember to replace sometable with your table name and somesteamid with the field that contains steamids.
For sourcebans that would, by default, be the sb_bans table and the authid field.
Attached Images
File Type: jpg img1.jpg (13.0 KB, 418 views)
Attached Files
File Type: txt amsteamid.sql.txt (971 Bytes, 205 views)
__________________

Last edited by Impact123; 08-24-2014 at 20:55.
Impact123 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:07.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode