org.litepal.exceptions.DataSupportException Java Examples
The following examples show how to use
org.litepal.exceptions.DataSupportException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShelfAdapter.java From Jreader with GNU General Public License v2.0 | 5 votes |
/** * 数据库书本信息更新 * @param databaseId 要更新的数据库的书本ID * @param bookList * @param bookList1 */ public void upDateBookToSqlite3(final int databaseId,final BookList bookList,final BookList bookList1) { putAsyncTask(new AsyncTask<Void, Void, Boolean>() { @Override protected void onPreExecute() { } @Override protected Boolean doInBackground(Void... params) { try { bookList.update(databaseId); bookList1.update(databaseId); } catch (DataSupportException e) { return false; } return true; } @Override protected void onPostExecute(Boolean result) { if (result) { } else { Log.d("保存到数据库结果-->", "失败"); } } }); }
Example #2
Source File: QueryBySQLTest.java From LitePal with Apache License 2.0 | 5 votes |
@Test public void testQueryBySQLWithWrongParams() { try { LitePal.findBySQL("select * from " + bookTable + " where id=? and bookname=? and pages=?", String.valueOf(book.getId()), "数据库"); fail(); } catch (DataSupportException e) { assertEquals("The parameters in conditions are incorrect.", e.getMessage()); } Cursor cursor = LitePal.findBySQL(new String[] {}); assertNull(cursor); cursor = LitePal.findBySQL(); assertNull(cursor); }
Example #3
Source File: UpdateUsingUpdateMethodTest.java From LitePal with Apache License 2.0 | 5 votes |
@Test public void testUpdateToDefaultValueWithInstanceUpdateButWrongField() { try { Teacher t = new Teacher(); t.setToDefault("name"); t.update(t.getId()); fail(); } catch (DataSupportException e) { assertEquals( "The name field in com.litepaltest.model.Teacher class is necessary which does not exist.", e.getMessage()); } }
Example #4
Source File: UpdateUsingUpdateMethodTest.java From LitePal with Apache License 2.0 | 5 votes |
@Test public void testUpdateWithInstanceUpdateWithConstructor() { try { Computer computer = new Computer("ACER", 5444); computer.save(); computer.update(computer.getId()); fail(); } catch (DataSupportException e) { assertEquals("com.litepaltest.model.Computer needs a default constructor.", e.getMessage()); } }
Example #5
Source File: UpdateUsingUpdateMethodTest.java From LitePal with Apache License 2.0 | 5 votes |
@Test public void testUpdateAllToDefaultValueWithInstanceUpdateButWrongField() { try { Teacher t = new Teacher(); t.setToDefault("name"); t.updateAll(""); fail(); } catch (DataSupportException e) { assertEquals( "The name field in com.litepaltest.model.Teacher class is necessary which does not exist.", e.getMessage()); } }