java.sql.Blob Java Examples

The following examples show how to use java.sql.Blob. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: spliceengine   Author: splicemachine   File: ProxiedDFSClient.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
    public LocatedBlocks getLocatedBlocks(String src, long start, long length) throws IOException {
        try {
            try (PreparedStatement statement = connection.prepareStatement("call SYSCS_UTIL.SYSCS_HDFS_OPERATION(?, ?)")) {
                statement.setString(1, src);
                statement.setString(2, "blocks");
                try (ResultSet rs = statement.executeQuery()) {
                    if (!rs.next()) {
                        throw new IOException("No results for getFileStatus");
                    }
                    Blob blob = rs.getBlob(1);
                    byte[] bytes = blob.getBytes(1, (int) blob.length());
                    HdfsProtos.LocatedBlocksProto lbp = HdfsProtos.LocatedBlocksProto.parseFrom(bytes);

// TODO                    return PBHelper.convert(lbp);
                    return null;
                }
            }
        } catch (SQLException e) {
            throw new IOException(e);
        }
    }
 
Example #2
Source Project: gemfirexd-oss   Author: gemxd   File: EmpEmployeesDMLStmt.java    License: Apache License 2.0 6 votes vote down vote up
protected void insertToGFXDTable(Connection conn, int[] eid, String[] emp_name,
    int[] deptid, Date[] since, String[] addr, Blob[] picture, String[] ssn,
    int size, List<SQLException> exceptions, boolean isPut) throws SQLException {
  PreparedStatement stmt = conn.prepareStatement(isPut ? put : insert);
  int tid = getMyTid();
  int count = -1;
  
  for (int i=0 ; i<size ; i++) {
    try {
      count = insertToTable(stmt, eid[i], emp_name[i], deptid[i], since[i], addr[i], 
          picture[i], ssn[i], tid, isPut); 
      if (count != ((Integer)verifyRowCount.get(tid+"_insert"+i)).intValue()) {
        Log.getLogWriter().info("Gfxd insert has different row count from that of derby " +
          "derby inserted " + ((Integer)verifyRowCount.get(tid+"_insert"+i)).intValue() +
          " but gfxd inserted " + count);
      }
    } catch (SQLException se) {
      SQLHelper.handleGFGFXDException(se, exceptions);  
    }
  }
}
 
Example #3
Source Project: herddb   Author: diennea   File: StreamBasedWritesTest.java    License: Apache License 2.0 6 votes vote down vote up
private static void checkBlob(ResultSet rs, int index, byte[] expected, int key) {
    try {
        byte[] actual = rs.getBytes(index);
        Assert.assertArrayEquals(expected, actual);

        if (expected != null) {
            DataInputStream dataInputStream = new DataInputStream(rs.getBinaryStream(index));
            byte[] actualFromStream = new byte[actual.length];
            dataInputStream.readFully(actualFromStream);
            Assert.assertArrayEquals("error at key " + key, expected, actualFromStream);

            Blob blob = rs.getBlob(index);
            assertEquals("error at key " + key, blob.length(), actual.length);

            DataInputStream dataInputStream2 = new DataInputStream(blob.getBinaryStream());
            byte[] actualFromStream2 = new byte[actual.length];
            dataInputStream2.readFully(actualFromStream2);
            Assert.assertArrayEquals("error at key " + key, expected, actualFromStream2);
        }

        byte[] object = (byte[]) rs.getObject(index);
        Assert.assertArrayEquals((byte[]) expected, object);
    } catch (SQLException | IOException e) {
        throw new RuntimeException(e);
    }
}
 
Example #4
Source Project: EasyTransaction   Author: QNJR-GROUP   File: EtDataSourceManager.java    License: Apache License 2.0 6 votes vote down vote up
private List<byte[]> getRollbackInfo(String xid, long branchId, Connection conn, String resourceId) throws SQLException {

        ResultSet rs = null;
        PreparedStatement selectPST = null;
        selectPST = conn.prepareStatement(SELECT_UNDO_LOG_SQL);
        selectPST.setLong(1, branchId);
        selectPST.setString(2, xid);
        rs = selectPST.executeQuery();

        List<byte[]> result = new ArrayList<>();

        try {
            while (rs.next()) {
                Blob b = rs.getBlob("rollback_info");
                byte[] rollbackInfo = BlobUtils.blob2Bytes(b);
                result.add(rollbackInfo);
            }
        } finally {
            rs.close();
        }

        return result;

    }
 
