Java SQL Type getAntipodeForFunction(String base, int destType)

Here you can find the source of getAntipodeForFunction(String base, int destType)

Description

get Antipode For Function

License

Open Source License

Declaration

public static String getAntipodeForFunction(String base, int destType) 

Method Source Code

//package com.java2s;
/*/*  www. j a  v  a  2s  . com*/
_______________________
Apatar Open Source Data Integration
Copyright (C) 2005-2007, Apatar, Inc.
info@apatar.com
195 Meadow St., 2nd Floor
Chicopee, MA 01013
    
### This program 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 2 of the License, or
### (at your option) any later version.
    
### This program 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, write to the Free Software Foundation, Inc.,
### 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
________________________
    
 */

import java.sql.Types;

public class Main {
    public static String getAntipodeForFunction(String base, int destType) {

        if (base.startsWith("com.apatar.functions.String.data.")) {
            if ("com.apatar.functions.String.data.ToInt16TransformFunction".equals(base)
                    || "com.apatar.functions.String.data.ToInt32TransformFunction".equals(base)
                    || "com.apatar.functions.String.data.ToInt64TransformFunction".equals(base)
                    || "com.apatar.functions.String.data.ToIntSingleTransformFunction".equals(base)
                    || "com.apatar.functions.String.data.ToBooleanTransformFunction".equals(base)) {
                switch (destType) {
                case Types.BIGINT: // ToInt64
                    return "com.apatar.functions.String.data.ToInt64TransformFunction";

                case Types.INTEGER: // ToInt32
                case Types.SMALLINT: // ToInt32
                    return "com.apatar.functions.String.data.ToInt32TransformFunction";

                case Types.TINYINT: // ToInt16
                    return "com.apatar.functions.String.data.ToInt16TransformFunction";

                case Types.BIT: // ToSingle
                    return "com.apatar.functions.String.data.ToSingleTransformFunction";

                case Types.DECIMAL: // ToDecimal
                    return "com.apatar.functions.String.data.ToDecimalTransformFunction";

                case Types.DOUBLE: // ToDouble
                case Types.FLOAT:
                case Types.NUMERIC:
                case Types.REAL:
                    return "com.apatar.functions.String.data.ToDoubleTransformFunction";

                case Types.CHAR: // ToString
                case Types.CLOB:
                case Types.LONGVARCHAR:
                case Types.VARCHAR:
                    return "com.apatar.functions.String.data.ToStringTransformFunction";

                }

            } else if ("com.apatar.functions.String.data.ToDateTransformFunction".equals(base)
                    || "com.apatar.functions.String.data.ToTimeTransformFunction".equals(base)) {
                switch (destType) {
                case Types.CLOB: // ToString
                case Types.LONGVARCHAR:
                case Types.VARCHAR:
                    return "com.apatar.functions.String.data.ToStringTransformFunction";
                case Types.DATE:
                    return "com.apatar.functions.String.data.ToDateTransformFunction";
                case Types.TIME:
                    return "com.apatar.functions.String.data.ToTimeTransformFunction";

                }
            }

            return null;
        } else {
            return null;
        }
    }
}

Related

  1. deserializeSQLTypesToJava(String sqltypename, String value)
  2. dumpTypes(Connection pConnection)
  3. extractConstant(String typeName)
  4. fillLogParams(String sql, Map logParams)
  5. findMethod(Class returnType, Class parameterType)
  6. getArgTypes()
  7. getAsciiStream(Object value, int columnType)
  8. getBinary(Object value, int columnType)
  9. getBinaryStream(Object value, int columnType)