Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2012 Google Inc.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License"); you may not
   * use this file except in compliance with the License. You may obtain a copy of
   * the License at
   * 
   * http://www.apache.org/licenses/LICENSE-2.0
   * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  * License for the specific language governing permissions and limitations under
  * the License.
  */
 package elemental.html;
 
 import  elemental.html.*;
 
 import java.util.Date;

The IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data.

Inherits from: EventTarget

 
 public interface IDBIndex {
 
 
   boolean isMultiEntry();
 
   String getName();
 
 
   boolean isUnique();


  

Returns an IDBRequest object, and in a separate thread, returns the number of records within a key range. For example, if you want to see how many records are between keys 1000 and 2000 in an object store, you can write the following: var req = store.count(IDBKeyRange.bound(1000, 2000));

IDBRequest count (
in optional any key
) raises (IDBDatabaseException);
Parameters
key
The key or key range that identifies the record to be counted.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise a IDBDatabaseException with the following code:

AttributeDescription
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.
 
   IDBRequest count();


  

Returns an IDBRequest object, and in a separate thread, returns the number of records within a key range. For example, if you want to see how many records are between keys 1000 and 2000 in an object store, you can write the following: var req = store.count(IDBKeyRange.bound(1000, 2000));

IDBRequest count (
in optional any key
) raises (IDBDatabaseException);
Parameters
key
The key or key range that identifies the record to be counted.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise a IDBDatabaseException with the following code:

AttributeDescription
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.
 
   IDBRequest count(IDBKeyRange range);


  

Returns an IDBRequest object, and in a separate thread, returns the number of records within a key range. For example, if you want to see how many records are between keys 1000 and 2000 in an object store, you can write the following: var req = store.count(IDBKeyRange.bound(1000, 2000));

IDBRequest count (
in optional any key
) raises (IDBDatabaseException);
Parameters
key
The key or key range that identifies the record to be counted.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise a IDBDatabaseException with the following code:

AttributeDescription
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.
  IDBRequest count(Object key);


  

Returns an IDBRequest object, and, in a separate thread, finds either:

  • The value in the referenced object store that corresponds to the given key.
  • The first corresponding value, if key is a key range.

If a value is successfully found, then a structured clone of it is created and set as the result of the request object.

Note: This method produces the same result for: a) a record that doesn't exist in the database and b) a record that has an undefined value. To tell these situations apart, call the openCursor() method with the same key. That method provides a cursor if the record exists, and not if it does not.

IDBRequest get (
in any key
) raises (IDBDatabaseException);
Parameters
key
The key or key range that identifies the record to be retrieved.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.

Returns an IDBRequest object, and, in a separate thread, finds either:

  • The value in the index that corresponds to the given key
  • The first corresponding value, if key is a key range.

If a value is successfully found, then a structured clone of it is created and set as the result of the request object.

Note: This method produces the same result for: a) a record that doesn't exist in the database and b) a record that has an undefined value. To tell these situations apart, call the openCursor() method with the same key. That method provides a cursor if the record exists, and not if it does not.

IDBRequest getKey (
in any key
) raises (IDBDatabaseException);
Parameters
key
The key or key range that identifies the record to be retrieved.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise a IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.

Returns an IDBRequest object, and, in a separate thread, finds either:

  • The value in the index that corresponds to the given key
  • The first corresponding value, if key is a key range.

If a value is successfully found, then a structured clone of it is created and set as the result of the request object.

Note: This method produces the same result for: a) a record that doesn't exist in the database and b) a record that has an undefined value. To tell these situations apart, call the openCursor() method with the same key. That method provides a cursor if the record exists, and not if it does not.

IDBRequest getKey (
in any key
) raises (IDBDatabaseException);
Parameters
key
The key or key range that identifies the record to be retrieved.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise a IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.
  IDBRequest getKey(Object key);


  

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to a structured clone of the referenced value.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to a structured clone of the referenced value.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to a structured clone of the referenced value.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.
  IDBRequest openCursor(IDBKeyRange rangeString direction);


  

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to a structured clone of the referenced value.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to a structured clone of the referenced value.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.
  IDBRequest openCursor(Object keyString direction);


  

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to a structured clone of the referenced value.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.
  IDBRequest openCursor(IDBKeyRange rangeint direction);


  

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to a structured clone of the referenced value.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.
  IDBRequest openCursor(Object keyint direction);


  

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range, as arranged by this index. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to the value of the found record.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openKeyCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range, as arranged by this index. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to the value of the found record.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openKeyCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range, as arranged by this index. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to the value of the found record.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openKeyCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.
  IDBRequest openKeyCursor(IDBKeyRange rangeString direction);


  

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range, as arranged by this index. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to the value of the found record.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openKeyCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range, as arranged by this index. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to the value of the found record.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openKeyCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.
  IDBRequest openKeyCursor(Object keyString direction);


  

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range, as arranged by this index. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to the value of the found record.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openKeyCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.
  IDBRequest openKeyCursor(IDBKeyRange rangeint direction);


  

Returns an IDBRequest object, and, in a separate thread, creates a cursor over the specified key range, as arranged by this index. The method sets the position of the cursor to the appropriate record, based on the specified direction.

  • If the key range is not specified or is null, then the range includes all the records.
  • If at least one record matches the key range, then a success event is fired on the result object, with its result set to the new IDBCursor object; the value of the cursor object is set to the value of the found record.
  • If no records match the key range, then then an error event is fired on the request object, with its code set to NOT_FOUND_ERR and a suitable message.
IDBRequest openKeyCursor (
in optional any? range, 
in optional unsigned short direction
) raises (IDBDatabaseException);
Parameters
range
Optional. The key range to use as the cursor's range.
direction
Optional. The cursor's required direction. See IDBCursor Constants for possible values.
Returns
IDBRequest
A request object on which subsequent events related to this operation are fired.
Exceptions

This method can raise an IDBDatabaseException with the following code:

AttributeDescription
TRANSACTION_INACTIVE_ERRThe index's transaction is not active.
DATA_ERRThe key parameter was not a valid value.
NOT_ALLOWED_ERRThe request was made on a source object that has been deleted or removed.
  IDBRequest openKeyCursor(Object keyint direction);
New to GrepCode? Check out our FAQ X