Example #5
Source Project: lams   Author: lamsfoundation   File: ClientPreparedQueryBindings.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public void setBlob(int parameterIndex, Blob x) {
    if (x == null) {
        setNull(parameterIndex);
    } else {
        try {
            ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();

            bytesOut.write('\'');
            StringUtils.escapeblockFast(x.getBytes(1, (int) x.length()), bytesOut, (int) x.length(),
                    this.session.getServerSession().useAnsiQuotedIdentifiers());
            bytesOut.write('\'');

            setValue(parameterIndex, bytesOut.toByteArray(), MysqlType.BLOB);
        } catch (Throwable t) {
            throw ExceptionFactory.createException(t.getMessage(), t);
        }
    }
}
 
Example #6
Source Project: vertx-sql-client   Author: eclipse-vertx   File: CrossConverters.java    License: Apache License 2.0 5 votes vote down vote up
static final Object setObject(int targetType, Blob source) {
    switch (targetType) {
    case ClientTypes.BLOB:
        return source;
    default:
        throw new IllegalArgumentException("SQLState.LANG_DATA_TYPE_SET_MISMATCH java.sql.Blob" + ClientTypes.getTypeString(targetType));
    }
}
 
Example #7
Source Project: dbtransfer   Author: evolute-pt   File: PostgreSQLServerHelper.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
    public void setPreparedValue(PreparedStatement pStm, int col, Object o, int type ) 
            throws SQLException
    {
        if( type == Types.BLOB 
        		|| type == Types.LONGVARBINARY 
        		|| type == Types.VARBINARY
        		|| type == Types.BINARY )
        {
        	if( o != null )
        	{
	            o = outputValue( o );
	            
//	            System.out.println( "BLOB class: " + o.getClass() + " Type: " + type + " Col: " + col );
	            if( o instanceof byte[] )
	            {
	                pStm.setBytes( col + 1, ( byte[] )o );
	            }
	            else
	            {
	            	Blob b = ( Blob )o;
	                pStm.setBytes( col + 1, b.getBytes( 1, ( int )b.length() ) );
	            }
        	}
        	else
        	{
        		pStm.setBytes( col + 1, null );
        	}
        }
        else
        {
        	super.setPreparedValue( pStm, col, o, type );
        }
    }
 
Example #8
Source Project: gemfirexd-oss   Author: gemxd   File: DDMMMYYImportOra.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Blob getBlob(int columnIndex) throws SQLException {
	if (this.lobsInExtFile) {
		return super.getBlob(columnIndex);
	} else {
		// data is in the main export file, stored in hex format.
		String hexData = getCurrentRow()[columnIndex - 1];
		byte[] data = null;
		if (hexData != null) {
			data = fromHexString(hexData, 0, hexData.length());
			// fromHexString() returns null if the hex string
			// is invalid one. It is invalid if the data string
			// length is not multiple of 2 or the data string
			// contains non-hex characters.
			if (data != null) {
				this.wasNull = false;
				return new ImportBlob(data);
			} else {
				throw new SQLException(
						"An invalid hexadecimal string '" + hexData
								+ "' detected in the import file at line "
								+ getCurrentLineNumber() + " column "
								+ columnIndex, "XIE0N", 20000);
			}
		} else {
			this.wasNull = true;
			return null;
		}
	}
}
 
Example #9
Source Project: java-technology-stack   Author: codeEngraver   File: DefaultLobHandler.java    License: MIT License 5 votes vote down vote up
@Override
public void setBlobAsBytes(PreparedStatement ps, int paramIndex, @Nullable byte[] content)
		throws SQLException {

	if (streamAsLob) {
		if (content != null) {
			ps.setBlob(paramIndex, new ByteArrayInputStream(content), content.length);
		}
		else {
			ps.setBlob(paramIndex, (Blob) null);
		}
	}
	else if (wrapAsLob) {
		if (content != null) {
			ps.setBlob(paramIndex, new PassThroughBlob(content));
		}
		else {
			ps.setBlob(paramIndex, (Blob) null);
		}
	}
	else {
		ps.setBytes(paramIndex, content);
	}
	if (logger.isDebugEnabled()) {
		logger.debug(content != null ? "Set bytes for BLOB with length " + content.length :
				"Set BLOB to null");
	}
}
 
