Coverage Report - org.apache.ojb.broker.platforms.PlatformSybaseASAImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
PlatformSybaseASAImpl
N/A
N/A
3
 
 1  
 package org.apache.ojb.broker.platforms;
 2  
 
 3  
 /* Copyright 2002-2005 The Apache Software Foundation
 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  
 import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
 19  
 
 20  
 import java.sql.Connection;
 21  
 import java.sql.SQLException;
 22  
 import java.sql.Statement;
 23  
 
 24  
 /**
 25  
  * This class is a concrete implementation of <code>Platform</code>.
 26  
  * Provides an implementation for Sybase ASA.
 27  
  * <br/>
 28  
  * This class extends {@link PlatformSybaseImpl} and defines specific
 29  
  * behavior for the Sybase ASA platform.
 30  
  *
 31  
  * <br/>NOTE: Different than the Sybase ASE platform
 32  
  * <br/> Modified by Nicus for Sybase ASA
 33  
  * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird<a>
 34  
  * @version $Id: PlatformSybaseASAImpl.java,v 1.1 2007-08-24 22:17:35 ewestfal Exp $
 35  
  */
 36  
 public class PlatformSybaseASAImpl extends PlatformSybaseImpl
 37  
 {
 38  
     /**
 39  
      * Sybase Adaptive Server Enterprise (ASE) support timestamp to a precision of 1/300th of second.
 40  
      * Adaptive Server Anywhere (ASA) support timestamp to a precision of 1/1000000tho of second.
 41  
      * Sybase JDBC driver (JConnect) retrieving timestamp always rounds to 1/300th sec., causing rounding
 42  
      * problems with ASA when retrieving Timestamp fields.
 43  
      * This work around was suggested by Sybase Support. Unfortunately it works only with ASA.
 44  
      * <br/>
 45  
      * author Lorenzo Nicora
 46  
      */
 47  
     public void initializeJdbcConnection(JdbcConnectionDescriptor jcd, Connection conn) throws PlatformException
 48  
     {
 49  
         // Do origial init
 50  
         super.initializeJdbcConnection(jcd, conn);
 51  
         // Execute a statement setting the tempory option
 52  
         try
 53  
         {
 54  
             Statement stmt = conn.createStatement();
 55  
             stmt.executeUpdate("set temporary option RETURN_DATE_TIME_AS_STRING = On");
 56  
         }
 57  
         catch (SQLException e)
 58  
         {
 59  
             throw new PlatformException(e);
 60  
         }
 61  
     }
 62  
 
 63  
 }