ih.bind(idColumn, id++); ih.bind(nameColumn, rawValues[0]); ih.bind(asciiNameColumn, rawValues[1]); ih.bind(latitudeColumn, Double.parseDouble(rawValues[2])); ih.bind(longitudeColumn, Double.parseDouble(rawValues[3])); ih.bind(countryColumn, rawValues[4]); ih.bind(timezoneColumn, rawValues[5]); ih.execute();
ih.prepareForInsert(); if (msg != null) { ih.bind(mblogidColumn, msg.getId()); ih.bind(accountidColumn, accountId); String json = gson.toJson(msg); ih.bind(jsondataColumn, json); ih.bind(groupidColumn, groupId); } else { ih.bind(mblogidColumn, "-1"); ih.bind(accountidColumn, accountId); ih.bind(jsondataColumn, ""); ih.bind(groupidColumn, groupId);
public static void addCommentLineMsg(CommentListBean list, String accountId) { Gson gson = new Gson(); List<CommentBean> msgList = list.getItemList(); DatabaseUtils.InsertHelper ih = new DatabaseUtils.InsertHelper(getWsd(), MentionCommentsTable.MentionCommentsDataTable.TABLE_NAME); final int mblogidColumn = ih.getColumnIndex(MentionCommentsTable.MentionCommentsDataTable.MBLOGID); final int accountidColumn = ih.getColumnIndex(MentionCommentsTable.MentionCommentsDataTable.ACCOUNTID); final int jsondataColumn = ih.getColumnIndex(MentionCommentsTable.MentionCommentsDataTable.JSONDATA); try { getWsd().beginTransaction(); for (CommentBean msg : msgList) { ih.prepareForInsert(); ih.bind(mblogidColumn, msg.getId()); ih.bind(accountidColumn, accountId); String json = gson.toJson(msg); ih.bind(jsondataColumn, json); ih.execute(); } getWsd().setTransactionSuccessful(); } catch (SQLException e) { } finally { getWsd().endTransaction(); ih.close(); } reduceCommentTable(accountId); }
private static void add(String accountId, List<String> list) { if (list == null || list.size() == 0) { return; } DatabaseUtils.InsertHelper ih = new DatabaseUtils.InsertHelper(getWsd(), TopicTable.TABLE_NAME); final int accountidColumn = ih.getColumnIndex(TopicTable.ACCOUNTID); final int nameColumn = ih.getColumnIndex(TopicTable.TOPIC_NAME); try { getWsd().beginTransaction(); for (int i = 0; i < list.size(); i++) { String name = list.get(i); ih.prepareForInsert(); ih.bind(accountidColumn, accountId); ih.bind(nameColumn, name); ih.execute(); } getWsd().setTransactionSuccessful(); } catch (SQLException e) { } finally { getWsd().endTransaction(); ih.close(); } }
public static void addUnreadNotification(String accountId, ArrayList<String> msgIds, UnreadDBType type) { DatabaseUtils.InsertHelper ih = new DatabaseUtils.InsertHelper(getWsd(), NotificationTable.TABLE_NAME); final int mblogidColumn = ih.getColumnIndex(NotificationTable.MSGID); final int accountidColumn = ih.getColumnIndex(NotificationTable.ACCOUNTID); final int typeColumn = ih.getColumnIndex(NotificationTable.TYPE); try { getWsd().beginTransaction(); for (String msg : msgIds) { ih.prepareForReplace(); ih.bind(mblogidColumn, msg); ih.bind(accountidColumn, accountId); ih.bind(typeColumn, type.getValue()); ih.execute(); } getWsd().setTransactionSuccessful(); } catch (SQLException ignored) { } finally { getWsd().endTransaction(); ih.close(); } }
public static void addFilterKeyword(int type, Collection<String> words) { DatabaseUtils.InsertHelper ih = new DatabaseUtils.InsertHelper(getWsd(), FilterTable.TABLE_NAME); final int nameColumn = ih.getColumnIndex(FilterTable.NAME); final int activeColumn = ih.getColumnIndex(FilterTable.ACTIVE); final int typeColumn = ih.getColumnIndex(FilterTable.TYPE); try { getWsd().beginTransaction(); for (String word : words) { ih.prepareForInsert(); ih.bind(nameColumn, word); ih.bind(activeColumn, true); ih.bind(typeColumn, type); ih.execute(); } getWsd().setTransactionSuccessful(); } catch (SQLException e) { } finally { getWsd().endTransaction(); ih.close(); } }
database.beginTransaction(); DatabaseUtils.InsertHelper ih = new DatabaseUtils.InsertHelper(database,TABLE_NAME); final int column = ih.getColumnIndex(COLUMN_NAME); ih.prepareForInsert(); ih.bind(column, columnData); ih.execute(); ih.close(); database.setTransactionSuccessful(); database.endTransaction();}