Example #10
Source Project: kylin-on-parquet-v2   Author: Kyligence   File: JDBCResourceStore.java    License: Apache License 2.0 5 votes vote down vote up
private InputStream getInputStream(String resPath, ResultSet rs) throws SQLException, IOException {
    if (rs == null) {
        return null;
    }

    Blob blob = rs.getBlob(META_TABLE_CONTENT);

    if (blob == null || blob.length() == 0) {
        return openPushdown(resPath); // empty bytes is pushdown indicator
    } else {
        return blob.getBinaryStream();
    }
}
 
Example #11
Source Project: spring-analysis-note   Author: Vip-Augus   File: JdbcUtils.java    License: MIT License 5 votes vote down vote up
/**
 * Retrieve a JDBC column value from a ResultSet, using the most appropriate
 * value type. The returned value should be a detached value object, not having
 * any ties to the active ResultSet: in particular, it should not be a Blob or
 * Clob object but rather a byte array or String representation, respectively.
 * <p>Uses the {@code getObject(index)} method, but includes additional "hacks"
 * to get around Oracle 10g returning a non-standard object for its TIMESTAMP
 * datatype and a {@code java.sql.Date} for DATE columns leaving out the
 * time portion: These columns will explicitly be extracted as standard
 * {@code java.sql.Timestamp} object.
 * @param rs is the ResultSet holding the data
 * @param index is the column index
 * @return the value object
 * @throws SQLException if thrown by the JDBC API
 * @see java.sql.Blob
 * @see java.sql.Clob
 * @see java.sql.Timestamp
 */
@Nullable
public static Object getResultSetValue(ResultSet rs, int index) throws SQLException {
	Object obj = rs.getObject(index);
	String className = null;
	if (obj != null) {
		className = obj.getClass().getName();
	}
	if (obj instanceof Blob) {
		Blob blob = (Blob) obj;
		obj = blob.getBytes(1, (int) blob.length());
	}
	else if (obj instanceof Clob) {
		Clob clob = (Clob) obj;
		obj = clob.getSubString(1, (int) clob.length());
	}
	else if ("oracle.sql.TIMESTAMP".equals(className) || "oracle.sql.TIMESTAMPTZ".equals(className)) {
		obj = rs.getTimestamp(index);
	}
	else if (className != null && className.startsWith("oracle.sql.DATE")) {
		String metaDataClassName = rs.getMetaData().getColumnClassName(index);
		if ("java.sql.Timestamp".equals(metaDataClassName) || "oracle.sql.TIMESTAMP".equals(metaDataClassName)) {
			obj = rs.getTimestamp(index);
		}
		else {
			obj = rs.getDate(index);
		}
	}
	else if (obj instanceof java.sql.Date) {
		if ("java.sql.Timestamp".equals(rs.getMetaData().getColumnClassName(index))) {
			obj = rs.getTimestamp(index);
		}
	}
	return obj;
}
 
Example #12
Source Project: lams   Author: lamsfoundation   File: JdbcTypeJavaClassMappings.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static ConcurrentHashMap<Class, Integer> buildJavaClassToJdbcTypeCodeMappings() {
	final ConcurrentHashMap<Class, Integer> workMap = new ConcurrentHashMap<>();

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


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

	return workMap;
}
 
