diff options
author | bartolomiew <bart_olomiew@yahoo.fr> | 2012-10-27 19:31:00 +0200 |
---|---|---|
committer | James Moger <james.moger@gmail.com> | 2012-11-02 14:30:39 -0400 |
commit | 1f06dc3216fdb327a60bb3e46a35c948c69d4b97 (patch) | |
tree | 1974d1de608d50e2f52a24c8f97207797bc7f460 /src/com/iciql/IciqlException.java | |
parent | 6d3704b7bad4732a289c0be68e8f18a1fdf8abac (diff) | |
download | iciql-1f06dc3216fdb327a60bb3e46a35c948c69d4b97.tar.gz iciql-1f06dc3216fdb327a60bb3e46a35c948c69d4b97.zip |
return SQL error code even if uncharacterized
Diffstat (limited to 'src/com/iciql/IciqlException.java')
-rw-r--r-- | src/com/iciql/IciqlException.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/com/iciql/IciqlException.java b/src/com/iciql/IciqlException.java index 38c8fac..b457a10 100644 --- a/src/com/iciql/IciqlException.java +++ b/src/com/iciql/IciqlException.java @@ -1,5 +1,6 @@ /*
* Copyright 2011 James Moger.
+ * Copyright 2012 Frederic Gaillard
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +31,7 @@ public class IciqlException extends RuntimeException { public static final int CODE_OBJECT_NOT_FOUND = 3;
public static final int CODE_OBJECT_ALREADY_EXISTS = 4;
public static final int CODE_CONSTRAINT_VIOLATION = 5;
+ public static final int CODE_UNCHARACTERIZED = 6;
private static final String TOKEN_UNMAPPED_FIELD = "\\? (=|\\>|\\<|\\<\\>|!=|\\>=|\\<=|LIKE|BETWEEN) \\?";
@@ -152,6 +154,9 @@ public class IciqlException extends RuntimeException { } else if ("X0Y25".equals(state)) {
// Derby constraint violation
iciqlCode = CODE_CONSTRAINT_VIOLATION;
+ } else {
+ // uncharacterized SQL code, we can always rely on iciqlCode != 0 in IciqlException
+ iciqlCode = s.getErrorCode() == 0 ? CODE_UNCHARACTERIZED : s.getErrorCode();
}
}
}
|