Jump to content

mysql through lua or http


dugasz1

Recommended Posts

Hello guys.

Recently i heard this thing that it's better if i use fetchRemote for saving data.

So, if the client have to save something to the mysql database instead of trigger it to the server then it saves it with dbQuery/dbExec (then trigger back if it's a SELECT) it's better to use fetchRemote on the client and call a php script. (mta, php, mysql server are on the same host)
What do you think about it?

Edited by dugasz1
Link to comment

I tought something like inventory for example. Player join he needs the data cache it in client side. After quit data need to be sended to the mysql server for save.

But it's all in just theory. So which is the faster? 

And another question: Should i use one or more mysql connection?

Link to comment
  • MTA Team

It'll generally be slower, due to the additional overhead of calling a php script, which then needs to do the same work as MTA would do using dbQuery. Also allowing the client to save data via a web request is a terrible idea, because you're opening your server to allowing any client to store any information in the database (as I could just go ahead and use my Browser to store data, rather than the MTA client).

Edited by sbx320
  • Like 1
Link to comment

Thank you for yours answere. I will avoid the http solution.
 

And Bonsai answere makes a question in me. If i cache a data on client from mysql when it connects (because it will be used frequently ) then i should store this in element data? Not in a simple variable?
So if the client lost connection then i can send the data to the mysql without the client? And which element should i use to store data?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...