On Fri, 17 Jul 2009 23:46:31 -0700, "Jim Showalter"
<[email protected]> wrote:
>
>It's an update.
>
>The Java code for my DataAccessor (a lightweight wrapper over
>Android's wrapper over SQLite) checks the ID. If the ID is set to -1,
>it's an insert, otherwise it's an update.
>
>A Word (word2) has been previously saved, and its ID has been saved to
>word2Id.
>
>The test code is doing this:
>
>Word differentTextWord = new Word();
>differentTextWord.setId(word2Id); <<< reuse existing ID
>differentTextWord.setText(word2.getText() + "_different");
>
>boolean caughtExpectedException = false;
>
>try
>{
> dataAccessor.saveWord(differentTextWord);
>}
>catch (SQLiteConstraintException e)
>{
> caughtExpectedException = true;
>}
>
>assertTrue(caughtExpectedException); <<<< this fails
SQLiteConstraintException sounds like a Java thing,
implemented by the wrapper, not the SQLite library itself.
I don't think the RAISE() in the trigger would raise a Java
exception by itself. Probably the wrapper doesn't raise an
exception when the sqlite library returns an error.
>I don't know how to test this with the SQLite console,
>because it's actually running on the Android emulator.
Indeed. IMHO this is a problem with the usage of the sqlite
API.
--
( Kees Nuyt
)
c[_]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users