worked on dbcontroller part 3
fixed a few bugs, prepared for favorites
This commit is contained in:
parent
e63665add0
commit
4fe2d7b4be
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -137,7 +137,8 @@ public class DBController {
|
|||
System.out.println(rs.getString(1));
|
||||
System.out.println(rs.getString(2));
|
||||
System.out.println(rs.getString(3)+"\n");
|
||||
}
|
||||
}
|
||||
stmt.close();
|
||||
rs.close();
|
||||
|
||||
System.out.println("Streaming Entries: \n");
|
||||
|
@ -151,7 +152,8 @@ public class DBController {
|
|||
System.out.println(rsS.getString(5));
|
||||
System.out.println(rsS.getString(6));
|
||||
System.out.println(rsS.getString(7)+"\n");
|
||||
}
|
||||
}
|
||||
stmt.close();
|
||||
rsS.close();
|
||||
|
||||
} catch (SQLException e) {
|
||||
|
@ -164,19 +166,30 @@ public class DBController {
|
|||
//gibt die Favorisierung eines bestimmten Films
|
||||
public void getFavStatus(String name){
|
||||
try{
|
||||
Statement stmt = connection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT titel, rating FROM film_local WHERE titel = '"+name+"';" ); //SQL Befehl
|
||||
System.out.println("local:"+rs.getInt("rating"));
|
||||
Statement stmta = connection.createStatement();
|
||||
ResultSet rs = stmta.executeQuery("SELECT titel, rating FROM film_local WHERE titel = '"+name+"';" ); //SQL Befehl
|
||||
System.out.println("local:"+rs.getString("rating"));
|
||||
stmta.close();
|
||||
rs.close();
|
||||
}catch(SQLException e){
|
||||
|
||||
try {
|
||||
Statement stmtS = connection.createStatement();
|
||||
ResultSet rsS = stmtS.executeQuery("SELECT titel, rating FROM film_streaming WHERE titel = '"+name+"';" );
|
||||
System.out.println("streaming:"+rsS.getInt("rating"));
|
||||
System.out.println("streaming");
|
||||
Statement stmtSa = connection.createStatement();
|
||||
ResultSet rsS = stmtSa.executeQuery("SELECT titel, rating FROM film_streaming WHERE titel = '"+name+"';" );
|
||||
System.out.println("streaming:"+rsS.getString("rating"));
|
||||
stmtSa.close();
|
||||
rsS.close();
|
||||
} catch (SQLException e1) {
|
||||
System.out.println("Ups! an error occured!");
|
||||
// System.out.println("Ups! an error occured!");
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
// System.out.println("Ups! an error occured!");
|
||||
// e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
//setzt die Defavorisierung eines bestimmten Films
|
||||
public void defavorisieren(String name){
|
||||
|
|
|
@ -105,7 +105,7 @@ public class Main extends Application {
|
|||
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
|
||||
System.exit(0); //finishes itself
|
||||
}
|
||||
mainWindowController.loadStreamingSettings();
|
||||
// mainWindowController.loadStreamingSettings();
|
||||
mainWindowController.applyColor(); //setzt die Theme Farbe
|
||||
mainWindowController.cbLocal.getSelectionModel().select(mainWindowController.getLocal()); //setzt local
|
||||
mainWindowController.mainColor.setValue(Color.valueOf(mainWindowController.getColor()));
|
||||
|
|
|
@ -102,7 +102,8 @@ public class MainWindowController {
|
|||
private TreeTableView<streamUiData> treeTableViewfilm;
|
||||
@FXML
|
||||
private TableView<streamUiData> tableViewStreamingdata;
|
||||
@FXML JFXTextArea ta1;
|
||||
@FXML
|
||||
JFXTextArea ta1;
|
||||
@FXML
|
||||
private JFXButton menubtn;
|
||||
@FXML
|
||||
|
@ -151,7 +152,8 @@ public class MainWindowController {
|
|||
private Label sizelbl;
|
||||
@FXML
|
||||
private Label aulbl;
|
||||
@FXML ImageView image1;
|
||||
@FXML
|
||||
ImageView image1;
|
||||
|
||||
|
||||
@FXML
|
||||
|
@ -425,12 +427,12 @@ public class MainWindowController {
|
|||
|
||||
@FXML
|
||||
private void debugBtnclicked(){
|
||||
dbController.main(); //TODO das muss vor einen anderen Befehl warum auch immer
|
||||
dbController.getFavStatus("House of Cards");
|
||||
dbController.favorisieren("House of Cards");
|
||||
dbController.getFavStatus("House of Cards");
|
||||
// dbController.defavorisieren("House of Cards");
|
||||
// dbController.getFavStatus("House of Cards");
|
||||
// dbController.ausgeben();
|
||||
dbController.getFavStatus("Zootopia");
|
||||
dbController.favorisieren("Zootopia");
|
||||
dbController.getFavStatus("Zootopia");
|
||||
dbController.defavorisieren("Zootopia");
|
||||
dbController.getFavStatus("Zootopia");
|
||||
//for testing
|
||||
}
|
||||
|
||||
|
@ -517,9 +519,10 @@ public class MainWindowController {
|
|||
ApiQuery = new apiQuery(this);
|
||||
dbController = new DBController(this);
|
||||
|
||||
System.out.println("Mode: "+mode);
|
||||
System.out.println("Mode: "+mode); //TODO debugging
|
||||
|
||||
// dbController.main();
|
||||
loadStreamingSettings();
|
||||
dbController.main();
|
||||
|
||||
debugBtn.setDisable(false); //debugging btn for tests
|
||||
debugBtn.setVisible(true);
|
||||
|
@ -728,7 +731,7 @@ public class MainWindowController {
|
|||
}
|
||||
}
|
||||
|
||||
void loadStreamingSettings(){
|
||||
private void loadStreamingSettings(){
|
||||
if(getStreamingPath().equals("")||getStreamingPath().equals(null)){
|
||||
System.out.println("Kein Pfad angegeben"); //falls der Pfad null oder "" ist
|
||||
}else{
|
||||
|
|
Loading…
Reference in New Issue