當前位置: 首頁>>代碼示例>>Java>>正文


Java DatabaseUtils.InsertHelper方法代碼示例

本文整理匯總了Java中android.database.DatabaseUtils.InsertHelper方法的典型用法代碼示例。如果您正苦於以下問題:Java DatabaseUtils.InsertHelper方法的具體用法?Java DatabaseUtils.InsertHelper怎麽用?Java DatabaseUtils.InsertHelper使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.database.DatabaseUtils的用法示例。


在下文中一共展示了DatabaseUtils.InsertHelper方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addFilterKeyword

import android.database.DatabaseUtils; //導入方法依賴的package包/類
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();
		}

	}
 
開發者ID:lookwhatlook,項目名稱:WeiboWeiBaTong,代碼行數:27,代碼來源:FilterDBTask.java

示例2: add

import android.database.DatabaseUtils; //導入方法依賴的package包/類
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();
	}

}
 
開發者ID:lookwhatlook,項目名稱:WeiboWeiBaTong,代碼行數:26,代碼來源:TopicDBTask.java

示例3: addUnreadNotification

import android.database.DatabaseUtils; //導入方法依賴的package包/類
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();
		}
	}
 
開發者ID:lookwhatlook,項目名稱:WeiboWeiBaTong,代碼行數:26,代碼來源:NotificationDBTask.java

示例4: addFilterKeyword

import android.database.DatabaseUtils; //導入方法依賴的package包/類
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();
        }

    }
 
開發者ID:andforce,項目名稱:iBeebo,代碼行數:27,代碼來源:FilterDBTask.java

示例5: add

import android.database.DatabaseUtils; //導入方法依賴的package包/類
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();
    }

}
 
開發者ID:andforce,項目名稱:iBeebo,代碼行數:26,代碼來源:TopicDBTask.java

示例6: addUnreadNotification

import android.database.DatabaseUtils; //導入方法依賴的package包/類
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();
    }
}
 
開發者ID:jas0nchen,項目名稱:X.Ray,代碼行數:27,代碼來源:NotificationDBTask.java

示例7: insert

import android.database.DatabaseUtils; //導入方法依賴的package包/類
public static void insert(UserBean msg, String ownerid) {

        DatabaseUtils.InsertHelper ih = new DatabaseUtils.InsertHelper(getWsd(),
                ContactTable.TABLE_NAME);
        final int nameCol = ih.getColumnIndex(ContactTable.NAME);
        final int avatarCol = ih.getColumnIndex(ContactTable.AVATAR);
        final int uidCol = ih.getColumnIndex(ContactTable.UID);
        final int genderCol = ih.getColumnIndex(ContactTable.GENDER);
        final int ownerCol = ih.getColumnIndex(ContactTable.OWNERID);
        final int rightCountCol = ih.getColumnIndex(ContactTable.RIGHT_COUNT);
        final int missCountCol = ih.getColumnIndex(ContactTable.MISS_COUNT);
        final int statueCountCol = ih.getColumnIndex(ContactTable.STATUE_COUNT);
        try {
            getWsd().beginTransaction();
            ih.prepareForInsert();
            ih.bind(nameCol, msg.getName());
            ih.bind(avatarCol, msg.getAvatar());
            ih.bind(uidCol, msg.getId());
            ih.bind(genderCol, msg.getGender());
            ih.bind(rightCountCol, msg.getRight_count());
            ih.bind(missCountCol, msg.getMiss_count());
            ih.bind(statueCountCol, msg.getStatue_count());
            ih.bind(ownerCol, ownerid);

            ih.execute();
            getWsd().setTransactionSuccessful();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            getWsd().endTransaction();
            ih.close();
        }
    }
 
開發者ID:huijimuhe,項目名稱:monolog-android,代碼行數:34,代碼來源:ContactDao.java

示例8: insertList

