@michael.peiffer… and others. Most of the time, you are not going to be connecting your app directly to you online/corporate database. Most of the time you’re going to have some set of web accessible database controllers to access.
While you will see that Corona SDK can connect to an SQLite database, that database is local to your device and is used to store app/game data that your app/game needs on a constant basis. Think of it as local storage only. What you’re describing is access databases located elsewhere.
Now most database servers like MySQL MSSQL and others can be access via TCP/IP calls directly to their server port, and Corona SDK has good TCP/IP socket layer calls, lets face it, thats a lot of low level system programming that most of us don’t want to do.
What is easier is to use standard HTTP GET and PUT calls to a web server where some PHP, ASP or other web based data access scripts exist.
Locally in your app, you use the “network.request()” API call to request a script on your server that will connect to your database, retrieve the object and return the data is a well defined data format, like XML or JSON then you will parse that data and display it in your app.
I know this is a bunch of techno mumbo-jumbo
But it’s really pretty straight forward. Lets say you want to get a list of users between 18 and 25 in your database:
App does an network.request(“http://yoursite.com/getusers.php?minage=18&maxage=25”, “GET”, functionToRunWhenDataIsFetched)
You have a PHP script on your server called getusers.php and it takes some HTTP GET parameters on minage and maxage. It connects to your database, does the query and then puts all that information in a PHP array. The last line of that script does an:
echo(json_encode($userdata)); // assuming $userdata is the array of users…
When that request finishes, your app will automatically call a Corona function you wrote called “functionToRunWhenDataIsFetched(event)” and passes a table called “event” to it.
In that event table is an entry called response. So you end up doing:
local myUserData = json.decode(entry.response)
and now you magically have a Lua/Corona table of all your users all nicely organized for you.
You can then run a “for” loop over that data, shove it into a widget.tableView and voila - you have a business app.
As far as android goes, most of the current widget look is very iOS in style, but I think it works on android.
Rob
[import]uid: 19626 topic_id: 21110 reply_id: 83832[/import]