本文整理汇总了Java中android.database.sqlite.SQLiteConstraintException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java SQLiteConstraintException.printStackTrace方法的具体用法?Java SQLiteConstraintException.printStackTrace怎么用?Java SQLiteConstraintException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.database.sqlite.SQLiteConstraintException
的用法示例。
在下文中一共展示了SQLiteConstraintException.printStackTrace方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertAchievementExplorer
import android.database.sqlite.SQLiteConstraintException; //导入方法依赖的package包/类
public boolean insertAchievementExplorer(final Context preferenceContext, String email, int idAchievement) {
try{
setAction(false);
AchievementExplorerRequest achievementExplorerRequest = new AchievementExplorerRequest(email, idAchievement);
achievementExplorerRequest.requestUpdateAchievements(preferenceContext, new AchievementExplorerRequest.Callback() {
@Override
public void callbackResponse(boolean response) {
setResponse(true);
setAction(true);
}
@Override
public void callbackResponse(List<Achievement> achievements) {}
});
}catch(SQLiteConstraintException exception){
exception.printStackTrace();
}
return true;
}
示例2: insertManga
import android.database.sqlite.SQLiteConstraintException; //导入方法依赖的package包/类
public boolean insertManga(Manga manga) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(TABLE_MANGA_NAME, manga.getName());
contentValues.put(TABLE_MANGA_URL, manga.getUrl());
contentValues.put(TABLE_MANGA_IMAGE, manga.getImage());
contentValues.put(TABLE_MANGA_LATEST, manga.getLatest());
try {
db.insertOrThrow(TABLE_MANGA, null, contentValues);
} catch (SQLiteConstraintException e) {
e.printStackTrace();
System.out.println("Failed to insert");
return false;
}
System.out.println("inserted");
return true;
}
示例3: insertRecentChapter
import android.database.sqlite.SQLiteConstraintException; //导入方法依赖的package包/类
public boolean insertRecentChapter(Manga manga, Chapter chapter) {
SQLiteDatabase db = this.getWritableDatabase();
deleteRecentChapter(manga.getName());
ContentValues contentValues = new ContentValues();
contentValues.put(TABLE_RECENT_MANGA_NAME, manga.getName());
contentValues.put(TABLE_RECENT_MANGA_IMAGE, manga.getImage());
contentValues.put(TABLE_RECENT_MANGA_URL, manga.getUrl());
contentValues.put(TABLE_RECENT_CHAPTER_NAME, chapter.getName());
contentValues.put(TABLE_RECENT_CHAPTER_URL, chapter.getUrl());
try {
db.insertOrThrow(TABLE_RECENT, null, contentValues);
} catch (SQLiteConstraintException e) {
e.printStackTrace();
System.out.println("recent not inserted");
return false;
}
System.out.println("recent inserted");
return true;
}
示例4: insert
import android.database.sqlite.SQLiteConstraintException; //导入方法依赖的package包/类
public void insert(CustomRules rule)
{
try
{
rulesDao.insert(rule);
}
catch (SQLiteConstraintException ex)
{
ex.printStackTrace();
}
}
示例5: insertOrUpdate
import android.database.sqlite.SQLiteConstraintException; //导入方法依赖的package包/类
public void insertOrUpdate(CustomRules rule)
{
try
{
rulesDao.insertOrReplace(rule);
}
catch (SQLiteConstraintException ex)
{
ex.printStackTrace();
}
}
示例6: deleteMyCamera
import android.database.sqlite.SQLiteConstraintException; //导入方法依赖的package包/类
public boolean deleteMyCamera(MyCameraInfo myCamera) {
try {
mDatabase.execSQL("DELETE FROM MyCamera WHERE IP=? AND PORT=?", new String[]{myCamera.getIP(), myCamera.getPort() + ""});
return true;
} catch (SQLiteConstraintException e) {
e.printStackTrace();
}
return false;
}
示例7: saveMyCamera
import android.database.sqlite.SQLiteConstraintException; //导入方法依赖的package包/类
public boolean saveMyCamera(MyCameraInfo myCameraInfo) {
try {
mDatabase.execSQL("INSERT INTO MyCamera(IP,PORT,PASSWORD,NOTE,DEVICE_ID,CAM_NUMBER,TYPE) VALUES (?,?,?,?,?,?,?)",
new String[]{myCameraInfo.getIP(), myCameraInfo.getPort() + "", myCameraInfo.getPassword(), myCameraInfo.getNote(),
myCameraInfo.getDeviceId(), myCameraInfo.getCamNumber() + "", myCameraInfo.getType() + ""});
return true;
} catch (SQLiteConstraintException e) {
e.printStackTrace();
}
return false;
}
示例8: updateMyCamera
import android.database.sqlite.SQLiteConstraintException; //导入方法依赖的package包/类
public boolean updateMyCamera(String oldIP, int oldPort, MyCameraInfo myCameraInfo) {
try {
mDatabase.execSQL("UPDATE MyCamera SET IP=?,PORT=?,PASSWORD=?,NOTE=?,DEVICE_ID=?,CAM_NUMBER=?,TYPE=? WHERE IP=? AND PORT=?", new String[]{
myCameraInfo.getIP(), myCameraInfo.getPort() + "", myCameraInfo.getPassword(), myCameraInfo.getNote(), myCameraInfo.getDeviceId(), myCameraInfo.getCamNumber() + "", myCameraInfo.getType() + "",
oldIP, oldPort + ""
});
return true;
} catch (SQLiteConstraintException e) {
e.printStackTrace();
}
return false;
}
示例9: doInBackground
import android.database.sqlite.SQLiteConstraintException; //导入方法依赖的package包/类
@Override
protected Void doInBackground(Void... params) {
String sql = "INSERT INTO " + TB_USER_SEX + " VALUES(\"" + userId + "\", " + sex
+ ")";
try {
db.execSQL(sql);
} catch (SQLiteConstraintException e) {
e.printStackTrace();
}
db.close();
return null;
}