We will be undergoing scheduled maintenance on May 20th, 2013 at 02:00 GMT.
Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com�s entire library of video tutorials.
Now, let's take a look inside the Utility template and see how we're managing the database. You can see that I've renamed it up here and at the end of this sequence you'll be able to look at the code that I've developed, which is basically the template, as well as a few additions that we'll be doing in this section and the next. It's on the Work Files either on your disk or online, if you have the online subscription. So, let's take a look at it and the first thing that I want to show you is that we're using the database in a different way that we used data sources in the Browser. In the Browser, we used data sources to go either to a file or to an RSS feed and you can also go to any kind of dynamically created formatted data that adheres either to JSON or XML and use it as the dataSource and connect fields in the interface to the data model and vice versa. That's the world of data sources. The world of the internal database, the client-side storage or cache is very different because, as I said before, it's not shared. The whole point of using the Browser is going out and getting shared data either from an RSS feed or from a file, so it's data that a number of people can access at the same time. Here, we are only accessing our own data and it's not sharable although the app itself can share it in various ways. But the database is a single user database built into the iPhone operating system. It's SQLite. And so let's see how we interact with that. I'm going to come over here and I can show the data sources that are built into the template. And as you've seen before, this template works. I can save text. I can save fonts. Everything works properly. So, let me look at data sources. I have this one dataSource and this is the default dataSource. There is no URL. There is no name of it. There is no content. Nothing is connected to it and yet the app still runs and that's because we're not using a dataSource here. We are not connecting fields in the interface to elements in the data model. We are using the built-in database and we are accessing it through code, and I'm going to show you the code that is used and walk you through it. We're getting ever closer to actually writing some code, but we still don't need to write code to any great extent to use this database. And the reason is that what you'll see as I walk you through the code is that deep inside the iPhone operating system and in fact, Mac OS X, deep inside those operating systems, we have a section called Core Data that manages persistent data storage often with SQLite. And so, an app can come in or a Desktop application can come in and use the database store and retrieve data temporarily on an as needed basis without sharing it across the network. It's just for the apps use, but it has all of the structure of the database because in fact, it is a database, so it's easier to program. So this is all built-in; we don't have to worry about that. It's there. You can use it or not as you see fit. You will see that there's a Utility JavaScript program that is incorporated in this template that provides the access to that SQLite database and there's code there that we don't really need to worry about. Then there's a layer above that. That is the apps specific layer where we actually, for example, will be storing Ñ let me just come up here and run this Ñ where we actually will be storing the color, the size of the font and the specific font that we're using here. So all that will be stored in the database and there will be calls in this app that go from the interface to routines in the app that will handle the storage and those routines in the app call the Utility code that is brought in as part of the app and that's a code that you're not going to change and that will go deep down into the operating system to manage the actual storage. So that's what we're going to look at. We're going to look at the top layer, the code that is in the app and that you can modify and it's just going to be a matter of saving rather than the color perhaps, the style of the font. And what happens beneath that Utility code and the operating system interface to SQLite? That you don't need to worry about, but we will later on go on and look at that. So, in this section what we're going to do is look at how the interface interacts with the basic functions and we're not going through data sources; this is part of code. So, let's take a look at what's going on here.
| Course: | Developing iPhone Web Apps |
| Author: | Jesse Feiler |
| SKU: | 34075 |
| ISBN: | 1-935320-89-0 |
| Release Date: | 2009-12-31 |
| Duration: | 8 hrs / 103 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |