本文整理匯總了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;
}