001    /**
002     * 
003     * Copyright 2004 Hiram Chirino
004     * 
005     * Licensed under the Apache License, Version 2.0 (the "License"); 
006     * you may not use this file except in compliance with the License. 
007     * You may obtain a copy of the License at 
008     * 
009     * http://www.apache.org/licenses/LICENSE-2.0
010     * 
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS, 
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
014     * See the License for the specific language governing permissions and 
015     * limitations under the License. 
016     * 
017     **/
018    package org.activemq.store.jdbc.adapter;
019    
020    import java.sql.PreparedStatement;
021    import java.sql.ResultSet;
022    import java.sql.SQLException;
023    
024    import org.activemq.store.jdbc.StatementProvider;
025    
026    /**
027     * This JDBCAdapter inserts and extracts BLOB data using the 
028     * setBytes()/getBytes() operations.
029     * 
030     * The databases/JDBC drivers that use this adapter are:
031     * <ul>
032     * <li></li> 
033     * </ul>
034     * 
035     * @version $Revision: 1.1 $
036     */
037    public class BytesJDBCAdapter extends DefaultJDBCAdapter {
038    
039            
040        public BytesJDBCAdapter() {
041            super();
042        }
043    
044            public BytesJDBCAdapter(StatementProvider provider) {
045            super(provider);
046        }
047        
048        /**
049         * @see org.activemq.store.jdbc.adapter.DefaultJDBCAdapter#getBinaryData(java.sql.ResultSet, int)
050         */
051        protected byte[] getBinaryData(ResultSet rs, int index) throws SQLException {
052            return rs.getBytes(index);
053        }
054        
055        /**
056         * @see org.activemq.store.jdbc.adapter.DefaultJDBCAdapter#setBinaryData(java.sql.PreparedStatement, int, byte[])
057         */
058        protected void setBinaryData(PreparedStatement s, int index, byte[] data) throws SQLException {
059            s.setBytes(index, data);
060        }
061        
062    }