Coverage report

  %line %branch
org.apache.torque.adapter.DBSapDB
0% 
0% 

 1  
 package org.apache.torque.adapter;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.sql.Connection;
 23  
 import java.sql.SQLException;
 24  
 import java.sql.Statement;
 25  
 
 26  
 /**
 27  
  * This is used to connect to SapDB databases.
 28  
  *
 29  
  * <a href="http://www.sapdb.org">http://www.sapdb.org</a>
 30  
  *
 31  
  * @author <a href="mailto:dave.polito@planetcad.com">Dave Polito</a>
 32  
  * @version $Id: DBSapDB.java 473821 2006-11-11 22:37:25Z tv $
 33  
  */
 34  
 public class DBSapDB extends AbstractDBAdapter
 35  
 {
 36  
     /**
 37  
      * Serial version
 38  
      */
 39  
     private static final long serialVersionUID = 8277068258155186370L;
 40  
 
 41  
     /**
 42  
      * Empty constructor.
 43  
      */
 44  
     protected DBSapDB()
 45  0
     {
 46  0
     }
 47  
 
 48  
     /**
 49  
      * This method is used to ignore case.
 50  
      *
 51  
      * @param in The string to transform to upper case.
 52  
      * @return The upper case string.
 53  
      */
 54  
     public String toUpperCase(String in)
 55  
     {
 56  0
         return new StringBuffer("UPPER(").append(in).append(")").toString();
 57  
     }
 58  
 
 59  
     /**
 60  
      * This method is used to ignore case.
 61  
      *
 62  
      * @param in The string whose case to ignore.
 63  
      * @return The string in a case that can be ignored.
 64  
      */
 65  
     public String ignoreCase(String in)
 66  
     {
 67  0
         return new StringBuffer("UPPER(").append(in).append(")").toString();
 68  
     }
 69  
 
 70  
     /**
 71  
      * @see org.apache.torque.adapter.DB#getIDMethodType()
 72  
      */
 73  
     public String getIDMethodType()
 74  
     {
 75  0
         return SEQUENCE;
 76  
     }
 77  
 
 78  
     /**
 79  
      * Returns the next key from a sequence.  Uses the following
 80  
      * implementation:
 81  
      *
 82  
      * <blockquote><code><pre>
 83  
      * select sequenceName.nextval from dual
 84  
      * </pre></code></blockquote>
 85  
      *
 86  
      * @param sequenceName The name of the sequence (should be of type
 87  
      * <code>String</code>).
 88  
      * @return SQL to retreive the next database key.
 89  
      * @see org.apache.torque.adapter.DB#getIDMethodSQL(Object)
 90  
      */
 91  
     public String getIDMethodSQL(Object sequenceName)
 92  
     {
 93  0
         return ("select " + sequenceName + ".nextval from dual");
 94  
     }
 95  
 
 96  
     /**
 97  
      * Locks the specified table.
 98  
      *
 99  
      * @param con The JDBC connection to use.
 100  
      * @param table The name of the table to lock.
 101  
      * @exception SQLException No Statement could be created or executed.
 102  
      */
 103  
     public void lockTable(Connection con, String table) throws SQLException
 104  
     {
 105  0
         Statement statement = con.createStatement();
 106  
 
 107  0
         StringBuffer stmt = new StringBuffer();
 108  0
         stmt.append("SELECT next_id FROM ")
 109  
         .append(table)
 110  
         .append(" FOR UPDATE");
 111  
 
 112  0
         statement.executeQuery(stmt.toString());
 113  0
     }
 114  
 
 115  
    /**
 116  
     * This method is for the SqlExpression.quoteAndEscape rules.  The rule is,
 117  
     * any string in a SqlExpression with a BACKSLASH will either be changed to
 118  
     * "\\" or left as "\".  SapDB does not need the escape character.
 119  
     *
 120  
     * @return false.
 121  
     */
 122  
 
 123  
     public boolean escapeText()
 124  
     {
 125  0
         return false;
 126  
     }
 127  
 
 128  
     /**
 129  
      * Unlocks the specified table.
 130  
      *
 131  
      * @param con The JDBC connection to use.
 132  
      * @param table The name of the table to unlock.
 133  
      * @exception SQLException No Statement could be created or
 134  
      * executed.
 135  
      */
 136  
     public void unlockTable(Connection con, String table) throws SQLException
 137  
     {
 138  
         // Tables in SapDB are unlocked when a commit is issued.  The
 139  
         // user may have issued a commit but do it here to be sure.
 140  0
         con.commit();
 141  0
     }
 142  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.