Example #13
Source Project: spliceengine   Author: splicemachine   File: CallableStatement40.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
public <T> T getObject( int parameterIndex, Class<T> type )
    throws SQLException
{
    // checkForClosedStatement() should be called by all of the
    // more specific methods to which we forward this call

    if ( type == null )
    {
        throw mismatchException( "NULL", parameterIndex );
    }

    Object   retval;
        
    if ( String.class.equals( type ) ) { retval = getString( parameterIndex ); }
    else if ( BigDecimal.class.equals( type ) ) { retval = getBigDecimal( parameterIndex ); }
    else if ( Boolean.class.equals( type ) ) { retval = Boolean.valueOf( getBoolean(parameterIndex ) ); }
    else if ( Byte.class.equals( type ) ) { retval = Byte.valueOf( getByte( parameterIndex ) ); }
    else if ( Short.class.equals( type ) ) { retval = Short.valueOf( getShort( parameterIndex ) ); }
    else if ( Integer.class.equals( type ) ) { retval = Integer.valueOf( getInt( parameterIndex ) ); }
    else if ( Long.class.equals( type ) ) { retval = Long.valueOf( getLong( parameterIndex ) ); }
    else if ( Float.class.equals( type ) ) { retval = Float.valueOf( getFloat( parameterIndex ) ); }
    else if ( Double.class.equals( type ) ) { retval = Double.valueOf( getDouble( parameterIndex ) ); }
    else if ( Date.class.equals( type ) ) { retval = getDate( parameterIndex ); }
    else if ( Time.class.equals( type ) ) { retval = getTime( parameterIndex ); }
    else if ( Timestamp.class.equals( type ) ) { retval = getTimestamp( parameterIndex ); }
    else if ( Blob.class.equals( type ) ) { retval = getBlob( parameterIndex ); }
    else if ( Clob.class.equals( type ) ) { retval = getClob( parameterIndex ); }
    else if ( type.isArray() && type.getComponentType().equals( byte.class ) ) { retval = getBytes( parameterIndex ); }
    else { retval = getObject( parameterIndex ); }

    if ( wasNull() ) { retval = null; }

    if ( (retval == null) || (type.isInstance( retval )) ) { return type.cast( retval ); }
            
    throw mismatchException( type.getName(), parameterIndex );
}
 
Example #14
Source Project: FHIR   Author: IBM   File: PooledConnection.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Blob createBlob() throws SQLException {
    try {
        return wrapped.createBlob();
    }
    catch (SQLException x) {
        this.reusable = !pool.checkConnectionFailure(x);
        throw x;
    }
}
 
Example #15
Source Project: commons-dbcp   Author: apache   File: DelegatingResultSet.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Blob getBlob(final String colName) throws SQLException {
    try {
        return resultSet.getBlob(colName);
    } catch (final SQLException e) {
        handleException(e);
        return null;
    }
}
 
Example #16
Source Project: lams   Author: lamsfoundation   File: ResourceRegistryStandardImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public void release(Blob blob) {
	if ( blobs == null ) {
		log.debug( "Request to release Blob, but appears no Blobs have ever been registered" );
		return;
	}
	blobs.remove( blob );
}
 
Example #17
Source Project: ByteJTA   Author: liuyangming   File: PreparedStatementImpl.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
public void setBlob(int parameterIndex, Blob x) throws SQLException {
	delegate.setBlob(parameterIndex, x);
}
 
Example #18
Source Project: tddl   Author: cpsing   File: TResultSetWrapper.java    License: Apache License 2.0 4 votes vote down vote up
public void updateBlob(String columnName, Blob x) throws SQLException {
    this.targetResultSet.updateBlob(columnName, x);
}
 
Example #19
Source Project: jdk8u-jdk   Author: lambdalab-mirror   File: StubJoinRowSetImpl.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public void setBlob(int i, Blob x) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example #20
Source Project: HTTP-RPC   Author: gk-brown   File: TestResultSet.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void updateBlob(String columnLabel, Blob x) {
    throw new UnsupportedOperationException();
}
 
Example #21
Source Project: glowroot   Author: glowroot   File: MockResultSet.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void updateBlob(int columnIndex, Blob x) throws SQLException {}
 
Example #22
Source Project: spark-llap   Author: hortonworks-spark   File: MockConnection.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Blob createBlob() throws SQLException {
    return null;
}
 
Example #23
Source Project: gemfirexd-oss   Author: gemxd   File: LogicalCallableStatement.java    License: Apache License 2.0 4 votes vote down vote up
public Blob getBlob(String parameterName) throws SQLException {
    return getPhysCs().getBlob(parameterName);
}
 
