我的 Java 插件有问题 - 当没有找到结果时,它说结果集是空的。有人能告诉我如何检测结果集是否为空吗?
String url = "jdbc:mysql://" + host + ":" + port + "/" + database + "";
Connection conn = DriverManager.getConnection(url, username, password);
Statement stmt = conn.createStatement();
ResultSet rs;
String p = pp.getName();
rs = stmt.executeQuery("SELECT * FROM " + table + " WHERE username='"
+ p + "' AND recieved=0 ORDER BY id DESC");
rs = stmt.getResultSet();