Coverage report

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

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

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