-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array support? #11
Comments
Not a thought, per se, but I tried hacking on this briefly this morning. I tried changing the "prepare" method to: @tailrec
private[jdub] def prepare(stmt: PreparedStatement, values: Seq[Any], index: Int = 1) {
if (!values.isEmpty) {
val v = values.head
if (v == null) {
stmt.setNull(index, Types.NULL)
} else if(v.isInstanceOf[Array[_]]) {
stmt.setObject(index, v.asInstanceOf[AnyRef], Types.ARRAY)
} else {
stmt.setObject(index, v.asInstanceOf[AnyRef])
}
prepare(stmt, values.tail, index + 1)
}
} Unfortunately, when I tried using this with the "org.postgresql.Driver" driver, I got:
Unfortunately, I'm not seeing a way to get an Array in there easily (using only a PreparedStatement). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure what the best way to do this, but to work with arrays in Postgres, we need access to the connection object to call a method on it:
When products was an Iterable...
It'd be nice if this could be folded into prepare in Utils.scala somehow, but not sure how given the type name parameter...
Thoughts?
The text was updated successfully, but these errors were encountered: