Indexed Database
In HTML5, an indexed database is a local storage used to store and manipulate data in a client. You can implement effective searches using an index as a simple storage structure in the key-value format.
The main features of the Indexed Database API include:
- Creating a database
Use the IndexedDB.open() method to create a database. In a database, at least 1 object store must be present.
- Creating an object store
Object store is the basic storage mechanism of indexed database storage data.
You can create an object store using the createObjectStore() method. The object store contains a list of records for storing data, and a key-value list sorted according to the key in an ascending order.
An object store can derive keys from the following sources:
-
Key generator
Generates an increasing number every time a key is needed.
-
Keypath
Key is derived through a key path.
-
Value
Key is specified when a value is stored in the object store.
-
Key generator
- Managing data
You can save and access data in the object store.
The stored data creates a key, assigned to a keypath, which in turn creates a value as a JSON object.
Note Tizen supports the READ_ONLY, READ_WRITE, and VERSION_CHANGE transactions with the unsigned short type. - Creating an index
In the object store, you can use the createIndex() method to generate an index. You can search and retrieve records stored in the index using other properties than the key, as the key is not always unique. You can also retrieve records containing arrays as keys.