Java SQL Type mapXSDTypeName2SQLtype(String xsdtype)

Here you can find the source of mapXSDTypeName2SQLtype(String xsdtype)

Description

map XSD Type Name SQ Ltype

License

Open Source License

Declaration

public static int mapXSDTypeName2SQLtype(String xsdtype) 

Method Source Code

//package com.java2s;
/*##############################################################################
    /*from   w w  w .j  a va  2 s .c  o  m*/
Copyright (C) 2011 HPCC Systems.
    
All rights reserved. This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
    
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
############################################################################## */

import java.util.HashMap;

public class Main {
    public final static HashMap<String, Integer> mapXSDTypeNameToSQLType = new HashMap<String, Integer>();

    public static int mapXSDTypeName2SQLtype(String xsdtype) {
        xsdtype = xsdtype.toUpperCase();
        //let's try to find the type as is
        if (mapXSDTypeNameToSQLType.containsKey(xsdtype))
            return mapXSDTypeNameToSQLType.get(xsdtype);
        else {
            //let's try to find it without any namespace information
            String postfixUpper = xsdtype.substring(xsdtype.lastIndexOf(':') + 1);
            if (mapXSDTypeNameToSQLType.containsKey(postfixUpper))
                return mapXSDTypeNameToSQLType.get(postfixUpper);
            else
                return java.sql.Types.OTHER;
        }
    }
}

Related

  1. listToJson(List list)
  2. loadAllTypesData(Connection conn)
  3. loadTestDataForEveryType(Connection conn)
  4. mapECLtype2SQLtype(String ecltype)
  5. mapType(Class javaType)
  6. marshalCurlType(String javaType, boolean isAllowNull, boolean generateGenerics)
  7. matchMethods(String name, Method[] methods, Class[] spt, int mrs, boolean exact)
  8. nativeSQL(String sql, boolean noBackslashEscapes)
  9. newArrayOfType(int typeCode, int size)

  10. HOME | Copyright © www.java2s.com 2016