import android.database.DatabaseUtils; //導入方法依賴的package包/類
public static void insertList(ArrayList<UserBean> list, String ownerid) {

        if (list == null || list.size() == 0) {
            return;
        }
        DatabaseUtils.InsertHelper ih = new DatabaseUtils.InsertHelper(getWsd(),
                ContactTable.TABLE_NAME);
        final int nameCol = ih.getColumnIndex(ContactTable.NAME);
        final int avatarCol = ih.getColumnIndex(ContactTable.AVATAR);
        final int uidCol = ih.getColumnIndex(ContactTable.UID);
        final int genderCol = ih.getColumnIndex(ContactTable.GENDER);
        final int ownerCol = ih.getColumnIndex(ContactTable.OWNERID);
        final int rightCountCol = ih.getColumnIndex(ContactTable.RIGHT_COUNT);
        final int missCountCol = ih.getColumnIndex(ContactTable.MISS_COUNT);
        final int statueCountCol = ih.getColumnIndex(ContactTable.STATUE_COUNT);
        try {
            getWsd().beginTransaction();
            for (int i = 0; i < list.size(); i++) {
                UserBean msg = list.get(i);
                ih.prepareForInsert();
                ih.bind(nameCol, msg.getName());
                ih.bind(avatarCol, msg.getAvatar());
                ih.bind(uidCol, msg.getId());
                ih.bind(genderCol, msg.getGender());
                ih.bind(rightCountCol, msg.getRight_count());
                ih.bind(missCountCol, msg.getMiss_count());
                ih.bind(statueCountCol, msg.getStatue_count());
                ih.bind(ownerCol, ownerid);
                ih.execute();
            }
            getWsd().setTransactionSuccessful();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            getWsd().endTransaction();
            ih.close();
        }
    }
 
開發者ID:huijimuhe,項目名稱:monolog-android,代碼行數:39,代碼來源:ContactDao.java

示例9: addRepostLineMsg

import android.database.DatabaseUtils; //導入方法依賴的package包/類
public static void addRepostLineMsg(MessageListBean list, String accountId) {
	Gson gson = new Gson();
	List<MessageBean> msgList = list.getItemList();
	int size = msgList.size();

	DatabaseUtils.InsertHelper ih = new DatabaseUtils.InsertHelper(getWsd(), RepostsTable.RepostDataTable.TABLE_NAME);
	final int mblogidColumn = ih.getColumnIndex(RepostsTable.RepostDataTable.MBLOGID);
	final int accountidColumn = ih.getColumnIndex(RepostsTable.RepostDataTable.ACCOUNTID);
	final int jsondataColumn = ih.getColumnIndex(RepostsTable.RepostDataTable.JSONDATA);

	try {
		getWsd().beginTransaction();
		for (int i = 0; i < size; i++) {

			MessageBean msg = msgList.get(i);
			ih.prepareForInsert();
			if (msg != null) {
				ih.bind(mblogidColumn, msg.getId());
				ih.bind(accountidColumn, accountId);
				String json = gson.toJson(msg);
				ih.bind(jsondataColumn, json);
			} else {
				ih.bind(mblogidColumn, "-1");
				ih.bind(accountidColumn, accountId);
				ih.bind(jsondataColumn, "");
			}
			ih.execute();

		}
		getWsd().setTransactionSuccessful();
	} catch (SQLException e) {
	} finally {
		getWsd().endTransaction();
		ih.close();
	}
	reduceRepostTable(accountId);
}
 
開發者ID:lookwhatlook,項目名稱:WeiboWeiBaTong,代碼行數:38,代碼來源:MentionWeiboTimeLineDBTask.java

示例10: addHomeLineMsg

