当前位置: 首页>>代码示例>>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;未经允许,请勿转载。