java.sql.Array.getBaseTypeName()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中java.sql.Array.getBaseTypeName()方法的一些代码示例,展示了Array.getBaseTypeName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Array.getBaseTypeName()方法的具体详情如下:
包路径:java.sql.Array
类名称:Array
方法名:getBaseTypeName

Array.getBaseTypeName介绍

[英]Returns the SQL type name of the entries in this array's underlying SQL array.
[中]返回此数组的基础SQL数组中的项的SQL类型名称。

代码示例

代码示例来源:origin: postgresql/postgresql

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);
}

代码示例来源:origin: org.postgresql/postgresql

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);
}

代码示例来源:origin: uk.ac.ebi.ols/ols-core

/**
* 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();
}

代码示例来源:origin: co.paralleluniverse/comsat-jdbc

@Override
  public String call() throws SQLException {
    return array.getBaseTypeName();
  }
});

代码示例来源:origin: org.apache.sentry/sentry-shaded-miscellaneous

/** 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;
}

代码示例来源:origin: korpling/ANNIS

Validate.isTrue(sqlKey.getBaseType() == Types.BIGINT,
 "Key in database must be from the type \"bigint\" but was \"" + sqlKey.
 getBaseTypeName() + "\"");

代码示例来源:origin: korpling/ANNIS

Validate.isTrue(sqlKey.getBaseType() == Types.BIGINT,
 "Key in database must be from the type \"bigint\" but was \"" + sqlKey.
 getBaseTypeName() + "\"");

代码示例来源:origin: org.apache.calcite.avatica/avatica-server

array.getBaseTypeName(), rep);

代码示例来源:origin: apache/calcite-avatica

array.getBaseTypeName(), rep);

代码示例来源:origin: org.ancoron.postgresql/org.postgresql

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);
}

代码示例来源:origin: korpling/ANNIS

Validate.isTrue(sqlKey.getBaseType() == Types.BIGINT,
 "Key in database must be from the type \"bigint\" but was \""
 + sqlKey.getBaseTypeName() + "\"");

代码示例来源:origin: org.ancoron.postgresql/org.postgresql.osgi

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);
}

代码示例来源:origin: org.jboss.spec.javax.sql/jboss-javax-sql-api_7.0_spec

baseTypeName = array.getBaseTypeName();
len = elements.length;

代码示例来源:origin: net.sf.jt400/jt400

/**
 * 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);
}

代码示例来源:origin: org.jboss.spec.javax.sql/jboss-javax-sql-api_7.0_spec

baseTypeName = array.getBaseTypeName();
len = elements.length;

相关文章

微信公众号

最新文章

更多