elemental.html.IDBCursor Maven / Gradle / Ivy
/*
* 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.events.*;
import elemental.util.*;
import elemental.dom.*;
import elemental.html.*;
import elemental.css.*;
import elemental.stylesheets.*;
import java.util.Date;
/**
* The IDBCursor
interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database.
*/
public interface IDBCursor {
/**
* The cursor shows all records, including duplicates. It starts at the lower bound of the key range and moves upwards (monotonically increasing in the order of keys).
*/
static final int NEXT = 0;
/**
* The cursor shows all records, excluding duplicates. If multiple records exist with the same key, only the first one iterated is retrieved. It starts at the lower bound of the key range and moves upwards.
*/
static final int NEXT_NO_DUPLICATE = 1;
/**
* The cursor shows all records, including duplicates. It starts at the upper bound of the key range and moves downwards (monotonically decreasing in the order of keys).
*/
static final int PREV = 2;
/**
* The cursor shows all records, excluding duplicates. If multiple records exist with the same key, only the first one iterated is retrieved. It starts at the upper bound of the key range and moves downwards.
*/
static final int PREV_NO_DUPLICATE = 3;
/**
* On getting, returns the direction of traversal of the cursor. See Constants for possible values.
*/
String getDirection();
/**
* Returns the key for the record at the cursor's position. If the cursor is outside its range, this is undefined
.
*/
Object getKey();
/**
* Returns the cursor's current effective key. If the cursor is currently being iterated or has iterated outside its range, this is undefined
.
*/
Object getPrimaryKey();
/**
* On getting, returns the IDBObjectStore
or IDBIndex
that the cursor is iterating. This function never returns null or throws an exception, even if the cursor is currently being iterated, has iterated past its end, or its transaction is not active.
*/
Object getSource();
/**
* Sets the number times a cursor should move its position forward.
IDBRequest advance (
in long count
) raises (IDBDatabaseException);
Parameter
- count
- The number of advances forward the cursor should make.
Returns
void
Exceptions
This method can raise an IDBDatabaseException with the following codes:
Exception Description NON_TRANSIENT_ERR
The value passed into the count
parameter was zero or a negative number.
NOT_ALLOWED_ERR
The cursor was created using openKeyCursor(), or if it is currently being iterated (you cannot call this method again until the new cursor data has been loaded), or if it has iterated past the end of its range. TRANSACTION_INACTIVE_ERR
The transaction that this cursor belongs to is inactive.
*/
void advance(int count);
void continueFunction();
void continueFunction(Object key);
/**
* Returns an IDBRequest
object, and, in a separate thread, deletes the record at the cursor's position, without changing the cursor's position. Once the record is deleted, the cursor's value
is set to null
.
IDBRequest delete (
) raises (IDBDatabaseException);
Returns
IDBRequest
- A request object on which subsequent events related to this operation are fired. The
result
attribute is set to undefined
.
Exceptions
This method can raise an IDBDatabaseException with the following code:
Exception Description NOT_ALLOWED_ERR
The cursor was created using openKeyCursor(), or if it is currently being iterated (you cannot call this method again until the new cursor data has been loaded), or if it has iterated past the end of its range. READ_ONLY_ERR
The cursor is in a transaction whose mode is READ_ONLY
. TRANSACTION_INACTIVE_ERR
The transaction that this cursor belongs to is inactive.
*/
IDBRequest _delete();
/**
* Returns an IDBRequest object, and, in a separate thread, updates the value at the current position of the cursor in the object store. If the cursor points to a record that has just been deleted, a new record is created.
IDBRequest update (
in any value
) raises (IDBDatabaseException, DOMException);
Parameter
- value
- The value to be stored.
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 codes:
Exception Description DATA_ERR
The underlying object store uses in-line keys, and the key for the cursor's position does not match the value
property at the object store's key path.
NOT_ALLOWED_ERR
The cursor was created using openKeyCursor(), or if it is currently being iterated (you cannot call this method again until the new cursor data has been loaded), or if it has iterated past the end of its range. READ_ONLY_ERR
The cursor is in a transaction whose mode is READ_ONLY
. TRANSACTION_INACTIVE_ERR
The transaction that this cursor belongs to is inactive.
It can also raise a DOMException with the following code:
Attribute Description DATA_CLONE_ERR
If the value could not be cloned.
*/
IDBRequest update(Object value);
}