Coverage Report - org.apache.torque.engine.database.model.SizedForBitDataDomain
 
Classes in this File Line Coverage Branch Coverage Complexity
SizedForBitDataDomain
0%
0/19
0%
0/2
1.125
 
 1  
 package org.apache.torque.engine.database.model;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
 5  
  * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
 7  
  * License. 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 distributed under the License is distributed on
 12  
  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 13  
  * specific language governing permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 /**
 17  
  * <p>
 18  
  * Supports the Derby / DB2 / SQL92 standard for defining Binary data fields with either CHAR(#) FOR BIT DATA or
 19  
  * VARCHAR(#) FOR BIT DATA. This can be used in Platform implimentors initialize() methods, by using lines like:
 20  
  * </p>
 21  
  * <code>
 22  
  * setSchemaDomainMapping(new SizedForBitDataDomain(
 23  
  *                          SchemaType.BINARY, "CHAR", "1"));
 24  
  * setSchemaDomainMapping(new SizedForBitDataDomain(
 25  
  *                          SchemaType.VARBINARY, "VARCHAR"));
 26  
  * </code>
 27  
  * <p>
 28  
  * This will cause the Column.getSqlString() method to produce items similar to:
 29  
  * </p>
 30  
  * <code>
 31  
  * CHAR(#) FOR BIT DATA
 32  
  * VARCHAR(#)FOR BIT DATA
 33  
  * </code>
 34  
  * <p>
 35  
  * Where: # is the size= schema attribute or a default size specified in the constructor.
 36  
  * </p>
 37  
  * <p>
 38  
  * Note that this is dependent on the platform implimentation correctly defining BINARY and VARBINARY as having a size
 39  
  * attribute in the "hasSize()" method.
 40  
  * </p>
 41  
  * 
 42  
  * @see org.apache.torque.engine.platform.Platform
 43  
  * @see org.apache.torque.engine.database.model.Column#getSqlString()
 44  
  * @author <a href="Monroe@DukeCE.com">Greg Monroe</a>
 45  
  */
 46  
 public class SizedForBitDataDomain extends Domain {
 47  
 
 48  
     /**
 49  
      * @see org.apache.torque.engine.database.model.Domain#Domain()
 50  
      */
 51  
     public SizedForBitDataDomain() {
 52  0
         super();
 53  0
     }
 54  
 
 55  
     /**
 56  
      * @see org.apache.torque.engine.database.model.Domain#Domain(String)
 57  
      */
 58  
     public SizedForBitDataDomain(String name) {
 59  0
         super(name);
 60  0
     }
 61  
 
 62  
     /**
 63  
      * @see org.apache.torque.engine.database.model.Domain#Domain(SchemaType)
 64  
      */
 65  
     public SizedForBitDataDomain(SchemaType type) {
 66  0
         super(type);
 67  0
     }
 68  
 
 69  
     /**
 70  
      * @see org.apache.torque.engine.database.model.Domain# Domain(SchemaType, String)
 71  
      */
 72  
     public SizedForBitDataDomain(SchemaType type, String sqlType) {
 73  0
         super(type, sqlType);
 74  0
     }
 75  
 
 76  
     /**
 77  
      * @see org.apache.torque.engine.database.model.Domain# Domain(SchemaType, String, String, String)
 78  
      */
 79  
     public SizedForBitDataDomain(SchemaType type, String sqlType, String size, String scale) {
 80  0
         super(type, sqlType, size, scale);
 81  0
     }
 82  
 
 83  
     /**
 84  
      * @see org.apache.torque.engine.database.model.Domain# Domain(SchemaType, String, String)
 85  
      */
 86  
     public SizedForBitDataDomain(SchemaType type, String sqlType, String size) {
 87  0
         super(type, sqlType, size);
 88  0
     }
 89  
 
 90  
     /**
 91  
      * @see org.apache.torque.engine.database.model.Domain# Domain(Domain)
 92  
      */
 93  
     public SizedForBitDataDomain(Domain domain) {
 94  0
         super(domain);
 95  0
     }
 96  
 
 97  
     /**
 98  
      * Returns the size postfix for the base SQL Column type.
 99  
      * 
 100  
      * @return "(size) FOR BIT DATA" or just " FOR BIT DATA" if size is null.
 101  
      * @see org.apache.torque.engine.database.model.Domain#getSize()
 102  
      */
 103  
     public String printSize() {
 104  0
         String result = "";
 105  0
         if (getSize() != null) {
 106  0
             result = "(" + getSize() + ")";
 107  
         }
 108  0
         result = result + " FOR BIT DATA";
 109  0
         return result;
 110  
     }
 111  
 }