Hello,
Does SFS2x server-side support retrieving data: UUID and JSON from database?
I tried many times but it didn't work. My database is Postgres.
Thank you.
UUID and JSON - SELECT SQL
Re: UUID and JSON - SELECT SQL
Hi,
a UUID or JSON are essentially text, if you store them as such in the DB there should be no problems.
If you're expecting these objects to translate to specific Java objects auto-magically then the answer is no, but you can always query the database directly via JDBC.
Take a look here, for instance:
https://smartfoxserver.com/blog/using-a ... st-part-3/
Cheers
a UUID or JSON are essentially text, if you store them as such in the DB there should be no problems.
If you're expecting these objects to translate to specific Java objects auto-magically then the answer is no, but you can always query the database directly via JDBC.
Take a look here, for instance:
https://smartfoxserver.com/blog/using-a ... st-part-3/
Cheers
Re: UUID and JSON - SELECT SQL
Lapo wrote:Hi,
a UUID or JSON are essentially text, if you store them as such in the DB there should be no problems.
If you're expecting these objects to translate to specific Java objects auto-magically then the answer is no, but you can always query the database directly via JDBC.
Take a look here, for instance:
https://smartfoxserver.com/blog/using-a ... st-part-3/
Cheers
Hi,
I used: postgresql-42.7.1 and "lac" login assistant. But it can't get json or uuid data. especially I'm interested in uuid. Because some 3rd party authentication providers use UUID as an id for the user.
Did I miss anything? or the login assistant does not support UUID for username and nickname.
Thank
Re: UUID and JSON - SELECT SQL
If this UUID is stored as a String I see no problem in using it. Otherwise if it uses some kind of DB-specific type it can be a problem, because our API only support a subset of types that are common among different DBs.
Cheers
Cheers
Re: UUID and JSON - SELECT SQL
Lapo wrote:If this UUID is stored as a String I see no problem in using it. Otherwise if it uses some kind of DB-specific type it can be a problem, because our API only support a subset of types that are common among different DBs.
Cheers
Hi,
I want to talk about UUID format in database.
I tried several ways but couldn't read the "lac" Login Assistant test.
Re: UUID and JSON - SELECT SQL
To read UUID from Postgre, make the query as normal, then cast it from object out of the result set
JSON is just a string,
If you're using org.json
then you can pull your json properties like normal for example.
Code: Select all
var myId = result.getObject("columnName", java.util.UUID.class);JSON is just a string,
Code: Select all
var jsonString = result.getString("jsonColumnName");If you're using org.json
Code: Select all
var jsonObj = new JSONObject(result.getString("jsonColumnName"));then you can pull your json properties like normal
Code: Select all
var playerName = jsonObj.get("player_name");