IDBObjectStore

Overview

This example shows a variety of different uses of object stores, from updating the data structure with IDBObjectStore.createIndex inside an onupgradeneeded function, to adding a new item to our object store with IDBObjectStore.add. For a full working example, see our To-do Notifications app (view example live.)

Location

 

add

Returns an IDBRequest object, and, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store. This is for adding new records to an object store.

 

method add(parvalue: dynamic; parkey: dynamic): IDBRequest

 

IDBRequest add(dynamic parvalue, dynamic parkey)

 

func add(_ parvalue: dynamic, _ parkey: dynamic) -> IDBRequest

 

IDBRequest add(dynamic parvalue, dynamic parkey)

 

Function add(parvalue As dynamic, parkey As dynamic) As IDBRequest

Parameters:

  • parvalue:
  • parkey:

autoIncrement

 

property autoIncrement: dynamic read;

 

dynamic autoIncrement { get; }

 

var autoIncrement: dynamic { get{} }

 

dynamic autoIncrement { __get; }

 

ReadOnly Property autoIncrement() As dynamic

clear

Creates and immediately returns an IDBRequest object, and clears this object store in a separate thread. This is for deleting all current records out of an object store.

 

method clear: IDBRequest

 

IDBRequest clear()

 

func clear() -> IDBRequest

 

IDBRequest clear()

 

Function clear() As IDBRequest

count

Returns an IDBRequest object, and, in a separate thread, returns the total number of records that match the provided key or IDBKeyRange. If no arguments are provided, it returns the total number of records in the store.

 

method count(parquery: dynamic): IDBRequest

 

IDBRequest count(dynamic parquery)

 

func count(_ parquery: dynamic) -> IDBRequest

 

IDBRequest count(dynamic parquery)

 

Function count(parquery As dynamic) As IDBRequest

Parameters:

  • parquery:

createIndex

Creates a new index during a version upgrade, returning a new IDBIndex object in the connected database.

 

method createIndex(parindexName: dynamic; parkeyPath: dynamic; parobjectParameters: dynamic): dynamic

 

dynamic createIndex(dynamic parindexName, dynamic parkeyPath, dynamic parobjectParameters)

 

func createIndex(_ parindexName: dynamic, _ parkeyPath: dynamic, _ parobjectParameters: dynamic) -> dynamic

 

dynamic createIndex(dynamic parindexName, dynamic parkeyPath, dynamic parobjectParameters)

 

Function createIndex(parindexName As dynamic, parkeyPath As dynamic, parobjectParameters As dynamic) As dynamic

Parameters:

  • parindexName:
  • parkeyPath:
  • parobjectParameters:

delete

returns an IDBRequest object, and, in a separate thread, deletes the store object selected by the specified key. This is for deleting individual records out of an object store.

 

method delete(parKey: dynamic): IDBRequest

 

IDBRequest delete(dynamic parKey)

 

func delete(_ parKey: dynamic) -> IDBRequest

 

IDBRequest delete(dynamic parKey)

 

Function delete(parKey As dynamic) As IDBRequest

Parameters:

  • parKey:

deleteIndex

Destroys the specified index in the connected database, used during a version upgrade.

 

method deleteIndex(parindexName: dynamic)

 

void deleteIndex(dynamic parindexName)

 

func deleteIndex(_ parindexName: dynamic)

 

void deleteIndex(dynamic parindexName)

 

Sub deleteIndex(parindexName As dynamic)

Parameters:

  • parindexName:

get

Returns an IDBRequest object, and, in a separate thread, returns the store object store selected by the specified key. This is for retrieving specific records from an object store.

 

method get(parkey: dynamic): IDBRequest

 

IDBRequest get(dynamic parkey)

 

func get(_ parkey: dynamic) -> IDBRequest

 

IDBRequest get(dynamic parkey)

 

Function get(parkey As dynamic) As IDBRequest

Parameters:

  • parkey:

getAll

Returns an IDBRequest object retrieves all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.

 

method getAll(parquery: dynamic; parcount: dynamic): IDBRequest

 

IDBRequest getAll(dynamic parquery, dynamic parcount)

 

func getAll(_ parquery: dynamic, _ parcount: dynamic) -> IDBRequest

 

