public Array createArrayOf(String typeName, Object[] elements) throws SQLException { checkClosed(); int oid = getTypeInfo().getPGArrayType(typeName); if (oid == Oid.UNSPECIFIED) throw new PSQLException(GT.tr("Unable to find server array type for provided name {0}.", typeName), PSQLState.INVALID_NAME); StringBuffer sb = new StringBuffer(); appendArray(sb, elements); // This will not work once we have a JDBC 5, // but it'll do for now. return new Jdbc4Array(this, oid, sb.toString()); }
@Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException { checkClosed(); int oid = getTypeInfo().getPGArrayType(typeName); if (oid == Oid.UNSPECIFIED) { throw new PSQLException( GT.tr("Unable to find server array type for provided name {0}.", typeName), PSQLState.INVALID_NAME); } if (elements == null) { return makeArray(oid, null); } char delim = getTypeInfo().getArrayDelimiter(oid); StringBuilder sb = new StringBuilder(); appendArray(sb, elements, delim); return makeArray(oid, sb.toString()); }
public void setArray(int i, java.sql.Array x) throws SQLException { checkClosed(); if (null == x) { setNull(i, Types.ARRAY); return; } // This only works for Array implementations that return a valid array // literal from Array.toString(), such as the implementation we return // from ResultSet.getArray(). Eventually we need a proper implementation // here that works for any Array implementation. String typename = x.getBaseTypeName(); int oid = connection.getTypeInfo().getPGArrayType(typename); if (oid == Oid.UNSPECIFIED) { throw new PSQLException(GT.tr("Unknown type {0}.", typename), PSQLState.INVALID_PARAMETER_TYPE); } if (x instanceof PgArray) { PgArray arr = (PgArray) x; if (arr.isBinary()) { bindBytes(i, arr.toBytes(), oid); return; } } setString(i, x.toString(), oid); }
final int oid = typeInfo.getPGArrayType(typeName); final char delim = typeInfo.getArrayDelimiter(oid);
public Array createArrayOf(String typeName, Object[] elements) throws SQLException { int oid = getTypeInfo().getPGArrayType(typeName); if (oid == Oid.UNSPECIFIED) throw new PSQLException(GT.tr("Unable to find server array type for provided name {0}.", typeName), PSQLState.INVALID_NAME); StringBuffer sb = new StringBuffer(); appendArray(sb, elements); // This will not work once we have a JDBC 5, // but it'll do for now. return new Jdbc4Array(this, oid, sb.toString()); }
public Array createArrayOf(String typeName, Object[] elements) throws SQLException { checkClosed(); int oid = getTypeInfo().getPGArrayType(typeName); if (oid == Oid.UNSPECIFIED) throw new PSQLException(GT.tr("Unable to find server array type for provided name {0}.", typeName), PSQLState.INVALID_NAME); StringBuffer sb = new StringBuffer(); appendArray(sb, elements); // This will not work once we have a JDBC 5, // but it'll do for now. return new Jdbc4Array(this, oid, sb.toString()); }