import android.database.DatabaseUtils; //導入方法依賴的package包/類
private static void addHomeLineMsg(MessageListBean list, String accountId) {

        if (list == null || list.getSize() == 0) {
            return;
        }

        Gson gson = new Gson();
        List<MessageBean> msgList = list.getItemList();
        DatabaseUtils.InsertHelper ih = new DatabaseUtils.InsertHelper(getWsd(), HomeTable.HomeDataTable.HOME_DATA_TABLE);
        final int mblogidColumn = ih.getColumnIndex(HomeTable.HomeDataTable.MBLOGID);
        final int accountidColumn = ih.getColumnIndex(HomeTable.HomeDataTable.ACCOUNTID);
        final int jsondataColumn = ih.getColumnIndex(HomeTable.HomeDataTable.JSONDATA);
        try {
            getWsd().beginTransaction();
            for (int i = 0; i < msgList.size(); i++) {
                MessageBean msg = msgList.get(i);
                ih.prepareForInsert();
                if (msg != null) {
                    ih.bind(mblogidColumn, msg.getId());
                    ih.bind(accountidColumn, accountId);
                    String json = gson.toJson(msg);
                    ih.bind(jsondataColumn, json);
                } else {
                    ih.bind(mblogidColumn, "-1");
                    ih.bind(accountidColumn, accountId);
                    ih.bind(jsondataColumn, "");
                }
                ih.execute();
            }
            getWsd().setTransactionSuccessful();
        } catch (SQLException e) {
        } finally {
            getWsd().endTransaction();
            ih.close();
        }
        reduceHomeTable(accountId);
    }
 
開發者ID:andforce,項目名稱:iBeebo,代碼行數:38,代碼來源:FriendsTimeLineDBTask.java

示例11: addCommentLineMsg

import android.database.DatabaseUtils; //導入方法依賴的package包/類
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);
}
 
開發者ID:lookwhatlook,項目名稱:WeiboWeiBaTong,代碼行數:30,代碼來源:MentionCommentsTimeLineDBTask.java

示例12: addCommentLineMsg

import android.database.DatabaseUtils; //導入方法依賴的package包/類
public static void addCommentLineMsg(CommentListBean list, String accountId) {
    Gson gson = new Gson();
    List<CommentBean> msgList = list.getItemList();

    DatabaseUtils.InsertHelper ih = new DatabaseUtils.InsertHelper(getWsd(),
            CommentByMeTable.CommentByMeDataTable.TABLE_NAME);
    final int mblogidColumn = ih.getColumnIndex(CommentByMeTable.CommentByMeDataTable.MBLOGID);
    final int accountidColumn = ih.getColumnIndex(CommentByMeTable.CommentByMeDataTable.ACCOUNTID);
    final int jsondataColumn = ih.getColumnIndex(CommentByMeTable.CommentByMeDataTable.JSONDATA);

    try {
        getWsd().beginTransaction();
        for (CommentBean msg : msgList) {

            ih.prepareForInsert();
            if (msg != null) {
                ih.bind(mblogidColumn, msg.getId());
                ih.bind(accountidColumn, accountId);
                String json = gson.toJson(msg);
                ih.bind(jsondataColumn, json);
            } else {
                ih.bind(mblogidColumn, "-1");
                ih.bind(accountidColumn, accountId);
                ih.bind(jsondataColumn, "");
            }
            ih.execute();

        }
        getWsd().setTransactionSuccessful();
    } catch (SQLException e) {
    } finally {
        getWsd().endTransaction();
        ih.close();
    }
    reduceCommentTable(accountId);
}
 
開發者ID:andforce,項目名稱:iBeebo,代碼行數:37,代碼來源:CommentByMeTimeLineDBTask.java

示例13: addCommentLineMsg

import android.database.DatabaseUtils; //導入方法依賴的package包/類
public static void addCommentLineMsg(CommentListBean list, String accountId) {
	Gson gson = new Gson();
	List<CommentBean> msgList = list.getItemList();

	DatabaseUtils.InsertHelper ih = new DatabaseUtils.InsertHelper(getWsd(), CommentsTable.CommentsDataTable.TABLE_NAME);
	final int mblogidColumn = ih.getColumnIndex(CommentsTable.CommentsDataTable.MBLOGID);
	final int accountidColumn = ih.getColumnIndex(CommentsTable.CommentsDataTable.ACCOUNTID);
	final int jsondataColumn = ih.getColumnIndex(CommentsTable.CommentsDataTable.JSONDATA);

	try {
		getWsd().beginTransaction();
		for (CommentBean msg : msgList) {

			ih.prepareForInsert();
			if (msg != null) {
				ih.bind(mblogidColumn, msg.getId());
				ih.bind(accountidColumn, accountId);
				String json = gson.toJson(msg);
				ih.bind(jsondataColumn, json);

			} else {
				ih.bind(mblogidColumn, "-1");
				ih.bind(accountidColumn, accountId);
				ih.bind(jsondataColumn, "");
			}
			ih.execute();

		}
		getWsd().setTransactionSuccessful();
	} catch (SQLException e) {
	} finally {
		getWsd().endTransaction();
		ih.close();
	}
	reduceCommentTable(accountId);
}
 
