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 
 
Proper table layout for NWNX4/MySQL?

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Development
View previous topic :: View next topic  
Author Message
Katy



Joined: 16 Jan 2007
Posts: 17

PostPosted: Tue Jan 16, 2007 23:07    Post subject: Proper table layout for NWNX4/MySQL? Reply with quote

The example provided in the NWNX4 installation guide (here, in section 3.a), and the example script in Grinning Fool's MySQL (here), give slightly different column definitions for the NWNX4 table.

Which is most correct?

In particular, there are conflicts between the 'val' column (varchar(64) vs. text), the 'expire' column (smallint(5) unsigned vs. int(11)), and 'last' (timestamp(14) vs. timestamp).

Since the columns are different widths, I'm concerned that the wrong data may be stored or something might be truncated, but I don't really know enough about SQL to make an intelligent determination as to which is correct.
Back to top
View user's profile Send private message
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Tue Jan 16, 2007 23:19    Post subject: Re: Proper table layout for NWNX4/MySQL? Reply with quote

Katy wrote:
The example provided in the NWNX4 installation guide (here, in section 3.a), and the example script in Grinning Fool's MySQL (here), give slightly different column definitions for the NWNX4 table.

Which is most correct?

In particular, there are conflicts between the 'val' column (varchar(64) vs. text), the 'expire' column (smallint(5) unsigned vs. int(11)), and 'last' (timestamp(14) vs. timestamp).

Since the columns are different widths, I'm concerned that the wrong data may be stored or something might be truncated, but I don't really know enough about SQL to make an intelligent determination as to which is correct.


Good catch; I would say "text" is correct; timestamp v timestamp(14) doesn't matter. I'm not certain about "expire", as I'm not sure how the column is used.
_________________
Khalidine, a NWN2 persistent world

Looking for volunteers.
Back to top
View user's profile Send private message
caloup



Joined: 29 Sep 2006
Posts: 59
Location: albi (france)

PostPosted: Wed Jan 17, 2007 6:12    Post subject: Reply with quote

There is no official "table creation" for nwnx4 for the moment, you could modify the column according to how you're using nwnx/mysql...

I've taken the pwdata creation table in NWNX-Fast french and it work perfectly (i have tested with nwnx4)...
I will modify the documentation when an "official method" appear...

I'm not agree with grinning fool but it's "my opinion"... "varchar" could contain 255 octets while "text" 65535 octets...
it seem that varchar is faster than text and i'm not sure you will have a lot of persistent variable that could be more than 64 character...If you want to put 128 or 255, you can...
but it still my opinion... Rolling Eyes

Pap do you think about make a nwnx_buildtable that automatically create the table ?
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Thu Jan 18, 2007 1:34    Post subject: Reply with quote

Yes, there should be something that can create the pwdata table. I guess it will be a function in the DB plugins, but I haven't made up my mind about this yet. I haven't thought about the table structure either... I'd use varchar for the val column, and a smallint for the expire column (it's meant to hold a variable lifetime in days, so the number won't be huge).
_________________
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 -> Development 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