Created
February 3, 2009 22:39
-
-
Save brianm/57806 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.skife.jdbi.v2.tweak.Argument; | |
import org.skife.jdbi.v2.StatementContext; | |
import java.sql.PreparedStatement; | |
import java.sql.SQLException; | |
import oracle.sql.ArrayDescriptor; | |
import oracle.sql.ARRAY; | |
/** | |
* | |
*/ | |
public class VArrayArgument implements Argument | |
{ | |
private final String typeName; | |
private final Object arg; | |
public VArrayArgument(String typeName, Object arg) { | |
this.typeName = typeName; | |
this.arg = arg; | |
} | |
public void apply(int i, PreparedStatement stmt, StatementContext ctx) throws SQLException { | |
ArrayDescriptor desc = ArrayDescriptor.createDescriptor(typeName, stmt.getConnection()); | |
ARRAY varray = new ARRAY(desc, stmt.getConnection(), arg); | |
stmt.setObject(i, varray); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment