mirror of
https://github.com/FatttSnake/ClassroomInteraction.git
synced 2026-04-06 08:01:25 +08:00
Add updateAttendance()
This commit is contained in:
@@ -274,6 +274,19 @@ public class DatabaseHelper {
|
|||||||
return courses;
|
return courses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean updateAttendance(String attID, AttStatus attStatus) throws NoConfigException, SQLException, DependenciesNotFoundException {
|
||||||
|
if (!isExistsInAttendance(attID)) throw new DependenciesNotFoundException();
|
||||||
|
|
||||||
|
String sql = "UPDATE attendance SET attStatus=? WHERE attID=?";
|
||||||
|
try (Connection connection = PoolHelper.getConnection()) {
|
||||||
|
try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
|
||||||
|
preparedStatement.setString(1, attStatus.name());
|
||||||
|
preparedStatement.setString(2, attID);
|
||||||
|
return preparedStatement.executeUpdate() == 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void close() {
|
public static void close() {
|
||||||
PoolHelper.close();
|
PoolHelper.close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user