ULX

Author Topic: Anyone good with MySQLOO?  (Read 1267 times)

0 Members and 1 Guest are viewing this topic.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 802
  • Karma: 58
Anyone good with MySQLOO?
« on: February 25, 2018, 09:15:48 AM »
I've been using Drakehawke's MySQLoo module (Facepunch article) to handle saving for an addon I'm creating, and I was wondering if anyone was good with it. I understand the basics of how it works, and I have a basic knowledge of the SQL language, but I'm having trouble understanding one thing. According to the docs, there is a "Query.onSuccess( q, data )" function, (which I'm writing as "q:onSuccess( data )") but my question is how is that data returned?

I know it's returned in a table, but is it a sequential key-value table or is it sorted based on my query? Basically, my query is "SELECT * FROM aset" (aset is the table I've created) which has the following structure:
Code: [Select]
aset (
    username VARCHAR(50) NOT NULL,
    steamid VARCHAR(255) NOT NULL,
    exp INT NOT NULL,
    level INT NOT NULL,
    PRIMARY KEY (steamid)
)
(Yes, I know allocating 255 to the VARCHAR isn't the best practice, but if anyone could explain how much I'd need that for me that'd be great)

so if I ran the query "SELECT * FROM aset", how would then that data be sorted?

As a side note, if I included a "WHERE steamid = %s" (using string.format() on the query), would that table then be sorted in the same way or the keys being the steamid?

I tried to make this as clear as possible, let me know if you need any clarification.

EDIT: For more information, the SteamID I'm using is a SteamID64, not 32.
« Last Edit: February 25, 2018, 09:17:32 AM by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.