public int insertDriver() throws SQLException { connect(); Statement statement = connection.createStatement(); String query = "INSERT INTO `Drivers` (`driverID`, `firstName`, " + " `lastName`, `address`, `phone`, `email`, `cvName`, `dateAdded`," + " `idNumber`, `subcountyID`)" + " VALUES (\"" + driver.getUserID() + "\", \"" + driver.getFirstName() + "\",\"" + driver.getLastName() + "\", \"" + driver.getAddress() + "\", " + "\"" + driver.getPhone() + "\", \"" + driver.getEmail() + "\", \"" + driver.getCvName() + "\", \"" + driver.getDateAdded() + "\", \"" + driver.getIdNumber() + "\", \"" + driver.getSubcounty().getSubcountyID() + "\")"; int result = statement.executeUpdate(query); disconnect(); return result; }
public int approveApplication() throws SQLException { connect(); Statement statement = connection.createStatement(); String query = "UPDATE `Users` SET `isActive` = \"" + 1 + "\" WHERE" + " `userID` = \"" + driver.getUserID() + "\""; int result = statement.executeUpdate(query); disconnect(); return result; }
public int updateDriver(Driver driver) throws SQLException { connect(); Statement statement = connection.createStatement(); String query = null; int result = 0; if (driver.getTruck().getPlateNumber().equals("None")) { query = "UPDATE `Drivers` SET `plateNumber` = NULL" + " WHERE `driverID` = \"" + driver.getUserID() + "\""; } else { query = "UPDATE `Drivers` SET `plateNumber` = \"" + driver.getTruck().getPlateNumber() + "\"" + " WHERE `driverID` = \"" + driver.getUserID() + "\""; } result += statement.executeUpdate(query); disconnect(); return result; }