|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||
See:
Description
| Interface Summary | |
|---|---|
| Cursor | Provides read-only access to results returned by a database query. |
| Database | Database allows to create and modify device side databases. |
| Statement | The representation of a SQL statement. |
| Class Summary | |
|---|---|
| BufferedCursor | Caches all rows in memory for bidirectional or random access. |
| CursorEnumeration | Wraps cursor operations in Enumeration interface. |
| DatabaseFactory | Creates new or opens existing instances of a device database. |
| DatabaseSecurityOptions | Defines database security options. |
| Row | Collection of variables and values associated by column names. |
| Exception Summary | |
|---|---|
| CommandException | Indicates that a command did not meet required criteria. |
| DataTypeException | Indicates that source data type did not match target data type. |
| DatabaseBindingException | Failure to bind the parameter to a SQL statement. |
| DatabaseException | Indicates that requested operation could not be performed on the database. |
| DatabaseIOException | Indicates that database file failed to be opened, created, opened or created, or deleted. |
| DatabasePathException | Indicates that the path to a database file is malformed. |
| SchemaException | Indicates inconsistencies in schema definition. |
This package provides relational database functionality for applications. Databases can be manipulated and searched directly using SQL statements.
An application calls DatabaseFactory.create(java.lang.String, net.rim.device.api.database.DatabaseSecurityOptions) and gets back an
instance of Database, a
relational database handle. All subsequent operations are performed
on the database handle by creating SQL statements using Database.createStatement(java.lang.String) and executing
them.
Here's a typical sequence of database operations executed via statements:
Database.createStatement(java.lang.String). This returns a net.rim.device.api.database.statement.Statement object.
net.rim.device.api.database.statement.Statement#prepare (you can
think of this as a compilation phase).
net.rim.device.api.database.statement.Statement#bind -- a useful
mechanism for re-using a prepared statement with differing values.
net.rim.device.api.database.statement.Statement#execute, which
returns a Cursor over the result
set.
try {
Database db = DatabaseFactory.create("x"); // Defaults to /SDCard/x.db
Statement s = db.createStatement("SELECT * FROM mytable;");
s.prepare();
Cursor c = s.execute();
while (cursor.hasMoreElements()) {
Row r = (Row)cursor.nextElement();
// Read row. For example:
int idx1 = r.getColumnIndex("col1");
int idx2 = r.getColumnIndex("col2");
int val1 = r.getInteger(idx1);
int val2 = r.getInteger(idx2);
}
} catch (Throwable e) {
throw e;
}
|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||
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.