Open main menu

CDOT Wiki β

Changes

Teams Winter 2011/team1/BlackBerry/Use SQLite

857 bytes added, 23:16, 11 April 2011
11.7 Modify StudentsList Class to use SQLiteManager
===11.7 Modify StudentsList Class to use SQLiteManager===
So far the StudentList class we have, consumes a vector to store students whiche are note preserved. We will modify the methods of this list to use the SQLiteManager and preserve the objects.<br/>
Add the following private fields to the StudentList Class:
<source lang="java">
private Database db ;
private URI uri;
</source>
Then modify its constructor to take and set thode fields:
<source lang="java">
public StudentList(Database db, URI uri) throws Exception {
super(new StudentListComparator());
this.db = db;
this.uri = uri;
SQLManager sqlManager = new SQLManager(db, uri);
loadFrom(sqlManager.getStudents().elements());
SQLManager.closeDB();
}
 
</source>
 
11.7.1 Load list<br/>
<source lang="java">
 
 
</source>
11.7.2 Add Student<br/>
<source lang="java">
 
 
</source>
11.7.3 Edit Student<br/>
<source lang="java">
 
 
</source>
11.7.4 Delete Student<br/>
<source lang="java">
 
 
</source>
===11.8 Student View Application in Action===
1
edit