adjusting data transfer between app and MySQL DB

Hello!

I’m developing an app with Corona which is using SQlite DB for storing some data but I also want to implement downloading functions from mySQL Database which is have to be on some server. I tried to learn how I can solve it but all this web stuff is a little confusing for me:
web-servers;
application servers;
web-services;
and etc.

I still don’t understand the process chain:

  1. I pushing “download” button on my app (it’s pretty clear)
  2. My app starting to send some information to server (sql query packed in xml file???)
  3. Server receiving the query from my app (What kind of technologies uses for receiving and processing this query?)
  4. Then server delivers this query to mySQL DB (what kind of techologies uses for it).
  5. MySQL DB returning results to server
  6. Server packing this result into something (xml?) and sending to my app
  7. My app receiving this signal and then my app processing it and inserting it to SQlite

Am I imaginig this process right?

Please, give me a little brief about all this stuff and maybe best practising that fits Corona for solving this issues.

Sorry for my English.)
[import]uid: 106224 topic_id: 31187 reply_id: 331187[/import]

It might help to read this:

http://omnigeek.robmiracle.com/2012/04/15/using-corona-sdk-with-rest-api-services/

Basically no database administrator or IT Manager will want their MySQL databases exposed to a public network. So there has to be something sitting between the Internet and the database to restrict queries to what is allowed filter input, etc. It’s a standard rule in doing any server side programming to always assume the data/commands you receive are attempts to hack your system. You would NEVER let an app (be it a mobile device or a web page) ever write SQL directly to your database. If you did, someone you don’t control could send a lovely “DROP TABLE” command to you.

In many cases, that intermediary is an API or Application Programming Interface. You get very specific and restrictive things you can do, like “Register a user”, “login a user”, “fetch a list of items” to sell. The API takes values you send, scrubs it to make sure you’re not sending in SQL, etc. It contacts the database on a non-public port, gathers the output of the database query and then returns it to you in a standard format that your app can digest. Frequently, this intermediate code will be written in in a server side scripting language like PHP, but can be done with Ruby, Python or other similar languages.

The script will typically output the data to you in either XML or JSON. For Corona, JSON is the better format as it maps to Lua Tables quite well. Many of these API’s will run either using the SOAP or the REST protocol for authenticating data, but in very simple terms, you do standard HTTP requests like GET and POST to fetch data from the server or send data to the server.

In web terms, this would be a <form> tag and when the user clicks the submit form, it calls the webserver passes some data to it, gets the result back . For Corona, there is a specific API call called “network.request()” where you give it the URL of the web service you are hitting, if it’s a GET or POST request, a list of parameters to pass to the form and a function in your app responsible for the data that is returned.

Now if your server API can spit out JSON data (super easy with PHP), then you take the data from the server in your function and run a json.decode() call on the data and store the result in a Lua table and you have results. The blog post above basically covers this in detail.
[import]uid: 19626 topic_id: 31187 reply_id: 124737[/import]

Robmiracle, thanks a lot!!!
Your answer is very helpfull for me. I’m very grateful to you! [import]uid: 106224 topic_id: 31187 reply_id: 124744[/import]

It might help to read this:

http://omnigeek.robmiracle.com/2012/04/15/using-corona-sdk-with-rest-api-services/

Basically no database administrator or IT Manager will want their MySQL databases exposed to a public network. So there has to be something sitting between the Internet and the database to restrict queries to what is allowed filter input, etc. It’s a standard rule in doing any server side programming to always assume the data/commands you receive are attempts to hack your system. You would NEVER let an app (be it a mobile device or a web page) ever write SQL directly to your database. If you did, someone you don’t control could send a lovely “DROP TABLE” command to you.

In many cases, that intermediary is an API or Application Programming Interface. You get very specific and restrictive things you can do, like “Register a user”, “login a user”, “fetch a list of items” to sell. The API takes values you send, scrubs it to make sure you’re not sending in SQL, etc. It contacts the database on a non-public port, gathers the output of the database query and then returns it to you in a standard format that your app can digest. Frequently, this intermediate code will be written in in a server side scripting language like PHP, but can be done with Ruby, Python or other similar languages.

The script will typically output the data to you in either XML or JSON. For Corona, JSON is the better format as it maps to Lua Tables quite well. Many of these API’s will run either using the SOAP or the REST protocol for authenticating data, but in very simple terms, you do standard HTTP requests like GET and POST to fetch data from the server or send data to the server.

In web terms, this would be a <form> tag and when the user clicks the submit form, it calls the webserver passes some data to it, gets the result back . For Corona, there is a specific API call called “network.request()” where you give it the URL of the web service you are hitting, if it’s a GET or POST request, a list of parameters to pass to the form and a function in your app responsible for the data that is returned.

Now if your server API can spit out JSON data (super easy with PHP), then you take the data from the server in your function and run a json.decode() call on the data and store the result in a Lua table and you have results. The blog post above basically covers this in detail.
[import]uid: 19626 topic_id: 31187 reply_id: 124737[/import]

Robmiracle, thanks a lot!!!
Your answer is very helpfull for me. I’m very grateful to you! [import]uid: 106224 topic_id: 31187 reply_id: 124744[/import]

Hello! I learned a little more about all this stuff and I think cloud services is pretty much interesting for me. But there are many cloud services around.
Could you help me with an information about successfull service’s implementations to Corona and what cloud services fits to Corona best? Maybe some hints or advises? [import]uid: 106224 topic_id: 31187 reply_id: 125334[/import]

Hello! I learned a little more about all this stuff and I think cloud services is pretty much interesting for me. But there are many cloud services around.
Could you help me with an information about successfull service’s implementations to Corona and what cloud services fits to Corona best? Maybe some hints or advises? [import]uid: 106224 topic_id: 31187 reply_id: 125334[/import]