Coverage Report - org.kuali.rice.core.database.platform.DerbyDatabasePlatform
 
Classes in this File Line Coverage Branch Coverage Complexity
DerbyDatabasePlatform
0%
0/13
0%
0/2
1.2
 
 1  
 /*
 2  
  * Copyright 2005-2009 The Kuali Foundation
 3  
  * 
 4  
  * 
 5  
  * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
 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  
 package org.kuali.rice.core.database.platform;
 18  
 
 19  
 import java.util.regex.Pattern;
 20  
 
 21  
 import javax.persistence.EntityManager;
 22  
 
 23  
 import org.apache.ojb.broker.PersistenceBroker;
 24  
 import org.apache.ojb.broker.query.Criteria;
 25  
 
 26  
 /**
 27  
  * DatabasePlatform implementation that generates Mckoi-compliant SQL
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  */
 30  0
 public class DerbyDatabasePlatform extends ANSISqlDatabasePlatform {
 31  
 
 32  0
         private static final Pattern APOS_PAT = Pattern.compile("'");
 33  
         
 34  
     public String getLockRouteHeaderQuerySQL(Long routeHeaderId, boolean wait) {
 35  0
         return "SELECT DOC_HDR_ID FROM KREW_DOC_HDR_T WHERE DOC_HDR_ID=?";
 36  
     }
 37  
 
 38  0
     private static long nextVal = 1000;
 39  
     
 40  
         public String getCurTimeFunction() {
 41  0
                 return "CURRENT_TIMESTAMP";
 42  
         }
 43  
 
 44  
         public String getDateFormatString(String dateFormatString) {
 45  0
                 return "'" + dateFormatString + "'";
 46  
         }
 47  
     
 48  
         public String getStrToDateFunction() {
 49  0
                 return null;
 50  
         }
 51  
         
 52  
     public Long getNextValSQL(String sequenceName,        PersistenceBroker persistenceBroker) {
 53  0
                 return nextVal++;
 54  
         }
 55  
 
 56  
     public String toString() {
 57  0
         return "[Derby]";
 58  
     }
 59  
 
 60  
     public Long getNextValSQL(String sequenceName, EntityManager entityManger) {
 61  0
         return nextVal++;
 62  
     }
 63  
     
 64  
     public String getSelectForUpdateSuffix(long waitMillis) {
 65  0
             throw new UnsupportedOperationException("Implement me!");
 66  
     }
 67  
 
 68  
     /**
 69  
      * Performs Derby-specific escaping of String parameters.
 70  
      * 
 71  
      * @see org.kuali.rice.core.database.platform.DatabasePlatform#escapeString(java.lang.String)
 72  
      */
 73  
     public String escapeString(String sqlString) {
 74  0
             return (sqlString != null) ? APOS_PAT.matcher(sqlString).replaceAll("''") : null;
 75  
     }
 76  
     
 77  
         public void applyLimit(Integer limit, Criteria criteria) {
 78  
                 // derby has no such concept
 79  0
         }    
 80  
 }