mirror of
https://github.com/FatttSnake/ClassroomInteraction.git
synced 2026-04-06 06:31:26 +08:00
Fix database selectStudentsFromCourse() bug
This commit is contained in:
@@ -301,7 +301,9 @@ public class DatabaseHelper {
|
||||
try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
|
||||
preparedStatement.setLong(1, courID);
|
||||
try (ResultSet resultSet = preparedStatement.executeQuery()) {
|
||||
students.add(StudentOA.select(resultSet.getLong("stuID")));
|
||||
while (resultSet.next()) {
|
||||
students.add(StudentOA.select(resultSet.getLong("stuID")));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.cfive.classroom.library.database;
|
||||
|
||||
import com.cfive.classroom.library.database.bean.Faculty;
|
||||
import com.cfive.classroom.library.database.util.AlreadyExistsException;
|
||||
import com.cfive.classroom.library.database.util.DependenciesNotFoundException;
|
||||
import com.cfive.classroom.library.database.util.InsertException;
|
||||
import com.cfive.classroom.library.database.util.NoConfigException;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -74,6 +75,11 @@ public class DatabaseTest {
|
||||
DatabaseHelper.selectAllFromStudent().forEach(LOGGER::debug);
|
||||
}
|
||||
|
||||
@Test
|
||||
void selectStudentsFromCourseTest() throws NoConfigException, SQLException, DependenciesNotFoundException {
|
||||
DatabaseHelper.selectStudentsFromCourse(2).forEach(LOGGER::debug);
|
||||
}
|
||||
|
||||
@Test
|
||||
void TempTest() {
|
||||
LOGGER.debug(String.valueOf(UUID.randomUUID()));
|
||||
|
||||
Reference in New Issue
Block a user