Here you can find the source of columnTypesDiffer(int t1, int t2)
Parameter | Description |
---|---|
t1 | One of the column types to compare |
t2 | One of the column types to compare. |
public static boolean columnTypesDiffer(int t1, int t2)
//package com.java2s; /*//from w w w. j av a 2s . c om * Copyright (c) 2008, SQL Power Group Inc. * * This file is part of Power*Architect. * * Power*Architect is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Power*Architect is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.sql.Types; public class Main { /** * Checks if the given column types materially differ. Some data * types (for example, DECIMAL and NUMERIC) are essentially the same. * * @param t1 One of the column types to compare * @param t2 One of the column types to compare. * @return True iff the given column types are materially different */ public static boolean columnTypesDiffer(int t1, int t2) { int sourceType = compressType(t1); int targetType = compressType(t2); return sourceType != targetType; } /** * Compresses all the different kinds of essentially identical types * into an arbitrarily chosen one of them. For instance, NUMERIC * and DECIMAL both compress to NUMERIC. * * @param type * @return */ private static int compressType(int type) { if (type == Types.DECIMAL) { return Types.NUMERIC; } else { return type; } } }