001 /** 002 * Copyright (c) 2003 Daffodil Software Ltd all rights reserved, 003 * Modifications Copyright (c) 2008 Regiscope Digital Imaging Co, LLC, All rights reserved. 004 * This program is free software; you can redistribute it and/or modify 005 * it under the terms of version 2 of the GNU General Public License as 006 * published by the Free Software Foundation. 007 * There are special exceptions to the terms and conditions of the GPL 008 * as it is applied to this software. See the GNU General Public License for more details. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU General Public License for more details. 014 * 015 * You should have received a copy of the GNU General Public License 016 * along with this program; if not, write to the Free Software 017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 018 */ 019 020 package org.dbreplicator.replication; 021 022 import java.util.*; 023 024 /** 025 * This is a supporting class of different database handlers. It helps in storing 026 * and getting the column's information. 027 * 028 */ 029 030 public class ColumnsInfo 031 { 032 033 private String columnName; 034 private String typeDeclaration; 035 private static HashMap colTypeMap; 036 037 public ColumnsInfo(String columnName0, String typeDeclaration0) 038 { 039 040 columnName = columnName0; 041 typeDeclaration = typeDeclaration0; 042 if (colTypeMap == null) 043 { 044 colTypeMap = new HashMap(); 045 } 046 colTypeMap.put(columnName, typeDeclaration); 047 } 048 049 public String getColumnName() 050 { 051 return columnName; 052 } 053 054 public String getDataTypeDeclaration() 055 { 056 return typeDeclaration; 057 } 058 059 public static String getDataTypeDeclaration(String colName) 060 { 061 return (String) colTypeMap.get(colName); 062 } 063 064 /* private TypeInfo typeInfo; 065 private String typeName; 066 //private int sqlType; 067 private int columnSize; 068 //private String defaultValue; 069 //private String nullable; 070 //private boolean optsize; 071 072 public ColumnsInfo(String columnName0, TypeInfo typeInfo0, int columnSize0) { 073 columnName=columnName0; 074 typeInfo = typeInfo0; 075 typeName=typeInfo0.getTypeName(); 076 //sqlType=typeInfo0.getSqlType(); 077 columnSize=columnSize0; 078 } 079 080 public ColumnsInfo(TypeInfo typeInfo0, int columnSize0) { 081 typeInfo = typeInfo0; 082 typeName=typeInfo0.getTypeName(); 083 //sqlType=typeInfo0.getSqlType(); 084 columnSize=columnSize0; 085 } 086 087 public ColumnsInfo(String columnName0, String typeName0, int sqlType0, int columnSize0) { 088 columnName=columnName0; 089 typeName=typeName0; 090 sqlType=sqlType0; 091 columnSize=columnSize0; 092 } 093 094 public ColumnsInfo(String columnName0, String typeName0, int sqlType0, int columnSize0, String defaultValue0, String nullable0) { 095 columnName=columnName0; 096 typeName=typeName0; 097 sqlType=sqlType0; 098 columnSize=columnSize0; 099 defaultValue = defaultValue0; 100 nullable = nullable0; 101 } 102 103 public String getDataTypeName() { 104 return typeName; 105 } 106 107 // public String getDataTypeNameWithOptionalSize() { 108 // if(columnSize==-1 || columnSize==0) 109 public String getDataTypeNameWithOptionalSize(AbstractDataBaseHandler dbh) { 110 // if(!dbh.isDataTypeOptionalSizeSupported(typeinfo)) 111 // return typeName; 112 // return columnSize!=-1 ? typeName+"("+columnSize+")" : typeName; 113 // typeIno 114 return typeInfo.getTypeDeclaration(columnSize); 115 }*/ 116 }

