1. Database OK?

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.

new topic     » topic index » view message » categorize

2. Re: Database OK?

Lone_EverGreen_Ranger said...

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: Database OK?

Hmm, Well why is it odd to put everything into one table?

new topic     » goto parent     » topic index » view message » categorize

4. Re: Database OK?

Lone_EverGreen_Ranger said...

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.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Database OK?

Lone_EverGreen_Ranger said...

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu