summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/iciql/IciqlException.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-11-03 11:05:52 -0500
committerJames Moger <james.moger@gitblit.com>2014-11-03 12:51:16 -0500
commit6f486197c5aae3246e8175b828fe3e4c8de3906d (patch)
tree46de7bfadab22efb3293364970bc10c937bcb45d /src/main/java/com/iciql/IciqlException.java
parente4e9fdae539ec85552755b3a7799b75dbb7c4812 (diff)
downloadiciql-6f486197c5aae3246e8175b828fe3e4c8de3906d.tar.gz
iciql-6f486197c5aae3246e8175b828fe3e4c8de3906d.zip
Add support for SQLite 3.8.7
Diffstat (limited to 'src/main/java/com/iciql/IciqlException.java')
-rw-r--r--src/main/java/com/iciql/IciqlException.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/main/java/com/iciql/IciqlException.java b/src/main/java/com/iciql/IciqlException.java
index 3f27b73..3db62cf 100644
--- a/src/main/java/com/iciql/IciqlException.java
+++ b/src/main/java/com/iciql/IciqlException.java
@@ -101,7 +101,7 @@ public class IciqlException extends RuntimeException {
// MySQL duplicate primary key on insert
iciqlCode = CODE_DUPLICATE_KEY;
if (s.getErrorCode() == 1217) {
- iciqlCode = CODE_CONSTRAINT_VIOLATION;
+ iciqlCode = CODE_CONSTRAINT_VIOLATION;
}
} else if ("23505".equals(state)) {
// Derby duplicate primary key on insert
@@ -154,6 +154,24 @@ public class IciqlException extends RuntimeException {
} else if ("X0Y25".equals(state)) {
// Derby constraint violation
iciqlCode = CODE_CONSTRAINT_VIOLATION;
+ } else if (s.getMessage().startsWith("[SQLITE")) {
+ // SQLite error codes
+ final String msg = s.getMessage();
+ switch (s.getErrorCode()) {
+ case 1:
+ iciqlCode = CODE_OBJECT_NOT_FOUND;
+ break;
+ case 19:
+ if (msg.contains("UNIQUE")) {
+ iciqlCode = CODE_DUPLICATE_KEY;
+ } else {
+ iciqlCode = CODE_CONSTRAINT_VIOLATION;
+ }
+ break;
+ default:
+ iciqlCode = s.getErrorCode();
+ break;
+ }
} else {
// uncharacterized SQL code, we can always rely on iciqlCode != 0 in IciqlException
iciqlCode = s.getErrorCode() == 0 ? CODE_UNCHARACTERIZED : s.getErrorCode();