View Javadoc

1   /***
2    * 
3    * Copyright 2004 Hiram Chirino
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); 
6    * you may not use this file except in compliance with the License. 
7    * You may obtain a copy of the License at 
8    * 
9    * http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, 
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
14   * See the License for the specific language governing permissions and 
15   * limitations under the License. 
16   * 
17   **/
18  package org.codehaus.activemq.store.jdbc.adapter;
19  
20  import java.sql.PreparedStatement;
21  import java.sql.ResultSet;
22  import java.sql.SQLException;
23  
24  import org.codehaus.activemq.store.jdbc.StatementProvider;
25  
26  /***
27   * This JDBCAdapter inserts and extracts BLOB data using the 
28   * setBytes()/getBytes() operations.
29   * 
30   * The databases/JDBC drivers that use this adapter are:
31   * <ul>
32   * <li></li> 
33   * </ul>
34   * 
35   * @version $Revision: 1.1 $
36   */
37  public class BytesJDBCAdapter extends DefaultJDBCAdapter {
38  
39  	
40      public BytesJDBCAdapter() {
41          super();
42      }
43  
44  	public BytesJDBCAdapter(StatementProvider provider) {
45          super(provider);
46      }
47      
48      /***
49       * @see org.codehaus.activemq.store.jdbc.adapter.DefaultJDBCAdapter#getBinaryData(java.sql.ResultSet, int)
50       */
51      protected byte[] getBinaryData(ResultSet rs, int index) throws SQLException {
52          return rs.getBytes(index);
53      }
54      
55      /***
56       * @see org.codehaus.activemq.store.jdbc.adapter.DefaultJDBCAdapter#setBinaryData(java.sql.PreparedStatement, int, byte[])
57       */
58      protected void setBinaryData(PreparedStatement s, int index, byte[] data) throws SQLException {
59          s.setBytes(index, data);
60      }
61      
62  }