01.03.2016, 17:11
(
Last edited by [NWA]Hannes; 02/03/2016 at 09:21 PM.
)
I'm currently trying to learn how to script SQLite for educational purposes (to further my skill), however in the process of attempting to make a dynamic system where I've two tables, let's call them users and objects, I've ran into a problem.
The users table has a column with the type integer primary key, I would like to know how I can retrieve the value from this column and load it into a variable that assigns ownership of the object when the server is started. The ownership column in the objects table will be 0, if the object has no owner, or a number higher than 0 if an owner is assigned to said object.
Currently, the command where I assign ownership of an object is working fine, it saves the integer primary key of the user into the owner column in the objects table. However, when the server loads I want the script to check the row of the object and select the owner column, followed by sending another query which goes into the users table and extracts the name of the row that has the same integer primary key as the owner column in the owners table.
In short, I want to retrieve the name of the owner of an object when the server starts.
The users table has a column with the type integer primary key, I would like to know how I can retrieve the value from this column and load it into a variable that assigns ownership of the object when the server is started. The ownership column in the objects table will be 0, if the object has no owner, or a number higher than 0 if an owner is assigned to said object.
Currently, the command where I assign ownership of an object is working fine, it saves the integer primary key of the user into the owner column in the objects table. However, when the server loads I want the script to check the row of the object and select the owner column, followed by sending another query which goes into the users table and extracts the name of the row that has the same integer primary key as the owner column in the owners table.
In short, I want to retrieve the name of the owner of an object when the server starts.