summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Moger <james.moger@gmail.com>2011-08-08 12:03:10 -0400
committerJames Moger <james.moger@gmail.com>2011-08-08 12:03:10 -0400
commitd5a74dcac41eeb96a656b7033e43d51b92f75d18 (patch)
tree2fb7d174ddbf0c2fea64666917d992daae00398f /src
parent35973f16d6e408fff3e9eeeda4dac4ab3f7cb048 (diff)
downloadiciql-d5a74dcac41eeb96a656b7033e43d51b92f75d18.tar.gz
iciql-d5a74dcac41eeb96a656b7033e43d51b92f75d18.zip
Fixed first enum constant special case. (issue 4)
Diffstat (limited to 'src')
-rw-r--r--src/com/iciql/Query.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/com/iciql/Query.java b/src/com/iciql/Query.java
index 2d31e8d..2e58fe5 100644
--- a/src/com/iciql/Query.java
+++ b/src/com/iciql/Query.java
@@ -359,6 +359,15 @@ public class Query<T> {
token.appendSQL(stat, this);
return;
}
+ if (alias != null && value.getClass().isEnum()) {
+ // special case:
+ // value is first enum constant which is also the alias object.
+ // the first enum constant is used as the alias because we can not
+ // instantiate an enum reflectively.
+ stat.appendSQL("?");
+ addParameter(stat, alias, value);
+ return;
+ }
SelectColumn<T> col = aliasMap.get(value);
if (col != null) {
col.appendSQL(stat);