View previous topic :: View next topic |
Author |
Message |
DM_Vecna
Joined: 10 Feb 2010 Posts: 37
|
Posted: Sun Apr 11, 2010 8:18 Post subject: best data types for table |
|
|
I am building a new table in NWNX to replace the standard Bioware factions "table" that is found in the faction editor. My idea is to keep all of the factions in the Bioware editor at 0 and on module load adjust them to the persistent values of the NWNX table.
(In case you might be wondering why I am not storing any values in the Bioware faction editor it was easier for me to write the functions with a zero starting balance and I think it will be easier to adjust the values going forward in I only have to look in NWNX instead of the sum of two values stored in two locations. )
Back to the question at hand. I am not sure what would be the best data type to store the faction (1-100) values. Bear in mind I am new to NWNX MySQL and am using MySQL Workbench which is amazing when I can figure out how something works but there is not much documentation for absolute beginners.
Currently I made a table with the data type of "TEXT" for the faction values and a default of "NULL". But when I went in to add the actual starting values by hand using Workbench's "edit data" function it is not letting me adjust the NULL values. I am not sure if NULL was a bad choice and or if TEXT was the wrong choice for the data type. I tried typing in the MySQL statement:
"update `nwn`.`tbl_factions` set `hostile`='100' where `tbl_player_ID`='1' and`tbl_player_player_character`='hostile';
but when I now look at the table the value that is supposed to read 100 reads blob.
Thank you for any help!!! |
|
Back to top |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Sun Apr 11, 2010 9:08 Post subject: |
|
|
INT or TINYINT
See MySQL documentation on data types for more info. _________________ In Soviet Russia, NWN plays you! |
|
Back to top |
|
|
DM_Vecna
Joined: 10 Feb 2010 Posts: 37
|
Posted: Tue Apr 13, 2010 3:56 Post subject: |
|
|
Thanks virusman;
After reviewing the documentation I think that tinyint will work best for my purposes.
When usign tinyint is there anything that you need to change in your nwscript to fetch it as it is an intiger? That was the only reason I was using a text datatype previously. |
|
Back to top |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Tue Apr 13, 2010 6:29 Post subject: |
|
|
int nValue = StringToInt(SQLGetData(1)); _________________ In Soviet Russia, NWN plays you! |
|
Back to top |
|
|
|