IDBRequest getAll(dynamic parquery, dynamic parcount)

 

Function getAll(parquery As dynamic, parcount As dynamic) As IDBRequest

Parameters:

  • parquery:
  • parcount:

getAllKeys

Returns an IDBRequest object retrieves record keys for all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.

 

method getAllKeys(parquery: dynamic; parcount: dynamic): IDBRequest

 

IDBRequest getAllKeys(dynamic parquery, dynamic parcount)

 

func getAllKeys(_ parquery: dynamic, _ parcount: dynamic) -> IDBRequest

 

IDBRequest getAllKeys(dynamic parquery, dynamic parcount)

 

Function getAllKeys(parquery As dynamic, parcount As dynamic) As IDBRequest

Parameters:

  • parquery:
  • parcount:

getKey

Returns an IDBRequest object, and, in a separate thread retrieves and returns the record key for the object in the object stored matching the specified parameter.

 

method getKey(parkey: dynamic): IDBRequest

 

IDBRequest getKey(dynamic parkey)

 

func getKey(_ parkey: dynamic) -> IDBRequest

 

IDBRequest getKey(dynamic parkey)

 

Function getKey(parkey As dynamic) As IDBRequest

Parameters:

  • parkey:

index

Opens an index from this object store after which it can, for example, be used to return a sequence of records sorted by that index using a cursor.

 

method index(parname: dynamic): dynamic

 

dynamic index(dynamic parname)

 

func index(_ parname: dynamic) -> dynamic

 

dynamic index(dynamic parname)

 

Function index(parname As dynamic) As dynamic

Parameters:

  • parname:

indexNames

 

property indexNames: array of String read;

 

String[] indexNames { get; }

 

var indexNames: String... { get{} }

 

String[] indexNames { __get; }

 

ReadOnly Property indexNames() As String()

keyPath

 

property keyPath: dynamic read;

 

dynamic keyPath { get; }

 

var keyPath: dynamic { get{} }

 

dynamic keyPath { __get; }

 

ReadOnly Property keyPath() As dynamic

name

 

property name: String read write;

 

String name { get; set; }

 

var name: String { get{} set{} }

 

String name { __get; __set; }

 

Property name() As String

openCursor

Returns an IDBRequest object, and, in a separate thread, returns a new IDBCursorWithValue object. Used for iterating through an object store by primary key with a cursor.

 

method openCursor(parquery: dynamic; pardirection: dynamic): IDBRequest

 

IDBRequest openCursor(dynamic parquery, dynamic pardirection)

 

func openCursor(_ parquery: dynamic, _ pardirection: dynamic) -> IDBRequest

 

IDBRequest openCursor(dynamic parquery, dynamic pardirection)

 

Function openCursor(parquery As dynamic, pardirection As dynamic) As IDBRequest

Parameters:

  • parquery:
  • pardirection:

openKeyCursor

Returns an IDBRequest object, and, in a separate thread, returns a new IDBCursor. Used for iterating through an object store with a key.

 

method openKeyCursor(parquery: dynamic; pardirection: dynamic): IDBRequest

 

IDBRequest openKeyCursor(dynamic parquery, dynamic pardirection)

 

func openKeyCursor(_ parquery: dynamic, _ pardirection: dynamic) -> IDBRequest

 

IDBRequest openKeyCursor(dynamic parquery, dynamic pardirection)

 

Function openKeyCursor(parquery As dynamic, pardirection As dynamic) As IDBRequest

Parameters:

  • parquery:
  • pardirection:

put

Returns an IDBRequest object, and, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store. This is for updating existing records in an object store when the transaction's mode is readwrite.

 

method put(paritem: dynamic; parkey: dynamic): IDBRequest

 

IDBRequest put(dynamic paritem, dynamic parkey)

 

func put(_ paritem: dynamic, _ parkey: dynamic) -> IDBRequest

 

IDBRequest put(dynamic paritem, dynamic parkey)

 

Function put(paritem As dynamic, parkey As dynamic) As IDBRequest

Parameters:

  • paritem:
  • parkey:

transaction

 

property transaction: dynamic read;

 

dynamic transaction { get; }

 

