NWN/SQL question

Moderator: Event DM

Post Reply
User avatar
Deider
Demigod of Posts
Posts: 13259
Joined: Sun May 11, 2003 12:33 pm
Timezone: GMT -8
Location: California

NWN/SQL question

Post by Deider » Mon Nov 14, 2005 2:28 pm

A quick question – is it possible to make a script in NWN that will automatically create a new database table for you?
Czarcasm
Team Member; Retired with Honors
Posts: 1724
Joined: Tue Nov 09, 2004 2:55 pm
Timezone: GMT-6
Location: St. Louis, MO

Post by Czarcasm » Mon Nov 14, 2005 2:36 pm

Yes. You can see an example of this in the NWNX2 test mod. It just uses the SQLExecDirect() statement.

You would have to make a script like:

Code: Select all

#include "aps_include"

void main(){

    string sSQL = "CREATE TABLE STATEMENT";
    SQLExecDirect(sSQL);

}
User avatar
PlasmaJohn
CCC / Release Admin
CCC / Release Admin
Posts: 9010
Joined: Fri Dec 26, 2003 10:37 pm
Timezone: US/Eastern
Location: Negaria
Contact:

Re: NWN/SQL question

Post by PlasmaJohn » Mon Nov 14, 2005 4:58 pm

Deider wrote:A quick question – is it possible to make a script in NWN that will automatically create a new database table for you?
:shock: Only if you have to, as in, if there isn't an existing admin staff and you don't have any other way of creating tables. It's a fairly invasive thing to do, some admins would get a little bent if that should happen without their knowledge.

Not saying that's what you're trying to do of course.
Calvin: This is so cool!
Hobbes: This is so stupid.
User avatar
Deider
Demigod of Posts
Posts: 13259
Joined: Sun May 11, 2003 12:33 pm
Timezone: GMT -8
Location: California

Re: NWN/SQL question

Post by Deider » Mon Nov 14, 2005 6:41 pm

PlasmaJohn wrote:Not saying that's what you're trying to do of course.
It's for the holes. Something I'm playing around with in between fishing trips and Matlock reruns. Just wondering if you could set it up so that a table would be made automatically for the buyer when they buy a hole.
User avatar
Tesh
Scholar
Posts: 1421
Joined: Thu Jan 13, 2005 10:58 am
Timezone: GMT +12
Location: Auckland, New Zealand
Contact:

Post by Tesh » Mon Nov 14, 2005 7:35 pm

you'd create a whole new table for a new PC hole?

Can't say that's 'wrong' without a better understanding, but IMO for this kind of thing shouldn't all PC holes just have their own rows in the PCHole table?
Roland of Gilead wrote: I told you we deal in lead, and so we do. But that doesn't make us hired guns.
Belkar wrote: One order of gluttony with a side of coriuption, please.
User avatar
Deider
Demigod of Posts
Posts: 13259
Joined: Sun May 11, 2003 12:33 pm
Timezone: GMT -8
Location: California

Post by Deider » Tue Nov 15, 2005 10:48 am

T'orth wrote:Can't say that's 'wrong' without a better understanding, but IMO for this kind of thing shouldn't all PC holes just have their own rows in the PCHole table?
:shock:

This is why I rode the short bus to school.

Actually, not sure if that will work - need to look at some code...
Post Reply