Day 1: Querying the DB
Now that we have a majority of the data already in the Database, we now need to work out how to get meaningful information back out !
Thankfully MySQL does provide us with a way of doing this. In the following example my main database containing the DBC data and we are going to query for records for MangosZero - so tables beginning dbc0_
SELECT DISTINCT TABLE_NAME AS DBCFilename FROM information_schema.columns WHERE table_schema = 'dbc' AND table_name LIKE 'dbc0_%'
This returns a nice list of DBC filenames belonging to Zero, we can easily write a tool to read through that list and process the information.
DBCFilename
dbc0_animationdata
dbc0_areapoi
For the purpose of a demonstration of how to get the field information for a certain table, see the following query. Again we are using the database 'dbc' but this time we are looking for a specific table (dbc0_animationdata)
SELECT COLUMN_NAME,ORDINAL_POSITION,DATA_TYPE,COLUMN_TYPE FROM information_schema.columns WHERE table_schema = 'dbc' AND table_name = 'dbc0_animationdata%'
This returns the following:
"COLUMN_NAME" "ORDINAL_POSITION" "DATA_TYPE" "COLUMN_TYPE"
"AnimationDataId" "1" "int" "int(11)"
"Name" "2" "text" "text"
"WeaponFlags" "3" "int" "int(11)"
"Bodyflags" "4" "int" "int(11)"
"Flags" "5" "int" "int(11)"
"FallbackAnimationDataId" "6" "int" "int(11)"
"PreviousAnimationDataId" "7" "int" "int(11)"
For the guts of the data we need, this is everything we need... until next time
0 Comments
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now