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
 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  
 /**
 23  
  * <p>
 24  
  * Supports the Derby / DB2 / SQL92 standard for defining Binary data fields 
 25  
  * with either CHAR(#) FOR BIT DATA or VARCHAR(#) FOR BIT DATA. This can be 
 26  
  * used in Platform implimentors initialize() methods, by using lines like:
 27  
  * </p>
 28  
  * <code>
 29  
  * setSchemaDomainMapping(new SizedForBitDataDomain(
 30  
  *                          SchemaType.BINARY, "CHAR", "1"));
 31  
  * setSchemaDomainMapping(new SizedForBitDataDomain(
 32  
  *                          SchemaType.VARBINARY, "VARCHAR"));
 33  
  * </code>
 34  
  * <p>
 35  
  * This will cause the Column.getSqlString() method to produce items similar to:
 36  
  * </p>
 37  
  * <code>
 38  
  * CHAR(#) FOR BIT DATA
 39  
  * VARCHAR(#)FOR BIT DATA
 40  
  * </code>
 41  
  * <p>
 42  
  * Where: # is the size= schema attribute or a default size specified in the
 43  
  * constructor.
 44  
  * </p>
 45  
  * <p>
 46  
  * Note that this is dependent on the platform implimentation correctly defining
 47  
  * BINARY and VARBINARY as having a size attribute in the "hasSize()" method.
 48  
  * </p>
 49  
  *
 50  
  * @see org.apache.torque.engine.platform.Platform
 51  
  * @see org.apache.torque.engine.database.model.Column#getSqlString()
 52  
  * @author <a href="Monroe@DukeCE.com">Greg Monroe</a>
 53  
  */
 54  
 public class SizedForBitDataDomain extends Domain
 55  
 {
 56  
 
 57  
     /**
 58  
      * @see org.apache.torque.engine.database.model.Domain#Domain()
 59  
      */
 60  
     public SizedForBitDataDomain()
 61  
     {
 62  0
         super();
 63  0
     }
 64  
 
 65  
     /**
 66  
      * @see org.apache.torque.engine.database.model.Domain#Domain(String)
 67  
      */
 68  
     public SizedForBitDataDomain(String name)
 69  
     {
 70  0
         super(name);
 71  0
     }
 72  
 
 73  
     /**
 74  
      * @see org.apache.torque.engine.database.model.Domain#Domain(SchemaType)
 75  
      */
 76  
     public SizedForBitDataDomain(SchemaType type)
 77  
     {
 78  0
         super(type);
 79  0
     }
 80  
 
 81  
     /**
 82  
      * @see org.apache.torque.engine.database.model.Domain#
 83  
      *              Domain(SchemaType, String)
 84  
      */
 85  
     public SizedForBitDataDomain(SchemaType type, String sqlType)
 86  
     {
 87  0
         super(type, sqlType);
 88  0
     }
 89  
 
 90  
     /**
 91  
      * @see org.apache.torque.engine.database.model.Domain#
 92  
      *              Domain(SchemaType, String, String, String)
 93  
      */
 94  
     public SizedForBitDataDomain(SchemaType type, String sqlType, String size,
 95  
             String scale)
 96  
     {
 97  0
         super(type, sqlType, size, scale);
 98  0
     }
 99  
 
 100  
     /**
 101  
      * @see org.apache.torque.engine.database.model.Domain#
 102  
      *              Domain(SchemaType, String, String)
 103  
      */
 104  
     public SizedForBitDataDomain(SchemaType type, String sqlType, String size)
 105  
     {
 106  0
         super(type, sqlType, size);
 107  0
     }
 108  
 
 109  
     /**
 110  
      * @see org.apache.torque.engine.database.model.Domain#
 111  
      *              Domain(Domain)
 112  
      */
 113  
     public SizedForBitDataDomain(Domain domain)
 114  
     {
 115  0
         super(domain);
 116  0
     }
 117  
 
 118  
     /**
 119  
      * Returns the size postfix for the base SQL Column type.
 120  
      *
 121  
      * @return "(size) FOR BIT DATA" or just " FOR BIT DATA" if size
 122  
      * is null.
 123  
      * @see org.apache.torque.engine.database.model.Domain#getSize()
 124  
      */
 125  
     public String printSize()
 126  
     {
 127  0
         String result = "";
 128  0
         if ( getSize() != null )
 129  
         {
 130  0
             result =  "(" + getSize() + ")";
 131  
         }
 132  0
         result = result + " FOR BIT DATA";
 133  0
         return result;
 134  
     }
 135  
 }