var transaction: dynamic { get{} }

 

dynamic transaction { __get; }

 

ReadOnly Property transaction() As dynamic

 

autoIncrement

 

property autoIncrement: dynamic read;

 

dynamic autoIncrement { get; }

 

var autoIncrement: dynamic { get{} }

 

dynamic autoIncrement { __get; }

 

ReadOnly Property autoIncrement() As dynamic

indexNames

 

property indexNames: array of String read;

 

String[] indexNames { get; }

 

var indexNames: String... { get{} }

 

String[] indexNames { __get; }

 

ReadOnly Property indexNames() As String()

keyPath

 

property keyPath: dynamic read;

 

dynamic keyPath { get; }

 

var keyPath: dynamic { get{} }

 

dynamic keyPath { __get; }

 

ReadOnly Property keyPath() As dynamic

name

 

property name: String read write;

 

String name { get; set; }

 

var name: String { get{} set{} }

 

String name { __get; __set; }

 

Property name() As String

transaction

 

property transaction: dynamic read;

 

dynamic transaction { get; }

 

var transaction: dynamic { get{} }

 

dynamic transaction { __get; }

 

ReadOnly Property transaction() As dynamic

 

add

Returns an IDBRequest object, and, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store. This is for adding new records to an object store.

 

method add(parvalue: dynamic; parkey: dynamic): IDBRequest

 

IDBRequest add(dynamic parvalue, dynamic parkey)

 

func add(_ parvalue: dynamic, _ parkey: dynamic) -> IDBRequest

 

IDBRequest add(dynamic parvalue, dynamic parkey)

 

Function add(parvalue As dynamic, parkey As dynamic) As IDBRequest

Parameters:

  • parvalue:
  • parkey:

clear

Creates and immediately returns an IDBRequest object, and clears this object store in a separate thread. This is for deleting all current records out of an object store.

 

method clear: IDBRequest

 

IDBRequest clear()

 

func clear() -> IDBRequest

 

IDBRequest clear()

 

Function clear() As IDBRequest

count

Returns an IDBRequest object, and, in a separate thread, returns the total number of records that match the provided key or IDBKeyRange. If no arguments are provided, it returns the total number of records in the store.

 

method count(parquery: dynamic): IDBRequest

 

IDBRequest count(dynamic parquery)

 

func count(_ parquery: dynamic) -> IDBRequest

 

IDBRequest count(dynamic parquery)

 

Function count(parquery As dynamic) As IDBRequest

Parameters:

  • parquery:

createIndex

Creates a new index during a version upgrade, returning a new IDBIndex object in the connected database.

 

method createIndex(parindexName: dynamic; parkeyPath: dynamic; parobjectParameters: dynamic): dynamic

 

dynamic createIndex(dynamic parindexName, dynamic parkeyPath, dynamic parobjectParameters)

 

func createIndex(_ parindexName: dynamic, _ parkeyPath: dynamic, _ parobjectParameters: dynamic) -> dynamic

 

dynamic createIndex(dynamic parindexName, dynamic parkeyPath, dynamic parobjectParameters)

 

Function createIndex(parindexName As dynamic, parkeyPath As dynamic, parobjectParameters As dynamic) As dynamic

Parameters:

  • parindexName:
  • parkeyPath:
  • parobjectParameters:

delete

returns an IDBRequest object, and, in a separate thread, deletes the store object selected by the specified key. This is for deleting individual records out of an object store.

 

method delete(parKey: dynamic): IDBRequest

 

IDBRequest delete(dynamic parKey)

 

func delete(_ parKey: dynamic) -> IDBRequest

 

IDBRequest delete(dynamic parKey)

 

Function delete(parKey As dynamic) As IDBRequest

Parameters:

  • parKey:

deleteIndex

Destroys the specified index in the connected database, used during a version upgrade.

 

method deleteIndex(parindexName: dynamic)

 

void deleteIndex(dynamic parindexName)

 

func deleteIndex(_ parindexName: dynamic)

 

void deleteIndex(dynamic parindexName)

 

Sub deleteIndex(parindexName As dynamic)

Parameters:

  • parindexName:

get

