Multiple Database Files
Moderator: Team Members
- Scatman
- Retired
- Posts: 1688
- Joined: Wed Apr 16, 2008 5:44 am
- EQ2Emu Server: Scatman's Word
- Characters: Scatman
- Location: New Jersey
Multiple Database Files
I was thinking today. You know how we have a WorldDatabase.cpp and a RulesDB.cpp? Would you be opposed to moving everything in RulesDB.cpp into WorldDatabase.cpp BUT! keeping the Rules database functions in a separate file (like RulesDB.cpp)? This way, we don't have 20+ different classes handling database functions. We would still only have database.myfunction(), but the actual functions would be spread across different files, in their respectful places.
So if your intentions for splitting it up were to just organize the code better, I think it'd still be best to keep all database functions in one class, across multiple files? Whatcha think?
So if your intentions for splitting it up were to just organize the code better, I think it'd still be best to keep all database functions in one class, across multiple files? Whatcha think?
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
Re: Multiple Database Files
That sounds perfect, Scatto. The only thing I was after with the new *DB file(s) was to stop WorldDatabase.cpp from growing to an unmanageable confusing mess that it is today.
If you can leave the functions in their own files, YET still have them under the WorldDatabase database class, then certainly go for it!
Great idea.
If you can leave the functions in their own files, YET still have them under the WorldDatabase database class, then certainly go for it!
Great idea.
- Scatman
- Retired
- Posts: 1688
- Joined: Wed Apr 16, 2008 5:44 am
- EQ2Emu Server: Scatman's Word
- Characters: Scatman
- Location: New Jersey
Re: Multiple Database Files
Nope no locking needed. The locking is handled by the guild functions. However, I would get rid of the reload all guilds. All you need to do is:
Build a GuildMember* struct using the fields that go into the database table for the new guildmember.
Then call Guild::AddGuildMember(GuildMemeber *gm);
Build a GuildMember* struct using the fields that go into the database table for the new guildmember.
Then call Guild::AddGuildMember(GuildMemeber *gm);
Code: Select all
GuildMember *gm = new GuildMember;
gm->blah = blah;
gm->blah = blah;
Query to insert the guild member
guild->AddGuildMember(gm);- Scatman
- Retired
- Posts: 1688
- Joined: Wed Apr 16, 2008 5:44 am
- EQ2Emu Server: Scatman's Word
- Characters: Scatman
- Location: New Jersey
Re: Multiple Database Files
Crap. Wrong thread 
- Scatman
- Retired
- Posts: 1688
- Joined: Wed Apr 16, 2008 5:44 am
- EQ2Emu Server: Scatman's Word
- Characters: Scatman
- Location: New Jersey
Re: Multiple Database Files
Done and committed.
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
Re: Multiple Database Files
I would like to go retrofit our other new "DB" files to this new concept. I'll take a crack at it today, and when I fail, pass it off to you, Scatman 
- Scatman
- Retired
- Posts: 1688
- Joined: Wed Apr 16, 2008 5:44 am
- EQ2Emu Server: Scatman's Word
- Characters: Scatman
- Location: New Jersey
Re: Multiple Database Files
shoot for the stars!
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
Re: Multiple Database Files
k, as I said in IRC last night, I have a butt-load of changes I've made relating to this.
- I have moved Guilds into their own folder
- Created a GuildDB.cpp, and moved all functions out of WorldDatabase (per above)
- Built DB files for Tradeskills, Collections and Commands and will move what I can there tonight
- Retrofitted RecipesDB
- and a bunch of other stuff, logging (of course) etc.
Once I test the Server Guild stuff tonight, I will commit. Strongly suggest everyone update soon after, so we don't have conflicts.
- I have moved Guilds into their own folder
- Created a GuildDB.cpp, and moved all functions out of WorldDatabase (per above)
- Built DB files for Tradeskills, Collections and Commands and will move what I can there tonight
- Retrofitted RecipesDB
- and a bunch of other stuff, logging (of course) etc.
Once I test the Server Guild stuff tonight, I will commit. Strongly suggest everyone update soon after, so we don't have conflicts.
- Scatman
- Retired
- Posts: 1688
- Joined: Wed Apr 16, 2008 5:44 am
- EQ2Emu Server: Scatman's Word
- Characters: Scatman
- Location: New Jersey
Re: Multiple Database Files
Sweet! Will do. I like this implementation of the database functions much better. It would've been crazy having so many classes for each "system".
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
Re: Multiple Database Files
Right, very good call, Scatto. And I still get my anal-retentive-control-freakish-separation-of-files I want so obsessively.
Who is online
Users browsing this forum: No registered users and 0 guests