Jump to content
  • entries
    7
  • comments
    0
  • views
    3719

Day 1: Querying the DB


antz

1631 views

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use