Esempio n. 1
0
 /**
  * 保存下载的数据
  *
  * @param infos
  */
 public void saveInfos(List<DownloadInfo> infos) {
   SQLiteDatabase database = dbHelper.getWritableDatabase();
   for (DownloadInfo info : infos) {
     String sql =
         "insert into  download_info(thread_id, start_pos, end_pos, compelete_size, url) values(?,?,?,?,?)";
     Object[] bindArgs = {
       info.getThreadId(),
       info.getStartPos(),
       info.getEndPos(),
       info.getCompeleteSize(),
       info.getUrl()
     };
     database.execSQL(sql, bindArgs);
   }
 }
Esempio n. 2
0
 public void updateInfos(int threadId, int compeleteSize, String urlstr) {
   SQLiteDatabase database = dbHelper.getWritableDatabase();
   String sql = "update download_info set compelete_size=? where thread_id=? and url = ?";
   Object[] bindArgs = {compeleteSize, threadId, urlstr};
   database.execSQL(sql, bindArgs);
 }