1. Database OK?
- Posted by Lone_EverGreen_Ranger Mar 04, 2010
- 1557 views
Hello,
I'm wondering if I'm going about this database thing correctly.
procedure FrostDatabase() buffer = db_open(file,DB_LOCK_NO) if buffer = DB_OPEN_FAIL then buffer = db_create(file,DB_LOCK_NO) if buffer = DB_OK then if db_create_table("FROSTDATA") != DB_OK then buffer = message_box("Could not create data table","Database Error",MB_TASKMODAL) elsif buffer = DB_OK then buffer = db_insert(HEROES,iheroes) buffer = db_insert(ENEMIES,ienemies) buffer = db_insert(BOSSES,ibosses) buffer = db_insert(VEHICLES,ivehicles) buffer = db_insert(ITEMS,iitems) buffer = db_insert(ELEMENTS,ielements) buffer = db_insert(ATTRIBUTES,iattributes) buffer = db_insert(WEAPONS,iweapons) buffer = db_insert(NPCS,inpcs) buffer = db_insert(SHOPS,ishops) buffer = db_insert(ATTACKS,iattacks) buffer = db_insert(SPELLS,ispells) buffer = db_insert(SKILLS,iskills) buffer = db_insert(STATUS_EFFECTS,istatus) buffer = db_insert(BACK_DROPS,ibackdrops) buffer = db_insert(SUMMON_CREATURES,isummons) buffer = db_insert(CLASSES,iclasses) buffer = db_insert(HP,hp) buffer = db_insert(MP,mp) end if end if end if db_close() end procedure
I want to make sure, I'm creating and adding the data to it correctly.
2. Re: Database OK?
- Posted by mattlewis (admin) Mar 07, 2010
- 1292 views
Hello,
I'm wondering if I'm going about this database thing correctly.
I want to make sure, I'm creating and adding the data to it correctly.
It's hard to say, without knowing what you're trying to do. It looks like you're putting everything into one table, which seems a little odd to me.
Matt
3. Re: Database OK?
- Posted by Lone_EverGreen_Ranger Mar 07, 2010
- 1403 views
Hmm, Well why is it odd to put everything into one table?
4. Re: Database OK?
- Posted by irv Mar 08, 2010
- 1224 views
Hmm, Well why is it odd to put everything into one table?
Because it would be faster and easier to use an associative list?
A database is normally used when you have multiple records, each containing similar (but not the same) data.
Your example shows one record, with named fields which, presumably, you want to use to store & lookup data values.
5. Re: Database OK?
- Posted by mattlewis (admin) Mar 09, 2010
- 1211 views
Hmm, Well why is it odd to put everything into one table?
Typically, a table represents similar data, like Irv mentioned. So each row you entered would probably be its own table. So you'd have a HERO table, where each record was a different hero, etc.
What you've done is fairly reasonable for storing a little bit of data that just needs to be read in all at once. EDS tables are really just associative arrays.
Matt