Yohann-Codes/Jelly

这段代码是什么意思,friends表是怎么设计的

forTribeforXuanmo opened this issue · 0 comments

String sql = "SELECT * FROM friends WHERE username = ?"; try { pstmt = conn.prepareStatement(sql); pstmt.setString(1, username); resultSet = pstmt.executeQuery(); if (resultSet.next()) { for (int i = 1; i <= 20; i++) { if (resultSet.getString("friend_" + i) == null) { return "friend_" + i; } } }
字段的数量不算固定的吗,不算就两个字段,一个Username 一个friend