inserter.bind(guyIntColumn, status); inserter.execute();
/** * Parse the values in a CSV row, map them to the table column * order, and insert. Uses {@link InsertHelper} so it may be * called repeatedly within a transaction for max performance. * * @param csvRow * @return row ID of the newly inserted row or -1 */ private long parseAndInsertRow(String csvRow) { List<String> textValues = CsvUtils.getValues(csvRow); insertHelper.prepareForInsert(); String[] rowValues = textValues.toArray(new String[textValues.size()]); th.bindRowValues(insertHelper, rowValues); return insertHelper.execute(); }
ih.bind(countryColumn, rawValues[4]); ih.bind(timezoneColumn, rawValues[5]); ih.execute();
String json = gson.toJson(msg); ih.bind(jsondataColumn, json); ih.execute();
ih.bind(groupidColumn, groupId); ih.execute();
ih.bind(jsondataColumn, ""); ih.execute();
ih.bind(jsondataColumn, ""); ih.execute();
ih.bind(jsondataColumn, ""); ih.execute();
ih.bind(jsondataColumn, ""); ih.execute();
ih.bind(jsondataColumn, ""); ih.execute();
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();}