????????????ü??
???????????? ???????[ 2011/9/21 9:20:10 ] ????????
?????????????????????????????????????????????????飺????????????Щ??????????????????????????????????????????????????????????????????????й?????????е??????????????е????????Щ?????????????????????????????????
???????
?????????????????????????????????????????????????????????????и???Participants????????????????????λ???????????????????????????λ?????????????????????????????????????????λ????????????????ü?????????????true??24С?????????????????????????????????24С????????????????????????????????????????????????????????false??
????????????????????
public class DBTable {
protected Connection conn;
protected tableName;
public DBTable(String tableName) {
this.tableName = tableName;
this.conn = ...;
}
public void clear() {
PreparedStatement st = conn.prepareStatement("DELETE FROM "+tableName);
try {
st.executeUpdate();
}finally{
st.close();
}
}
public int getCount() {
PreparedStatement st = conn.prepareStatement("SELECT COUNT(*) FROM"+tableName);
try {ResultSet rs = st.executeQuery();
rs.next();
return rs.getInt(1);
}finally{
st.close();
}
}
}
public class ParticipantsInDB extends DBTable {
public ParticipantsInDB() {
super("participants");
}
public void addParticipant(Participant part) {
...
}
public void deleteParticipant(String participantId) {
setDeleteFlag(participantId?? true);
}
public void restoreParticipant(String participantId) {
setDeleteFlag(participantId?? false)
;
}
private void setDeleteFlag(String participantId?? boolean b) {
...
}
public void reallyDelete() {
PreparedStatement st = conn.prepareStatement("DELETE FROM "+tableName+" WHERE deleteFlag=true");
try {
st.executeUpdate();
}finally{
st.close();
}
}
public int countParticipants() {
PreparedStatement st = conn.prepareStatement("SELECT COUNT(*) FROM "+tableName+" WHERE deleteFlag=false");
try {
ResultSet rs = st.executeQuery();
rs.next();
return rs.getInt(1);
}finally{
st.close();
}
}
}
?????????countParticipants??????????????ЩdeleteFlags?false???????????????????Щ?λ???????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11