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


Java SQLData类代码示例

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


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

示例1: callMapFunction

import java.sql.SQLData; //导入依赖的package包/类
/**
 * Essa funcoa serve para invocar uma funcao da base de dados que retorna um 
 *      Tipo costumisada e que esta mapeado com java
 * @param functionName
 * @param SQLType
 * @param javaClass
 * @param parans
 * @return 
 */
@SuppressWarnings("CallToPrintStackTrace")
public static SQLData callMapFunction (String functionName, String SQLType, Class javaClass, Object ... parans)
{
    if(!EstadoConnexao.isValid) return null;
    try 
    {
        Connection  con = new Conexao().getCon();
        Object result;
        
        // Criar as interoganocoes necessaria para a invocacao da funcao ex (?, ?, ?, ...) || nada
        String interogations = (parans != null && parans.length>0)? createInterogation(parans.length): "";
        
        //Associa ao call e o nome da funcao 
        String sql = "{? = call "+functionName+interogations+"}";
        
        con.getTypeMap().put(SQLType, javaClass);
        try (CallableStatement call = mapParamsType(con, sql, 2, parans)) 
        {
            call.registerOutParameter(1, Types.STRUCT, SQLType);
            call.execute();
            result = Call.treatReturn(call.getObject(1), VARCHAR);
        }
        return  (SQLData) result;
        
        }catch(Exception ex)
        {
            ex.printStackTrace();
        }
    return null;
        
}
 
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:41,代码来源:Call.java

示例2: addTypeMapping

import java.sql.SQLData; //导入依赖的package包/类
/**
 * Defines the mapping between an SQL type and a Java class.
 * 
 * @param sqlTypeName The name of the SQL type. The name can be
 *            qualified with a schema (namespace). If the schema is omitted,
 *            it will be resolved according to the current setting of the
 *            {@code search_path}.
 * @param javaClassName The name of the class. The class must be found in
 *            the classpath in effect for the current schema
 * @throws SQLException if the type or class cannot be found, or if the
 *            invoking user does not own the type.
 */
@Function(schema="sqlj", name="add_type_mapping", security=DEFINER)
public static void addTypeMapping(String sqlTypeName, String javaClassName)
throws SQLException
{
	PreparedStatement stmt = null;
	try
	{
		ClassLoader loader = Loader.getCurrentLoader();
		Class cls = loader.loadClass(javaClassName);
		if(!SQLData.class.isAssignableFrom(cls))
			throw new SQLException("Class " + javaClassName
				+ " does not implement java.sql.SQLData");

		sqlTypeName = getFullSqlNameOwned(sqlTypeName);
		stmt = SQLUtils
			.getDefaultConnection()
			.prepareStatement(
				"INSERT INTO sqlj.typemap_entry(javaName, sqlName) VALUES(?,?)");
		stmt.setString(1, javaClassName);
		stmt.setString(2, sqlTypeName);
		stmt.executeUpdate();
	}
	catch(ClassNotFoundException e)
	{
		throw new SQLException(
			"No such class: " + javaClassName, "46103", e);
	}
	finally
	{
		SQLUtils.close(stmt);
	}
	Loader.clearSchemaLoaders();
}
 
开发者ID:greenplum-db,项目名称:pljava,代码行数:46,代码来源:Commands.java

示例3: testWriteObject

import java.sql.SQLData; //导入依赖的package包/类
/**
 * Test method for {@link java.sql.SQLOutput#writeObject(java.sql.SQLData)}.
 */
@TestTargetNew(
  level = TestLevel.NOT_FEASIBLE,
  notes = "",
  method = "writeObject",
  args = {SQLData.class}
  )
