net.rim.device.api.database
Interface Database
public interface Database
Database allows to create and modify device side databases. Database can
create, delete, execute SQL-like commands, and perform other common database
management tasks.
By default all statements are executed in dedicated transactions. This is
similar to auto-commit pattern. If multiple statements need to be executed in
single transaction then Database.beginTransaction() and
Database.commitTransaction() methods should be used. It is not recommended to
use native database transaction SQL statements because underlying
implementation may change. Nested transactions are not supported.
- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 5.0.0
close
void close()
throws DatabaseIOException
- Closes the database.
- Throws:
DatabaseIOException.
DatabaseIOException- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 5.0.0
createStatement
Statement createStatement(String sqlStatement)
throws DatabaseException
- Creates a Statement in this database.
If given sql parameter contains multiple statements separated by ';' then
only the first one is parsed and will be executed. The remaining
statements after the first ';' characters are ignored.
Statements should be closed explicitly to free up resources.
- Parameters:
sqlStatement - SQL statement to execute.
- Returns:
- Statement.
- Throws:
DatabaseException - -
thrown when the database is null or closed.
NullPointerException - -
thrown if the sql statement is null.- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 5.0.0
getFile
URI getFile()
throws DatabasePathException
- Gets the URI Of the database file.
- Returns:
- the URI of the database file.
- Throws:
DatabasePathException.
DatabasePathException- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 5.0.0
getNumberOfChanges
int getNumberOfChanges()
throws DatabaseException
- Gets the number of rows affected by the last change of the database.
- Returns:
- the number of rows affected.
- Throws:
DatabaseException - - thrown when the database is null or closed.- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 5.0.0
lastInsertedRowID
long lastInsertedRowID()
throws DatabaseException
- Gets the last automatically generated key value.
- Returns:
- long. The id (primary key) of last inserted row.
- Throws:
DatabaseException - - thrown when the database is null or closed.- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 5.0.0
getLastError
String getLastError()
throws DatabaseException
- Gets the last error message string from the last change.
- Returns:
- String. Error message in details.
- Throws:
DatabaseException - - thrown when the database is null or closed.- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 5.0.0
isEncrypted
boolean isEncrypted()
throws DatabaseException
- Returns encrypted database property.
- Returns:
- true if database is encrypted, false otherwise
- Throws:
DatabaseException - if database is not opened- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 5.0.0
getDatabaseSecurityOptions
DatabaseSecurityOptions getDatabaseSecurityOptions()
throws DatabaseException
- Returns current database security options.
- Returns:
- DatabaseSecurityOptions new object with populated properties
- Throws:
DatabaseException - if database is not opened- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 5.0.0
beginTransaction
void beginTransaction()
throws DatabaseException
- Starts a new transaction. All the following statements will be executed
in its context which can be committed or rolled back. If the transaction
is not committed then it will be rolled back. Nested transactions are not
supported and if this method called twice then
DatabaseException
is thrown.
- Throws:
DatabaseException - if database is not opened- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 5.0.0
commitTransaction
void commitTransaction()
throws DatabaseException
- Commits current transaction.
Application should close all cursors started within this transaction
before calling commit, otherwise it would fail.
- Throws:
DatabaseException - if database is not opened or transaction was not started- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 5.0.0
rollbackTransaction
void rollbackTransaction()
throws DatabaseException
- Rolls back current transaction. Any updates will be lost.
- Throws:
DatabaseException - if database is not opened or transaction was not started- Category:
- Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
- Since:
- BlackBerry API 5.0.0
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.