Returns an IDBRequest object, and, in a separate thread, returns the store object store selected by the specified key. This is for retrieving specific records from an object store.

 

method get(parkey: dynamic): IDBRequest

 

IDBRequest get(dynamic parkey)

 

func get(_ parkey: dynamic) -> IDBRequest

 

IDBRequest get(dynamic parkey)

 

Function get(parkey As dynamic) As IDBRequest

Parameters:

  • parkey:

getAll

Returns an IDBRequest object retrieves all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.

 

method getAll(parquery: dynamic; parcount: dynamic): IDBRequest

 

IDBRequest getAll(dynamic parquery, dynamic parcount)

 

func getAll(_ parquery: dynamic, _ parcount: dynamic) -> IDBRequest

 

IDBRequest getAll(dynamic parquery, dynamic parcount)

 

Function getAll(parquery As dynamic, parcount As dynamic) As IDBRequest

Parameters:

  • parquery:
  • parcount:

getAllKeys

Returns an IDBRequest object retrieves record keys for all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.

 

method getAllKeys(parquery: dynamic; parcount: dynamic): IDBRequest

 

IDBRequest getAllKeys(dynamic parquery, dynamic parcount)

 

func getAllKeys(_ parquery: dynamic, _ parcount: dynamic) -> IDBRequest

 

IDBRequest getAllKeys(dynamic parquery, dynamic parcount)

 

Function getAllKeys(parquery As dynamic, parcount As dynamic) As IDBRequest

Parameters:

  • parquery:
  • parcount:

getKey

Returns an IDBRequest object, and, in a separate thread retrieves and returns the record key for the object in the object stored matching the specified parameter.

 

method getKey(parkey: dynamic): IDBRequest

 

IDBRequest getKey(dynamic parkey)

 

func getKey(_ parkey: dynamic) -> IDBRequest

 

IDBRequest getKey(dynamic parkey)

 

Function getKey(parkey As dynamic) As IDBRequest

Parameters:

  • parkey:

index

Opens an index from this object store after which it can, for example, be used to return a sequence of records sorted by that index using a cursor.

 

method index(parname: dynamic): dynamic

 

dynamic index(dynamic parname)

 

func index(_ parname: dynamic) -> dynamic

 

dynamic index(dynamic parname)

 

Function index(parname As dynamic) As dynamic

Parameters:

  • parname:

openCursor

Returns an IDBRequest object, and, in a separate thread, returns a new IDBCursorWithValue object. Used for iterating through an object store by primary key with a cursor.

 

method openCursor(parquery: dynamic; pardirection: dynamic): IDBRequest

 

IDBRequest openCursor(dynamic parquery, dynamic pardirection)

 

func openCursor(_ parquery: dynamic, _ pardirection: dynamic) -> IDBRequest

 

IDBRequest openCursor(dynamic parquery, dynamic pardirection)

 

Function openCursor(parquery As dynamic, pardirection As dynamic) As IDBRequest

Parameters:

  • parquery:
  • pardirection:

openKeyCursor

Returns an IDBRequest object, and, in a separate thread, returns a new IDBCursor. Used for iterating through an object store with a key.

 

method openKeyCursor(parquery: dynamic; pardirection: dynamic): IDBRequest

 

IDBRequest openKeyCursor(dynamic parquery, dynamic pardirection)

 

func openKeyCursor(_ parquery: dynamic, _ pardirection: dynamic) -> IDBRequest

 

IDBRequest openKeyCursor(dynamic parquery, dynamic pardirection)

 

Function openKeyCursor(parquery As dynamic, pardirection As dynamic) As IDBRequest

Parameters:

  • parquery:
  • pardirection:

put

Returns an IDBRequest object, and, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store. This is for updating existing records in an object store when the transaction's mode is readwrite.

 

method put(paritem: dynamic; parkey: dynamic): IDBRequest

 

IDBRequest put(dynamic paritem, dynamic parkey)

 

func put(_ paritem: dynamic, _ parkey: dynamic) -> IDBRequest

 

IDBRequest put(dynamic paritem, dynamic parkey)

 

Function put(paritem As dynamic, parkey As dynamic) As IDBRequest

Parameters:

  • paritem:
  • parkey: