Vector getItems() {
final Vector directoryItems = new Vector();
try {
// Read in all records from the DirectoryItems table
final Statement statement =
_db.createStatement("SELECT * FROM DirectoryItems");
statement.prepare();
final Cursor cursor = statement.getCursor();
// Iterate through the the result set. For each row, add a
// new DirectoryItem object to the vector.
while (cursor.next()) {
final Row row = cursor.getRow();
final int id = row.getInteger(0);
final int categoryId = row.getInteger(1);
final String name = row.getString(2);
final String location = row.getString(3);
final String phone = row.getString(4);
final DirectoryItem item =
new DirectoryItem(id, name, location, phone, categoryId);
directoryItems.addElement(item);
}
statement.close();
cursor.close();
} catch (final DatabaseException dbe) {
SQLiteDemo.errorDialog(dbe.toString());
} catch (final DataTypeException dte) {
SQLiteDemo.errorDialog(dte.toString());