Example #24
Source Project: tomcatsrc   Author: wangyingjie   File: Connection.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Blob createBlob() throws SQLException {
    return null;
}
 
Example #25
Source Project: Tomcat8-Source-Read   Author: chenmudu   File: Jdbc41Bridge.java    License: MIT License 4 votes vote down vote up
/**
 * Delegates to {@link ResultSet#getObject(String, Class)} without throwing a {@link AbstractMethodError}.
 *
 * @param <T>
 *            See {@link ResultSet#getObject(String, Class)}
 * @param resultSet
 *            See {@link ResultSet#getObject(String, Class)}
 * @param columnLabel
 *            See {@link ResultSet#getObject(String, Class)}
 * @param type
 *            See {@link ResultSet#getObject(String, Class)}
 * @return See {@link ResultSet#getObject(String, Class)}
 * @throws SQLException
 *             See {@link ResultSet#getObject(String, Class)}
 * @see ResultSet#getObject(int, Class)
 */
@SuppressWarnings("unchecked")
public static <T> T getObject(final ResultSet resultSet, final String columnLabel, final Class<T> type)
        throws SQLException {
    try {
        return resultSet.getObject(columnLabel, type);
    } catch (final AbstractMethodError e) {
        // Numbers
        if (type == Integer.class) {
            return (T) Integer.valueOf(resultSet.getInt(columnLabel));
        }
        if (type == Long.class) {
            return (T) Long.valueOf(resultSet.getLong(columnLabel));
        }
        if (type == Double.class) {
            return (T) Double.valueOf(resultSet.getDouble(columnLabel));
        }
        if (type == Float.class) {
            return (T) Float.valueOf(resultSet.getFloat(columnLabel));
        }
        if (type == Short.class) {
            return (T) Short.valueOf(resultSet.getShort(columnLabel));
        }
        if (type == BigDecimal.class) {
            return (T) resultSet.getBigDecimal(columnLabel);
        }
        if (type == Byte.class) {
            return (T) Byte.valueOf(resultSet.getByte(columnLabel));
        }
        // Dates
        if (type == Date.class) {
            return (T) resultSet.getDate(columnLabel);
        }
        if (type == Time.class) {
            return (T) resultSet.getTime(columnLabel);
        }
        if (type == Timestamp.class) {
            return (T) resultSet.getTimestamp(columnLabel);
        }
        // Streams
        if (type == InputStream.class) {
            return (T) resultSet.getBinaryStream(columnLabel);
        }
        if (type == Reader.class) {
            return (T) resultSet.getCharacterStream(columnLabel);
        }
        // Other
        if (type == Object.class) {
            return (T) resultSet.getObject(columnLabel);
        }
        if (type == Boolean.class) {
            return (T) Boolean.valueOf(resultSet.getBoolean(columnLabel));
        }
        if (type == Array.class) {
            return (T) resultSet.getArray(columnLabel);
        }
        if (type == Blob.class) {
            return (T) resultSet.getBlob(columnLabel);
        }
        if (type == Clob.class) {
            return (T) resultSet.getClob(columnLabel);
        }
        if (type == Ref.class) {
            return (T) resultSet.getRef(columnLabel);
        }
        if (type == RowId.class) {
            return (T) resultSet.getRowId(columnLabel);
        }
        if (type == SQLXML.class) {
            return (T) resultSet.getSQLXML(columnLabel);
        }
        if (type == URL.class) {
            return (T) resultSet.getURL(columnLabel);
        }
        throw new SQLFeatureNotSupportedException(
                String.format("resultSet=%s, columnLabel=%s, type=%s", resultSet, columnLabel, type));
    }
}
 