開發者ID:lookwhatlook,項目名稱:WeiboWeiBaTong,代碼行數:37,代碼來源:CommentToMeTimeLineDBTask.java

示例14: addRepostLineMsg

import android.database.DatabaseUtils; //導入方法依賴的package包/類
public static void addRepostLineMsg(MessageListBean list, String accountId) {
    Gson gson = new Gson();
    List<MessageBean> msgList = list.getItemList();
    int size = msgList.size();

    DatabaseUtils.InsertHelper ih = new DatabaseUtils.InsertHelper(getWsd(),
            RepostsTable.RepostDataTable.TABLE_NAME);
    final int mblogidColumn = ih.getColumnIndex(RepostsTable.RepostDataTable.MBLOGID);
    final int accountidColumn = ih.getColumnIndex(RepostsTable.RepostDataTable.ACCOUNTID);
    final int jsondataColumn = ih.getColumnIndex(RepostsTable.RepostDataTable.JSONDATA);

    try {
        getWsd().beginTransaction();
        for (int i = 0; i < size; i++) {

            MessageBean msg = msgList.get(i);
            ih.prepareForInsert();
            if (msg != null) {
                ih.bind(mblogidColumn, msg.getId());
                ih.bind(accountidColumn, accountId);
                String json = gson.toJson(msg);
                ih.bind(jsondataColumn, json);
            } else {
                ih.bind(mblogidColumn, "-1");
                ih.bind(accountidColumn, accountId);
                ih.bind(jsondataColumn, "");
            }
            ih.execute();
        }
        getWsd().setTransactionSuccessful();
    } catch (SQLException e) {
    } finally {
        getWsd().endTransaction();
        ih.close();
    }
    reduceRepostTable(accountId);
}
 
開發者ID:jas0nchen,項目名稱:X.Ray,代碼行數:38,代碼來源:MentionWeiboTimeLineDBTask.java

示例15: addRepostLineMsg

import android.database.DatabaseUtils; //導入方法依賴的package包/類
public static void addRepostLineMsg(MessageListBean list, String accountId) {
    Gson gson = new Gson();
    List<MessageBean> msgList = list.getItemList();
    int size = msgList.size();

    DatabaseUtils.InsertHelper ih = new DatabaseUtils.InsertHelper(getWsd(), RepostsTable.RepostDataTable.TABLE_NAME);
    final int mblogidColumn = ih.getColumnIndex(RepostsTable.RepostDataTable.MBLOGID);
    final int accountidColumn = ih.getColumnIndex(RepostsTable.RepostDataTable.ACCOUNTID);
    final int jsondataColumn = ih.getColumnIndex(RepostsTable.RepostDataTable.JSONDATA);

    try {
        getWsd().beginTransaction();
        for (int i = 0; i < size; i++) {

            MessageBean msg = msgList.get(i);
            ih.prepareForInsert();
            if (msg != null) {
                ih.bind(mblogidColumn, msg.getId());
                ih.bind(accountidColumn, accountId);
                String json = gson.toJson(msg);
                ih.bind(jsondataColumn, json);
            } else {
                ih.bind(mblogidColumn, "-1");
                ih.bind(accountidColumn, accountId);
                ih.bind(jsondataColumn, "");
            }
            ih.execute();

        }
        getWsd().setTransactionSuccessful();
    } catch (SQLException e) {
    } finally {
        getWsd().endTransaction();
        ih.close();
    }
    reduceRepostTable(accountId);
}
 
開發者ID:andforce,項目名稱:iBeebo,代碼行數:38,代碼來源:MentionWeiboTimeLineDBTask.java


注:本文中的android.database.DatabaseUtils.InsertHelper方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。