We need the connection during the binding step for Postgres array machinations.
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
package com.samskivert.depot.impl;
|
package com.samskivert.depot.impl;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -731,14 +732,15 @@ public abstract class BuildVisitor implements ExpressionVisitor<Void>
|
|||||||
|
|
||||||
protected static interface Bindable
|
protected static interface Bindable
|
||||||
{
|
{
|
||||||
void doBind (PreparedStatement stmt, int argIx) throws Exception;
|
void doBind (Connection conn, PreparedStatement stmt, int argIx) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Bindable newBindable (
|
protected static Bindable newBindable (
|
||||||
final DepotMarshaller<?> marshaller, final String field, final Object pojo)
|
final DepotMarshaller<?> marshaller, final String field, final Object pojo)
|
||||||
{
|
{
|
||||||
return new Bindable() {
|
return new Bindable() {
|
||||||
public void doBind (PreparedStatement stmt, int argIx) throws Exception {
|
public void doBind (Connection conn, PreparedStatement stmt, int argIx)
|
||||||
|
throws Exception {
|
||||||
marshaller.getFieldMarshaller(field).getAndWriteToStatement(stmt, argIx, pojo);
|
marshaller.getFieldMarshaller(field).getAndWriteToStatement(stmt, argIx, pojo);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -747,7 +749,8 @@ public abstract class BuildVisitor implements ExpressionVisitor<Void>
|
|||||||
protected static Bindable newBindable (final Object value)
|
protected static Bindable newBindable (final Object value)
|
||||||
{
|
{
|
||||||
return new Bindable() {
|
return new Bindable() {
|
||||||
public void doBind (PreparedStatement stmt, int argIx) throws Exception {
|
public void doBind (Connection conn, PreparedStatement stmt, int argIx)
|
||||||
|
throws Exception {
|
||||||
// TODO: how can we abstract this fieldless marshalling
|
// TODO: how can we abstract this fieldless marshalling
|
||||||
if (value instanceof ByteEnum) {
|
if (value instanceof ByteEnum) {
|
||||||
// byte enums require special conversion
|
// byte enums require special conversion
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public abstract class SQLBuilder
|
|||||||
int argIx = 1;
|
int argIx = 1;
|
||||||
for (BuildVisitor.Bindable bindable : _buildVisitor.getBindables()) {
|
for (BuildVisitor.Bindable bindable : _buildVisitor.getBindables()) {
|
||||||
try {
|
try {
|
||||||
bindable.doBind(stmt, argIx);
|
bindable.doBind(conn, stmt, argIx);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warning("Failed to bind statement argument", "argIx", argIx);
|
log.warning("Failed to bind statement argument", "argIx", argIx);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user