当前位置: 首页>>代码示例>>Java>>正文


Java Struct类代码示例

本文整理汇总了Java中java.sql.Struct的典型用法代码示例。如果您正苦于以下问题:Java Struct类的具体用法?Java Struct怎么用?Java Struct使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Struct类属于java.sql包,在下文中一共展示了Struct类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getObject

import java.sql.Struct; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
    if (type == null) {
        throw SQLError.createSQLException("Type parameter can not be null", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor());
    }

    if (type.equals(Struct.class)) {
        throw new SQLFeatureNotSupportedException();
    } else if (type.equals(RowId.class)) {
        return (T) getRowId(columnIndex);
    } else if (type.equals(NClob.class)) {
        return (T) getNClob(columnIndex);
    } else if (type.equals(SQLXML.class)) {
        return (T) getSQLXML(columnIndex);
    }

    return super.getObject(columnIndex, type);
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:19,代码来源:JDBC4ResultSet.java

示例2: buildJdbcJavaClassMappings

import java.sql.Struct; //导入依赖的package包/类
private static ConcurrentHashMap<Class, Integer> buildJdbcJavaClassMappings() {
	ConcurrentHashMap<Class, Integer> jdbcJavaClassMappings = new ConcurrentHashMap<Class, Integer>();

	// these mappings are the ones outlined specifically in the spec
	jdbcJavaClassMappings.put( String.class, Types.VARCHAR );
	jdbcJavaClassMappings.put( BigDecimal.class, Types.NUMERIC );
	jdbcJavaClassMappings.put( Boolean.class, Types.BIT );
	jdbcJavaClassMappings.put( Integer.class, Types.INTEGER );
	jdbcJavaClassMappings.put( Long.class, Types.BIGINT );
	jdbcJavaClassMappings.put( Float.class, Types.REAL );
	jdbcJavaClassMappings.put( Double.class, Types.DOUBLE );
	jdbcJavaClassMappings.put( byte[].class, Types.LONGVARBINARY );
	jdbcJavaClassMappings.put( java.sql.Date.class, Types.DATE );
	jdbcJavaClassMappings.put( Time.class, Types.TIME );
	jdbcJavaClassMappings.put( Timestamp.class, Types.TIMESTAMP );
	jdbcJavaClassMappings.put( Blob.class, Types.BLOB );
	jdbcJavaClassMappings.put( Clob.class, Types.CLOB );
	jdbcJavaClassMappings.put( Array.class, Types.ARRAY );
	jdbcJavaClassMappings.put( Struct.class, Types.STRUCT );
	jdbcJavaClassMappings.put( Ref.class, Types.REF );
	jdbcJavaClassMappings.put( Class.class, Types.JAVA_OBJECT );

	// additional "common sense" registrations
	jdbcJavaClassMappings.put( Character.class, Types.CHAR );
	jdbcJavaClassMappings.put( char[].class, Types.VARCHAR );
	jdbcJavaClassMappings.put( Character[].class, Types.VARCHAR );
	jdbcJavaClassMappings.put( Byte[].class, Types.LONGVARBINARY );
	jdbcJavaClassMappings.put( java.util.Date.class, Types.TIMESTAMP );
	jdbcJavaClassMappings.put( Calendar.class, Types.TIMESTAMP );

	return jdbcJavaClassMappings;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:JdbcTypeJavaClassMappings.java

示例3: getStruct

import java.sql.Struct; //导入依赖的package包/类
@Override public Struct getStruct() throws SQLException {
  final Object o = super.getObject();
  if (o == null) {
    return null;
  } else if (o instanceof StructImpl) {
    return (StructImpl) o;
  } else if (o instanceof List) {
    return new StructImpl((List) o);
  } else {
    final List<Object> list = new ArrayList<>();
    for (Accessor fieldAccessor : fieldAccessors) {
      try {
        list.add(fieldAccessor.getObject());
      } catch (SQLException e) {
        throw new RuntimeException(e);
      }
    }
    return new StructImpl(list);
  }
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:21,代码来源:AbstractCursor.java

示例4: treatReturn

import java.sql.Struct; //导入依赖的package包/类
/**
 * Tratar o retorno vido do java
 * @param result
 * @param returnType
 * @return 
 */
@SuppressWarnings("CallToPrintStackTrace")
private static Object treatReturn (Object result, int returnType)
{
    Object currectObject = result;
    try
    {
        if (returnType == ARRAY && result instanceof Array)
        {
            Array r = (Array) result;
            currectObject = new ArrayList<> (Arrays.asList((Object [])r.getArray()));
        }
        else if (Types.STRUCT == returnType)
        {
            System.out.println("dbdkj");
            currectObject = ((Struct) result).getAttributes();
        }
    }catch(Exception ex)
    {
        ex.printStackTrace();
    }
    if(currectObject != null)
        
        System.out.println("RETURN = class{"+currectObject.getClass().getName()+"} | toString = "+currectObject.toString()+"\n");
    return currectObject;
}
 
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:32,代码来源:Call.java

示例5: createStruct

import java.sql.Struct; //导入依赖的package包/类
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    checkClosed();

    try {
        return ((java.sql.Connection) this.mc).createStruct(typeName, attributes);
    } catch (SQLException sqlException) {
        checkAndFireConnectionError(sqlException);
    }

    return null; // never reached, but compiler can't tell
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:12,代码来源:JDBC4ConnectionWrapper.java

示例6: createStruct

import java.sql.Struct; //导入依赖的package包/类
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
{
	try
	{
		return realConnection.createStruct(typeName, attributes);
	}
	catch(SQLException s)
	{
		String methodCall = "createStruct(" + typeName + ", " + attributes + ")";
		reportException(methodCall, s, null);
		throw s;
	}
}
 
开发者ID:skeychen,项目名称:dswork.jdbc,代码行数:14,代码来源:ConnectionSpy.java

示例7: test08

import java.sql.Struct; //导入依赖的package包/类
@Test(enabled = true)
public void test08() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    Struct s = new StubStruct(sqlType, attributes);
    outImpl.writeStruct(s);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:SQLOutputImplTests.java

示例8: test11

import java.sql.Struct; //导入依赖的package包/类
@Test()
public void test11() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    map.put(sqlType, Class.forName("util.SuperHero"));
    Struct struct = new StubStruct(sqlType, attributes);
    Object[] values = {struct};
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Object o = sqli.readObject();

    assertTrue(hero.equals(o));

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:SQLInputImplTests.java

示例9: getObject

import java.sql.Struct; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override public <T> T getObject(Class<T> clz) throws SQLException {
  // getStruct() is not exposed on Accessor, only AccessorImpl. getObject(Class) is exposed,
  // so we can make it do the right thing (call getStruct()).
  if (clz.equals(Struct.class)) {
    return (T) getStruct();
  }
  return super.getObject(clz);
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:10,代码来源:AbstractCursor.java

示例10: createStruct

import java.sql.Struct; //导入依赖的package包/类
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
  throwIfClosed();
  try {
    return super.createStruct(typeName, attributes);
  }
  catch (UnsupportedOperationException e) {
    throw new SQLFeatureNotSupportedException(e.getMessage(), e);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:DremioConnectionImpl.java

示例11: createStruct

import java.sql.Struct; //导入依赖的package包/类
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
{
	return checkClosedAndThrowUnsupportedException();
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:6,代码来源:AbstractCloudSpannerConnection.java

示例12: createStruct

import java.sql.Struct; //导入依赖的package包/类
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
{
    checkClosed();
    throw SQLError.noSupport();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:7,代码来源:JDBC4Connection.java

示例13: createStruct

import java.sql.Struct; //导入依赖的package包/类
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    return con.createStruct(typeName, attributes);
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:5,代码来源:FilteredConnection.java

示例14: createStruct

import java.sql.Struct; //导入依赖的package包/类
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    return conn.createStruct(typeName, attributes);
}
 
开发者ID:kumarshantanu,项目名称:preflex,代码行数:5,代码来源:ConnectionWrapper.java

示例15: createStruct

import java.sql.Struct; //导入依赖的package包/类
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    return connection.createStruct(typeName, attributes);
}
 
开发者ID:StefaniniInspiring,项目名称:pugtsdb,代码行数:5,代码来源:PugConnection.java


注:本文中的java.sql.Struct类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。