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. // Use a typename that is "_" plus the base type; this matches how the // backend looks for array types. String typename = "_" + x.getBaseTypeName(); int oid = connection.getTypeInfo().getPGType(typename); if (oid == Oid.UNSPECIFIED) throw new PSQLException(GT.tr("Unknown type {0}.", typename), PSQLState.INVALID_PARAMETER_TYPE); setString(i, x.toString(), oid); }
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); }
/** * Formats an Array to the following String "array.getBaseTypeName()" * This method's output will not translate directly into the database. It is informational only. * @param array The array to be translated * @return The base name of the array * @exception SQLException * */ protected String format(java.sql.Array array)throws SQLException{ return array.getBaseTypeName(); }
@Override public String call() throws SQLException { return array.getBaseTypeName(); } });
/** Formatter for debugging purposes only. * @param obj to print * @return String */ private static String formatLogParam(Array obj) { String result=""; try { result= "(array of type"+obj.getBaseTypeName().length()+")"; } catch (SQLException e) { result = "(array of unknown type)"; } return result; }
Validate.isTrue(sqlKey.getBaseType() == Types.BIGINT, "Key in database must be from the type \"bigint\" but was \"" + sqlKey. getBaseTypeName() + "\"");
Validate.isTrue(sqlKey.getBaseType() == Types.BIGINT, "Key in database must be from the type \"bigint\" but was \"" + sqlKey. getBaseTypeName() + "\"");
array.getBaseTypeName(), rep);
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. // Use a typename that is "_" plus the base type; this matches how the // backend looks for array types. String typename = "_" + x.getBaseTypeName(); int oid = connection.getTypeInfo().getPGType(typename); if (oid == Oid.UNSPECIFIED) throw new PSQLException(GT.tr("Unknown type {0}.", typename), PSQLState.INVALID_PARAMETER_TYPE); setString(i, x.toString(), oid); }
Validate.isTrue(sqlKey.getBaseType() == Types.BIGINT, "Key in database must be from the type \"bigint\" but was \"" + sqlKey.getBaseTypeName() + "\"");
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. // Use a typename that is "_" plus the base type; this matches how the // backend looks for array types. String typename = "_" + x.getBaseTypeName(); int oid = connection.getTypeInfo().getPGType(typename); if (oid == Oid.UNSPECIFIED) throw new PSQLException(GT.tr("Unknown type {0}.", typename), PSQLState.INVALID_PARAMETER_TYPE); setString(i, x.toString(), oid); }
baseTypeName = array.getBaseTypeName(); len = elements.length;
/** * Sets an input parameter to an Array value. DB2 for IBM i only supports * arrays in stored procedures. * * @param parameterIndex * The parameter index (1-based). * @param parameterValue * The parameter value. * @exception SQLException * Always thrown because DB2 for IBM i does not support arrays. **/ public void setArray(int parameterIndex, Array parameterValue) throws SQLException { // @array new support if (JDTrace.isTraceOn()) { JDTrace.logInformation(this, "setArray()"); if (parameterValue == null) JDTrace.logInformation(this, "parameter index: " + parameterIndex + " value: NULL"); else JDTrace.logInformation(this, "parameter index: " + parameterIndex + " value: Array type " + parameterValue.getBaseTypeName()); } if (!sqlStatement_.isProcedureCall()) // @array JDError.throwSQLException(this, JDError.EXC_PARAMETER_TYPE_INVALID); // @array setValue(parameterIndex, parameterValue, null, -1); }
baseTypeName = array.getBaseTypeName(); len = elements.length;