public int upatePost(Post post) { int count = 0; try { count = executeUpdate(ReflectUtil.reflect(post, true)); } catch (Exception e) { e.printStackTrace(); } finally { closeConn(); } return count; }
public int newPost(Post post) { int pid = -1; try { int count = executeUpdate(ReflectUtil.reflect(post, false)); if (count == 1) { ResultSet rs = executeSQL("select LAST_INSERT_ID()"); rs.next(); pid = rs.getInt(1); } } catch (Exception e) { e.printStackTrace(); } finally { closeConn(); } return pid; }