kaleidos / grails-postgresql-extensions

Grails plugin to use postgresql native elements such as arrays, hstores,...
Apache License 2.0
78 stars 62 forks source link

[Hibernate4] Support for array citext (case insensitive strings) #45

Open ilopmar opened 10 years ago

ilopmar commented 10 years ago

This PR is to fix the issue #26. Is not finished yet, some tests are missing. Please do not merge it.

@Alotor please review it and check specially the comment of ArrayType file. If you're not sure about merge it, we can at the office when I return from my holidays.

coveralls commented 10 years ago

Coverage Status

Coverage increased (+0.56%) when pulling 58706191623adabb1b1e0dc02e9c06e53915dffe on hibernate4/array_citext into 6b9218a969c0add2e5587f0da9c6a4bff1e6df43 on master.

Alotor commented 10 years ago

I think when the type is a "citext" we should use getObject instead of getArray because is not a standard JDBC but a Postgres specific type. I had the same problem with the ranges support.

I think it's better to use getObject and then parse the String to change it into a String array.

ilopmar commented 10 years ago

Ok, I'll try to change it using your code of ranges as a guide

ilopmar commented 10 years ago

You're absolutely right, I don't know what I was thinking.

I used getObject for the json support but I don't think about it for the citext. Last night I did some tests and it works. Now I only have to find a good parser from string to array because I'm not going to write one from scratch :-P

coveralls commented 10 years ago

Coverage Status

Coverage increased (+0.52%) when pulling c0bd6662ee21ec8fcaf911d270c1e1d9ce3fa97f on hibernate4/array_citext into cc40563364516f4300a0b3cf4ee7093bfe9ef672 on master.

coveralls commented 10 years ago

Coverage Status

Coverage increased (+0.52%) when pulling 285362a29ce421a6a0cf4ff1c96ff2f9e27113d6 on hibernate4/array_citext into bbc1cb4a79b1356efd4b913f57cbc7c9bc1871e3 on master.

aeischeid commented 10 years ago

Sorry I haven't had time to try this. Actually not sure how to try it without a release version to plug into my config.groovy file.

ilopmar commented 10 years ago

@aeischeid Currently the feature is not complete and the code is pretty ugly so we're not going to merge and release a new version with this. We're working on a way to parse the string with the postgres array to a java String[].

In any case, if you want to try you can clone the repo and define the plugin as inline instead of use a published version. You can add to your BuildConfig.groovy:

grails.plugin.location."postgresql-extensions" = "../postgresql-extensions"

And remove the line in the plugins section.