public void testWriteObject() {
    fail("Not yet implemented");
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:13,代码来源:SQLOutputTest.java

示例4: getIndexedSetter

import java.sql.SQLData; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected  <T> IndexedSetter<PreparedStatement, T> getIndexedSetter(Type propertyType, PropertyMapping<?, ?, JdbcColumnKey, ? extends ColumnDefinition<JdbcColumnKey, ?>> arg) {
    IndexedSetter<PreparedStatement, T> setter = null;

    if (TypeHelper.isEnum(propertyType)) {
        switch (arg.getColumnKey().getSqlType()) {
            case Types.NUMERIC:
            case Types.BIGINT:
            case Types.INTEGER:
            case Types.DECIMAL:
            case Types.DOUBLE:
            case Types.FLOAT:
            case Types.SMALLINT:
            case Types.REAL:
            case Types.TINYINT:
               setter = (IndexedSetter<PreparedStatement, T>) new OrdinalEnumPreparedStatementIndexSetter();
                break;
            default:
                setter = (IndexedSetter<PreparedStatement, T>) new StringEnumPreparedStatementIndexSetter();
        }
    }

    if (setter == null) {
        Factory setterFactory = this.factoryPerClass.get(TypeHelper.toClass(propertyType));
        if (setterFactory != null) {
            setter = setterFactory.<T>getIndexedSetter(arg.getColumnKey());
        }
    }

    if (setter == null && TypeHelper.isAssignable(SQLData.class, propertyType)) {
        setter = (IndexedSetter<PreparedStatement, T>) new ObjectPreparedStatementIndexSetter();
    }

    return setter;
}
 
开发者ID:arnaudroger,项目名称:SimpleFlatMapper,代码行数:36,代码来源:PreparedStatementIndexedSetterFactory.java

示例5: writeObject

import java.sql.SQLData; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see java.sql.SQLOutput#writeObject(SQLData)
 */
@SuppressWarnings("unchecked")
public void writeObject(SQLData theObject) throws SQLException {
    if (theObject == null) {
        attributes.addElement(null);
    } else {
        attributes
                .addElement(new SerialStruct(theObject, new HashMap(map)));
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:15,代码来源:SQLOutputImpl.java

示例6: DDRProcessorImpl

import java.sql.SQLData; //导入依赖的package包/类
DDRProcessorImpl( ProcessingEnvironment processingEnv)
{
	elmu = processingEnv.getElementUtils();
	filr = processingEnv.getFiler();
	loca = processingEnv.getLocale();
	msgr = processingEnv.getMessager();
	opts = processingEnv.getOptions();
	srcv = processingEnv.getSourceVersion();
	typu = processingEnv.getTypeUtils();

	tmpr = new TypeMapper();
	
	String optv;
	
	optv = opts.get( "ddr.name.trusted");
	if ( null != optv )
		nameTrusted = optv;
	else
		nameTrusted = "java";
	
	optv = opts.get( "ddr.name.untrusted");
	if ( null != optv )
		nameUntrusted = optv;
	else
		nameUntrusted = "javaU";
	
	optv = opts.get( "ddr.implementor");
	if ( null != optv )
		defaultImplementor = "-".equals( optv) ? null : optv;
	else
		defaultImplementor = "PostgreSQL";

	optv = opts.get( "ddr.output");
	if ( null != optv )
		output = optv;
	else
		output = "pljava.ddr";
	
	TY_ITERATOR = typu.getDeclaredType(
		elmu.getTypeElement( java.util.Iterator.class.getName()));
	TY_OBJECT = typu.getDeclaredType(
		elmu.getTypeElement( Object.class.getName()));
	TY_RESULTSET = typu.getDeclaredType(
		elmu.getTypeElement( java.sql.ResultSet.class.getName()));
	TY_RESULTSETPROVIDER = typu.getDeclaredType(
		elmu.getTypeElement( ResultSetProvider.class.getName()));
	TY_RESULTSETHANDLE = typu.getDeclaredType(
		elmu.getTypeElement( ResultSetHandle.class.getName()));
	TY_SQLDATA = typu.getDeclaredType(
		elmu.getTypeElement( SQLData.class.getName()));
	TY_SQLINPUT = typu.getDeclaredType(
		elmu.getTypeElement( SQLInput.class.getName()));
	TY_SQLOUTPUT = typu.getDeclaredType(
		elmu.getTypeElement( SQLOutput.class.getName()));
	TY_STRING = typu.getDeclaredType(
		elmu.getTypeElement( String.class.getName()));
	TY_TRIGGERDATA = typu.getDeclaredType(
		elmu.getTypeElement( TriggerData.class.getName()));
	TY_VOID = typu.getNoType( TypeKind.VOID);

	AN_FUNCTION    = elmu.getTypeElement( Function.class.getName());
	AN_SQLACTION   = elmu.getTypeElement( SQLAction.class.getName());
	AN_SQLACTIONS  = elmu.getTypeElement( SQLActions.class.getName());
	AN_SQLTYPE     = elmu.getTypeElement( SQLType.class.getName());
	AN_TRIGGER     = elmu.getTypeElement( Trigger.class.getName());
	AN_BASEUDT     = elmu.getTypeElement( BaseUDT.class.getName());
	AN_MAPPEDUDT   = elmu.getTypeElement( MappedUDT.class.getName());
}
 
开发者ID:greenplum-db,项目名称:pljava,代码行数:69,代码来源:DDRProcessor.java

示例7: writeObject

import java.sql.SQLData; //导入依赖的package包/类
public void writeObject(SQLData value) throws SQLException
{
	this.writeValue(value);
}
 
开发者ID:greenplum-db,项目名称:pljava,代码行数:5,代码来源:SQLOutputToTuple.java

示例8: writeObject

import java.sql.SQLData; //导入依赖的package包/类
@Override
public void writeObject(SQLData value) throws SQLException
{
	throw unsupportedOperationException("writeObject");
}
 
开发者ID:greenplum-db,项目名称:pljava,代码行数:6,代码来源:SQLOutputToChunk.java

示例9: SerialStruct

import java.sql.SQLData; //导入依赖的package包/类
public SerialStruct(SQLData in, Map<String, Class<?>> map)
        throws SerialException, NotImplementedException {
    throw new NotImplementedException();
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:5,代码来源:SerialStruct.java

示例10: writeObject

import java.sql.SQLData; //导入依赖的package包/类
public void writeObject(SQLData theObject) throws SQLException,
        NotImplementedException {
    throw new NotImplementedException();

}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:6,代码来源:SQLOutputImpl.java


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