logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Creating tables? ...and other n00b questions

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
Squatting Monk



Joined: 28 Jun 2007
Posts: 76

PostPosted: Mon Jul 23, 2007 23:01    Post subject: Creating tables? ...and other n00b questions Reply with quote

Before I air my frustrations, let me say thank you to all the folks who have put so much time and effort into developing this awesome tool. It makes possible so many things we could not do before and really helps to breathe life into an old game.

Also, I need to specify that I am using NWNX2 for NWN1, utilizing the SQLite database. I have no real experience with SQLite, except for going through a book I purchased and doing stuff from within the command line interface. In light of that, please assume I am a complete moron when it comes to wording your answers. Thanks. Laughing

Okay, I've been wondering what would be the best way to set up the tables for the database. The demo module thoroughly confused me since it's deleting a table and then creating a new one before inserting a new record. Now, I know I don't want to do that every time I go to add a new record to the database, since it will destroy any data already had in the table, right? So basically I want to have permanent tables that will never be destoryed. But this also means that I don't want to have them created, say, in the OnModuleLoad event, since that will erase everything I already had after the module resets, yes? Should I create them through the command line interface beforehand and then just have records inserted into the rows via NWNX? If I do this, will there be any problems I might have as a result of not continuously deleting and creating tables? How is this supposed to work in a PW according to the intent of the creators?

Thanks for any help, and I look forward to integrating this awesome tool into my upcoming PW.
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Tue Jul 24, 2007 12:29    Post subject: Reply with quote

For NWNX2, the idea is to customize the aps_demo module for your database type (SQLite is default so you do not have to do anything) and then run it once to get your basic table structure created. You can play around with the levers a bit to see how the tables can be used from scripting.

In your own module, you would only use the functions from aps_include, i.e. reading and writing to the tables. You do not recreate them every time, since as you already figured, that would make no sense.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group