Package net.rim.device.api.database

Examples of net.rim.device.api.database.Cursor


            // and create a new Category object.
            statement =
                    _db.createStatement("SELECT category_id FROM Category WHERE category_name = ?");
            statement.prepare();
            statement.bind(1, name);
            final Cursor cursor = statement.getCursor();
            if (cursor.next()) {
                final Row row = cursor.getRow();
                final int id = row.getInteger(0);
                category = new Category(id, name);
            }
            cursor.close();
            statement.close();
        } catch (final DatabaseException dbe) {
            SQLiteDemo.errorDialog(dbe.toString());
        } catch (final DataTypeException dte) {
            SQLiteDemo.errorDialog(dte.toString());
View Full Code Here


        try {
            // Read in all records from the Category table
            final Statement statement =
                    _db.createStatement("SELECT * FROM Category");
            statement.prepare();
            final Cursor cursor = statement.getCursor();

            Row row;
            int id;
            String name;
            Category category;

            // Iterate through the result set. For each row, create a new
            // Category object and add it to the hash table.
            while (cursor.next()) {
                row = cursor.getRow();
                id = row.getInteger(0);
                name = row.getString(1);
                category = new Category(id, name);
                categories.put(id, category);
            }
            statement.close();
            cursor.close();
        } catch (final DatabaseException dbe) {
            SQLiteDemo.errorDialog(dbe.toString());
        } catch (final DataTypeException dte) {
            SQLiteDemo.errorDialog(dte.toString());
        }
View Full Code Here

        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());
        }
View Full Code Here

TOP

Related Classes of net.rim.device.api.database.Cursor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.