public Vector getCalendars (String uid) throws SQLException {
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
//vector which will be returned
Vector calendarVector = new Vector();
try {
synchronized(this) {
//SQL query to get folderId, folderName, folderOwner and folderRights
String sqlQuery = "SELECT oxfolder_tree.fuid, oxfolder_tree.fname, oxfolder_tree.owner," +
"oxfolder_permissions.odp from oxfolder_permissions, oxfolder_tree WHERE " +
"oxfolder_permissions.entity='"+ uid + "' AND oxfolder_permissions.odp!='0' " +
"AND oxfolder_tree.module='calendar' AND oxfolder_tree.fuid=oxfolder_permissions.pid";
//get database connection
con = oxdb.getConnection();
// create statement
stmt = con.createStatement();
// get data from database
rs = stmt.executeQuery(sqlQuery);
// create Calendar-objects for each result and add it to vector
while (rs.next()) {
calendarVector.addElement(new drfox.logic.Calendar(rs.getInt("fuid"),rs.getString("fname"),
rs.getString("owner"),rs.getInt("odp")));
}
}
return calendarVector;
} catch (SQLException e) {
// Andere Exception werfen, wegen Adapterkapselung
// throw new DBInterneZugriffException("Beim Lesen aus der Datenbank ist ein Fehler aufgetreten.");
System.out.println("Error while reading database!");
e.printStackTrace();
} finally {
//close all connections, statements and resultsets
this.closeAll(con, stmt, rs);
}
return calendarVector;
}