Author Topic: MySQL Basics  (Read 457 times)

Legacy_Werehound Silverfang

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
MySQL Basics
« on: November 26, 2010, 10:40:12 am »


               So I;ve got NWNx2 set up and running on my ser ver. I want to start using MySQL databases for storage, as the original Bioware DBs just keep growing.... and growing..... and growing.....

It's all connected, nwnx_odbc is responding (so the log says). Now how do I start using it?

How do I send commands from the server to the databases? How do I create the databases, tables, etc?

I'm looking to create databases based off of CD key, to hold things ranging from persistently stored gold in a bank, to strings of item resrefs for persistently stored bank items.

And of course the odd variable or two tied to specific characters for quest purposes.


Any info out there to help me get started?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
MySQL Basics
« Reply #1 on: November 26, 2010, 11:06:51 am »


               There are several new functions for basic operations in aps_include script that comes with nwnx_odbc2.



just add the



#include "aps_include"



line in top of your script and they will apppear in the right menu list. They start with SetPersistent*



That will allow you almost everything.



If you want to create tables or make more elaborate selects from NWScript, you must use SQLExecDirect function like:



SQLExecDirect("SELECT * FROM table_name WHERE player='ShaDoOoW'");



and you get data from SQLFetch function, well you will lear more from aps_include file. Just took inside those default SetPersistent functions. If you are experienced enough, you will be able to make advanced things based on that.
               
               

               
            

Legacy_Werehound Silverfang

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
MySQL Basics
« Reply #2 on: November 26, 2010, 11:13:06 am »


               Didn't think it was *that* simple. Looking into the include file itself... holy cow. i feel dumb.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
MySQL Basics
« Reply #3 on: November 27, 2010, 05:28:21 am »


               If you want more detailed assistance, you can always yim me (my address is on the HG forums). Also have a look at this site:

http://dev.mysql.com.../functions.html



If you have any questions about anything you've seen done on HG, feel free to ask.



Funky