コード例 #1
0
ファイル: IssuePersister.java プロジェクト: ugly1/Impeller
 private void saveComment(SQLiteDatabase db, String issueID, Comment comment) {
   ContentValues values = new ContentValues();
   values.put("issue_id", issueID);
   values.put("username", comment.getUsername());
   values.put("text", comment.getText());
   DateFormat dateFormat = new SimpleDateFormat(dateFormatString, Locale.US);
   values.put("date", dateFormat.format(comment.getDate()));
   values.put("systemUser", comment.isSystemUser());
   db.insert(IssuePersisterDatabase.COMMENTS_TABLE_NAME, null, values);
 }
コード例 #2
0
ファイル: IssuePersister.java プロジェクト: ugly1/Impeller
 private static boolean commentExists(SQLiteDatabase db, Comment comment) {
   String query =
       "SELECT id FROM "
           + IssuePersisterDatabase.COMMENTS_TABLE_NAME
           + " WHERE username = ? AND text = ? AND date = ?";
   DateFormat dateFormat = new SimpleDateFormat(dateFormatString, Locale.US);
   Cursor commentCountQuery =
       db.rawQuery(
           query,
           new String[] {
             comment.getUsername(), comment.getText(), dateFormat.format(comment.getDate())
           });
   int count = commentCountQuery.getCount();
   commentCountQuery.close();
   return count > 0;
 }