Example #26
Source Project: olingo-odata2   Author: apache   File: EdmMockUtilV2.java    License: Apache License 2.0 4 votes vote down vote up
public static EdmProperty mockEdmProperty(final String entityName, final String propertyName) throws EdmException {
  EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);

  if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MINT) ||
      propertyName.equals(JPATypeMock.PROPERTY_NAME_ENUM) ||
      propertyName.equals(JPATypeMock.PROPERTY_NAME_MSTRING) ||
      propertyName.equals(JPATypeMock.PROPERTY_NAME_MDATETIME) ||
      propertyName.equals(JPATypeMock.PROPERTY_NAME_MBLOB) ||
      propertyName.equals(JPATypeMock.PROPERTY_NAME_CLOB) ||
      propertyName.equals(JPATypeMock.PROPERTY_NAME_MCARRAY) ||
      propertyName.equals(JPATypeMock.PROPERTY_NAME_MC) ||
      propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHAR) ||
      propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHARARRAY) ||
      propertyName.equals(JPATypeMock.PROPERTY_NAME_XMLADAPTER) ||
      propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT) ||
      propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT) ||
      propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID) ||
      propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MLONG) ||
      propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTE) ||
      propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE) ||
      propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY) ||
      propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MDATE) ||
      propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MDATE1) ||
      propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MTIME) ||
      propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MTIMESTAMP)) {

    EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
    EasyMock.expect(edmProperty.getType()).andReturn(edmType).anyTimes();
    EasyMock.expect(edmProperty.getFacets()).andReturn(null).anyTimes();
    EasyMock.expect(edmType.getKind()).andReturn(EdmTypeKind.SIMPLE).anyTimes();
    if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MSTRING) ||
        propertyName.equals(JPATypeMock.PROPERTY_NAME_ENUM) ||
        propertyName.equals(JPATypeMock.PROPERTY_NAME_MCARRAY) ||
        propertyName.equals(JPATypeMock.PROPERTY_NAME_MC) ||
        propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHAR) ||
        propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHARARRAY)) {
      EasyMock.<Class<?>> expect(edmType.getDefaultType()).andReturn(String.class).anyTimes();
    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MBLOB)) {
      EasyMock.<Class<?>> expect(edmType.getDefaultType()).andReturn(Blob.class).anyTimes();
    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_XMLADAPTER)) {
  	  EasyMock.<Class<?>> expect(edmType.getDefaultType())
  	  	.andReturn(String.class).anyTimes();
    } else {
      EasyMock.<Class<?>> expect(edmType.getDefaultType()).andReturn(Integer.class).anyTimes();
    }

    EasyMock.expect(edmType.isCompatible(EasyMock.isA(EdmSimpleType.class))).andReturn(true).anyTimes();
    EasyMock.replay(edmType);
    EasyMock.expect(edmProperty.getName()).andReturn(propertyName).anyTimes();
    
    
    
    EasyMock.expect(edmProperty.getMapping()).andReturn((EdmMapping) mockEdmMapping(entityName, propertyName, null))
        .anyTimes();

  } else if (propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE) ||
      propertyName.equals(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)) {
    EdmComplexType complexType = mockComplexType(propertyName);

    EasyMock.expect(edmProperty.getType()).andReturn(complexType).anyTimes();
    EasyMock.expect(edmProperty.getName()).andReturn(propertyName).anyTimes();
    EasyMock.expect(edmProperty.getMapping()).andReturn((EdmMapping) mockEdmMapping(null, propertyName, null))
        .anyTimes();
    EasyMock.expect(edmProperty.getFacets()).andReturn(null).anyTimes();

  }

  EasyMock.replay(edmProperty);
  return edmProperty;
}
 
Example #27
Source Project: dragonwell8_jdk   Author: alibaba   File: StubSyncResolver.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public void setBlob(int i, Blob x) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example #28
Source Project: dragonwell8_jdk   Author: alibaba   File: StubJoinRowSetImpl.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public void setBlob(int i, Blob x) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example #29
Source Project: Oceanus   Author: 58code   File: RowSetsResultSet.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void updateBlob(String columnLabel, Blob x) throws SQLException {
	// TODO Auto-generated method stub

}
 
Example #30
Source Project: incubator-iotdb   Author: apache   File: AbstractIoTDBJDBCResultSet.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Blob getBlob(String arg0) throws SQLException {
  throw new SQLException(Constant.METHOD_NOT_SUPPORTED);
}