If they are different, you know more news have been added on the server and that your local database needs to be updated. It will then compare the number it get back to it’s own “last known id”. When you mobile application starts, it will call getTopId() to get the current topmost record-id from the database server. Now lets go through a possible chain of communication between the server and your mobile app. ![]() The functions would return the database rows in JSon format. This would be the bare minimum you could use to mirror a small news-feed between a client and a mobile app. Procedure UpdateRows(const aRowData: String const aAppend: Boolean) Note: this is just an example, there are must better ways of handling remote databases, but we have to start somewhere.įunction ReadRowsFromTop(const aCount: Integer):String įunction ReadRowsFromOffset(const aRecId: Int64):String Below is a hypothetical variant of such an interface. So on our server we would expose an interface that external client apps (web or native) can call to extract data. We like to use remobjects remoting framework, but you should be able to use the standard delphi webservice components to achieve the same thing – or indeed the excellent delphi on rails toolkit by Henri Gourvest. In our typical scenario we have a RPC server which supports JSON (the format browsers use to send data, a bit like XML only more compact) messages. Or at least without the 5 to 10 megabyte limitation. Once wrapped, you can create persistent (non cached) databases of any size. exe file creates it’s own browser instance, puts the browser in full-screen – and disables the security restrictions that public browsers imposes on you. Phonegap takes you generated html, javascript and css files (and any other files connected to your html) and injects it into a real. The web apps you create with Smart Mobile can be wrapped with a system called phonegap. It was created to allow you to cache data between your web-apps and your server. While 5 megabytes sounds ridicules to a delphi programmer, who is used to handle gigabytes of data in a plethora of different database engines – the browser database api was not created to be your central database solution. If the user needs more data he or she will have to manually change this. ![]() There is also the case of database size, which in most browsers is set to between 5 and 10 megabyte by default. When you create a database the file is kept in a secure section of the browser cache and is explicitly linked to your web applications url. Since this is the case you are not allowed to simply access or create a database anywhere you want. Hackers have proven that even the slightest weakness in security can be exploited, often with costly consequences for the unsuspecting user. Security and size restrictionsīrowser vendors are constantly challenged when it comes to security. Before we dig into the nitty gritty of these things, let’s familiarize ourselves with the landscape. In short, there are several database standards, but the most known are: IndexDB and Web SQL database. Internet explorer does not support this api but have other mechanisms for local data manipulation, including the ability to store data as XML. For webkit and mozilla based browser that local database is sqlite, which (behind the scene) is built into the actual browser program. Most modern browsers supports some form of local database engine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |