Saturday, September 08, 2007

DB Frustrations

Back to the Database
 Ok, so, I'm going to hunker down and set up database objects for Effects, Abilities, Items, and Characters (in more or less that order). There's a bit of method to the mostly madness, as I'm trying to do the leaf-node objects (effect) before their containers (ability). I'll be creating a list of steps as I go (to follow for the next object).

Effect DB Schema
 Each effect has some basic characteristics which will be reflected in the database design. An effect has:

Name (oddly enough this isn't reflected in the object class)
EffectID (ditto)

Increment (clear enough)
ResultMessage (clear enough)

AffectedStatisticID (whoops! Looks like I may need to do Statistics first)
AffectedItemID (uh oh. Maybe I should start with Items?)
EffectType (this should be extracted to a separate object/table, I think)

 Let's back up here, maybe I should do another object first.

Item DB Schema
 Each item would have the following characteristics:
Name (which, unlike Effect, is reflected in the object class)
ItemID (and so is this)
Abilities (this is a collection, which would actually be in a different table.

 Ok, so Item is much easier. Let's start with that.

DB stuff
 I'm creating the table and stored procedures (no update required for items, yet). This is quite a bit to do without any tests, but the web interface the database might time out if I go back and forth. So, I'm taking slightly larger (although fairly routine) steps.

DB Files
 I'm also going to organize my files a little better (a database subdirectory with mutliple files). That can be tested (and the tests run fine).

Phew!
 Well, I haven't kept the running commentary (like I usually do), but that might be good in this case, considering that I've spent most of the session arguing unsuccessfully with the database. It's been a little frustrating, but I've finally gotten my first two operations (insert and retrieve) to work. While I'm not yet ahead, I have made some progress, so this is a good time to call it a night.