Returns the primary type value associated with the SqlType argument.
9514
public static int getTypeValForSqlType(SqlType sqlType) throws SQLException {
		int[] typeVals = typeToValMap.get(sqlType);
		if (typeVals == null) {
			throw new SQLException("SqlType is unknown to type val mapping: " + sqlType);
		}
		if (typeVals.length == 0) {
			throw new SQLException("SqlType does not have any JDBC type value mapping: " + sqlType);
		} else {
			return typeVals[0];
		}
	}
913023
Integer getColBufLen(int i) {

        int          size;
        int          type;
        ColumnSchema column;

        column = table.getColumn(i);
        type   = column.getDataType().getJDBCTypeCode();

        switch (type) {

            case Types.SQL_CHAR :
            case Types.SQL_CLOB :
            case Types.VARCHAR_IGNORECASE :
            case Types.SQL_VARCHAR : {
                size = column.getDataType().precision > Integer.MAX_VALUE
                       ? Integer.MAX_VALUE
                       : (int) column.getDataType().precision;

                if (size == 0) {}
                else if (size > HALF_MAX_INT) {
                    size = 0;
                } else {
                    size = 2 * size;
                }

                break;
            }
            case Types.SQL_BINARY :
            case Types.SQL_BLOB :
            case Types.SQL_VARBINARY : {
                size = column.getDataType().precision > Integer.MAX_VALUE
                       ? Integer.MAX_VALUE
                       : (int) column.getDataType().precision;

                break;
            }
            case Types.SQL_BIGINT :
            case Types.SQL_DOUBLE :
            case Types.SQL_FLOAT :
            case Types.SQL_DATE :
            case Types.SQL_REAL :
            case Types.SQL_TIME_WITH_TIME_ZONE :
            case Types.SQL_TIME : {
                size = 8;

                break;
            }
            case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
            case Types.SQL_TIMESTAMP : {
                size = 12;

                break;
            }
            case Types.SQL_INTEGER :
            case Types.SQL_SMALLINT :
            case Types.TINYINT : {
                size = 4;

                break;
            }
            case Types.SQL_BOOLEAN : {
                size = 1;

                break;
            }
            default : {
                size = 0;

                break;
            }
        }

        return (size > 0) ? ValuePool.getInt(size)
                          : null;
    }
1308189
public static String getDefaultValueForType( JType type ) {
        JPrimitiveType primitiveType = type.isPrimitive();
        if ( null != primitiveType ) {
            return primitiveType.getUninitializedFieldExpression();
        }
        return "null";
    }
925863
private static String getType(Database db, VoltXMLElement elm) {
        final String type = elm.getStringAttribute("valuetype", "");
        if (! type.isEmpty()) {
            return type;
        } else if (elm.name.equals("columnref")) {
            final String tblName = elm.getStringAttribute("table", "");
            final int colIndex = elm.getIntAttribute("index", 0);
            return StreamSupport.stream(db.getTables().spliterator(), false)
                    .filter(tbl -> tbl.getTypeName().equals(tblName))
                    .findAny()
                    .flatMap(tbl ->
                            StreamSupport.stream(tbl.getColumns().spliterator(), false)
                                    .filter(col -> col.getIndex() == colIndex)
                                    .findAny())
                    .map(Column::getType)
                    .map(typ -> VoltType.get((byte) ((int)typ)).getName())
                    .orElse("");
        } else {
            return "";
        }
    }
40769
static Type getType(int setType, Type type) {

        if (setType == OpTypes.COUNT) {
            return Type.SQL_BIGINT;
        }

        // A VoltDB extension to handle aggfnc(*) syntax errors.
        // If the argument node does not have
        // a data type, it may be '*'.  If the
        // operation is COUNT (optype == 71) this is
        // just fine.  But if it's anything else this
        // is a syntax error.
        if (type == null) {
            throw Error.error(ErrorCode.U_S0500);
        }
        // End of VoltDB extension
        int dataType = type.isIntervalType() ? Types.SQL_INTERVAL
                                             : type.typeCode;

        switch (setType) {

            case OpTypes.AVG : {
                switch (dataType) {

                    case Types.TINYINT :
                    case Types.SQL_SMALLINT :
                    case Types.SQL_INTEGER :
                    case Types.SQL_BIGINT :
                    case Types.SQL_REAL :
                    case Types.SQL_FLOAT :
                    case Types.SQL_DOUBLE :
                    case Types.SQL_NUMERIC :
                    case Types.SQL_DECIMAL :
                    case Types.SQL_INTERVAL :
                        return type;

                    default :
                        throw Error.error(ErrorCode.X_42565);
                }
            }
            case OpTypes.SUM : {
                switch (dataType) {

                    case Types.TINYINT :
                    case Types.SQL_SMALLINT :
                    case Types.SQL_INTEGER :
                        return Type.SQL_BIGINT;

                    case Types.SQL_BIGINT :
                        return Type.SQL_DECIMAL_BIGINT_SQR;

                    case Types.SQL_REAL :
                    case Types.SQL_FLOAT :
                    case Types.SQL_DOUBLE :
                        return Type.SQL_DOUBLE;

                    case Types.SQL_NUMERIC :
                    case Types.SQL_DECIMAL :
                        return Type.getType(type.typeCode, 0,
                                            type.precision * 2, type.scale);

                    case Types.SQL_INTERVAL :
                        return IntervalType.newIntervalType(
                            type.typeCode, DTIType.maxIntervalPrecision,
                            type.scale);

                    default :
                        throw Error.error(ErrorCode.X_42565);
                }
            }
            case OpTypes.MIN :
            case OpTypes.MAX :
                return type;

            case OpTypes.EVERY :
            case OpTypes.SOME :
                if (type.isBooleanType()) {
                    return Type.SQL_BOOLEAN;
                }
                break;

            case OpTypes.STDDEV_POP :
            case OpTypes.STDDEV_SAMP :
            case OpTypes.VAR_POP :
            case OpTypes.VAR_SAMP :
                if (type.isNumberType()) {
                    return Type.SQL_DOUBLE;
                }
                break;

            // A VoltDB extension for APPROX_COUNT_DISTINCT
            case OpTypes.APPROX_COUNT_DISTINCT :
                switch (dataType) {
                case Types.TINYINT :
                case Types.SQL_SMALLINT :
                case Types.SQL_INTEGER :
                case Types.SQL_BIGINT :
                case Types.SQL_DECIMAL :
                case Types.SQL_TIMESTAMP :
                    return Type.SQL_BIGINT;
                default:
                    // We only support fixed-width types for this
                    // aggregate function.
                    //
                    // FLOAT is not supported since this function
                    // relies on different values having different bit
                    // patterns, and the same values being the
                    // same.  Floating point numbers don't hold to
                    // this---e.g., positive and negative zero.
                    //
                    // Incompatible data types in operation
                    throw Error.error(ErrorCode.X_42565);
                }
            // End of VoltDB extension for APPROX_COUNT_DISTINCT
            default :
                throw Error.runtimeError(ErrorCode.U_S0500, "SetFunction");
        }

        throw Error.error(ErrorCode.X_42565);
    }
1047872
public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException
    {
        if (this.isNull())
        {
            if ((this.isNullable()) && (iType != DBConstants.SQL_SELECT_TYPE))
                statement.setNull(iParamColumn, Types.FLOAT);
            else
                statement.setFloat(iParamColumn, Float.NaN);
        }
        else
        {
            if (DBConstants.FALSE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.FLOAT_XFER_SUPPORTED)))    // HACK for Access
                super.getSQLFromField(statement, iType, iParamColumn);
            else
                statement.setFloat(iParamColumn, (float)this.getValue());
        }
    }
2988
@Override
    public String getPrimaryType() {
        return resource instanceof JcrResource
                ? ((JcrResource) resource).getPrimaryType()
                : getProperty(JcrConstants.JCR_PRIMARYTYPE);
    }
641568
public static int toSQLType(String strType) throws DatabaseException {
	strType = strType.toUpperCase().trim();
	if (strType.startsWith("CF_SQL_")) strType = strType.substring(7);
	if (strType.startsWith("SQL_")) strType = strType.substring(4);

	if (strType.length() > 2) {
	    char first = strType.charAt(0);
	    if (first == 'A') {
		if (strType.equals("ARRAY")) return Types.ARRAY;
	    }
	    else if (first == 'B') {
		if (strType.equals("BIGINT")) return Types.BIGINT;
		else if (strType.equals("BINARY")) return Types.BINARY;
		else if (strType.equals("BIT")) return Types.BIT;
		else if (strType.equals("BLOB")) return Types.BLOB;
		else if (strType.equals("BOOLEAN")) return Types.BOOLEAN;
		else if (strType.equals("BOOL")) return Types.BOOLEAN;
	    }
	    else if (first == 'C') {
		if (strType.equals("CLOB")) return Types.CLOB;
		else if (strType.equals("CHAR")) return Types.CHAR;
		else if (strType.equals("CLOB")) return Types.CLOB;
		else if (strType.equals("CURSOR")) return CFTypes.CURSOR;
	    }
	    else if (first == 'D') {
		if (strType.equals("DATALINK")) return Types.DATALINK;
		else if (strType.equals("DATE")) return Types.DATE;
		else if (strType.equals("DISTINCT")) return Types.DISTINCT;
		else if (strType.equals("DECIMAL")) return Types.DECIMAL;
		else if (strType.equals("DOUBLE")) return Types.DOUBLE;
	    }
	    else if (first == 'F') {
		if (strType.equals("FLOAT")) return Types.FLOAT;
	    }
	    else if (first == 'I') {
		if (strType.equals("IDSTAMP")) return CFTypes.IDSTAMP;
		else if (strType.equals("INTEGER")) return Types.INTEGER;
		else if (strType.equals("INT")) return Types.INTEGER;
	    }
	    else if (first == 'L') {
		// if(strType.equals("LONG"))return Types.INTEGER;
		if (strType.equals("LONGVARBINARY")) return Types.LONGVARBINARY;
		else if (strType.equals("LONGVARCHAR")) return Types.LONGVARCHAR;
	    }
	    else if (first == 'M') {
		if (strType.equals("MONEY")) return Types.DOUBLE;
		else if (strType.equals("MONEY4")) return Types.DOUBLE;
	    }
	    else if (first == 'N') {
		if (strType.equals("NUMERIC")) return Types.NUMERIC;
		else if (strType.equals("NUMBER")) return Types.NUMERIC;
		else if (strType.equals("NULL")) return Types.NULL;
		else if (strType.equals("NCHAR")) return Types.NCHAR;
		else if (strType.equals("NCLOB")) return Types.NCLOB;
		else if (strType.equals("NVARCHAR")) return Types.NVARCHAR;

	    }
	    else if (first == 'O') {
		if (strType.equals("OTHER")) return Types.OTHER;
		else if ("OBJECT".equals(strType)) return Types.OTHER;
	    }
	    else if (first == 'R') {
		if (strType.equals("REAL")) return Types.REAL;
		else if (strType.equals("REF")) return Types.REF;
		else if (strType.equals("REFCURSOR")) return CFTypes.CURSOR;
	    }
	    else if (first == 'S') {
		if (strType.equals("SMALLINT")) return Types.SMALLINT;
		else if (strType.equals("STRUCT")) return Types.STRUCT;
		else if (strType.equals("STRING")) return Types.VARCHAR;
		else if (strType.equals("SQLXML")) return Types.SQLXML;
	    }
	    else if (first == 'T') {
		if (strType.equals("TIME")) return Types.TIME;
		else if (strType.equals("TIMESTAMP")) return Types.TIMESTAMP;
		else if (strType.equals("TINYINT")) return Types.TINYINT;
	    }
	    else if (first == 'V') {
		if (strType.equals("VARBINARY")) return Types.VARBINARY;
		else if (strType.equals("VARCHAR")) return Types.VARCHAR;
		else if (strType.equals("VARCHAR2")) return CFTypes.VARCHAR2;
	    }
	}

	throw new DatabaseException("invalid CF SQL Type [" + strType + "]", null, null, null);
    }
955520
public static Type  getType(int type, int collation, long precision,
                               int scale) {

        switch (type) {

            case Types.SQL_ALL_TYPES :
                return SQL_ALL_TYPES;

//                return SQL_ALL_TYPES; // needs changes to Expression type resolution
            case Types.SQL_CHAR :
            case Types.SQL_VARCHAR :
            case Types.VARCHAR_IGNORECASE :
            case Types.SQL_CLOB :
                return CharacterType.getCharacterType(type, precision);

            case Types.SQL_INTEGER :
                return SQL_INTEGER;

            case Types.SQL_SMALLINT :
                return SQL_SMALLINT;

            case Types.SQL_BIGINT :
                return SQL_BIGINT;

            case Types.TINYINT :
                return TINYINT;

            case Types.SQL_FLOAT :
                if (precision > 53) {
                    throw Error.error(ErrorCode.X_42592, "" + precision);
                }

            // $FALL-THROUGH$
            case Types.SQL_REAL :
            case Types.SQL_DOUBLE :
                return SQL_DOUBLE;

            case Types.SQL_NUMERIC :
            case Types.SQL_DECIMAL :
                if (precision == 0) {
                    precision = NumberType.defaultNumericPrecision;
                }

                // A VoltDB extension to disable variable scale decimals
                scale = 12;
                // End of VoltDB extension
                return NumberType.getNumberType(type, precision, scale);

            case Types.SQL_BOOLEAN :
                return SQL_BOOLEAN;

            case Types.SQL_BINARY :
            case Types.SQL_VARBINARY :
            case Types.SQL_BLOB :
                return BinaryType.getBinaryType(type, precision);

            case Types.SQL_BIT :
            case Types.SQL_BIT_VARYING :
                return BitType.getBitType(type, precision);

            case Types.SQL_DATE :
            case Types.SQL_TIME :
            case Types.SQL_TIME_WITH_TIME_ZONE :
            case Types.SQL_TIMESTAMP :
            case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
                return DateTimeType.getDateTimeType(type, scale);

            case Types.SQL_INTERVAL_YEAR :
            case Types.SQL_INTERVAL_YEAR_TO_MONTH :
            case Types.SQL_INTERVAL_MONTH :
            case Types.SQL_INTERVAL_DAY :
            case Types.SQL_INTERVAL_DAY_TO_HOUR :
            case Types.SQL_INTERVAL_DAY_TO_MINUTE :
            case Types.SQL_INTERVAL_DAY_TO_SECOND :
            case Types.SQL_INTERVAL_HOUR :
            case Types.SQL_INTERVAL_HOUR_TO_MINUTE :
            case Types.SQL_INTERVAL_HOUR_TO_SECOND :
            case Types.SQL_INTERVAL_MINUTE :
            case Types.SQL_INTERVAL_MINUTE_TO_SECOND :
            case Types.SQL_INTERVAL_SECOND :
                return IntervalType.getIntervalType(type, precision, scale);

            case Types.VOLT_GEOGRAPHY_POINT :
                return VOLT_GEOGRAPHY_POINT;

            case Types.VOLT_GEOGRAPHY :
                return new VoltGeographyType(precision);

            case Types.OTHER :
                return OTHER;

            default :
                throw Error.runtimeError(ErrorCode.U_S0500, "Type");
        }
    }
458140
Integer getSqlDataType() {

        // values from SQL200n SQL CLI spec, or DITypes (which in turn borrows
        // first from java.sql.Types and then SQL200n SQL CLI spec) if there
        // was no corresponding value in SQL CLI
        switch (type) {

            case Types.SQL_ARRAY :
                return ValuePool.getInt(Types.SQL_ARRAY);           // SQL_ARRAY

            case Types.SQL_BIGINT :
                return ValuePool.getInt(Types.SQL_BIGINT);          // SQL_BIGINT

            case Types.SQL_BINARY :
                return ValuePool.getInt(Types.SQL_BLOB);            // fredt- was SQL_BIT_VARYING

            case Types.SQL_BOOLEAN :
                return ValuePool.getInt(Types.SQL_BOOLEAN);         // SQL_BOOLEAN

            case Types.SQL_BLOB :
                return ValuePool.getInt(Types.SQL_BLOB);            // SQL_BLOB

            case Types.SQL_CHAR :
                return ValuePool.getInt(Types.SQL_CHAR);            // SQL_CHAR

            case Types.SQL_NCHAR :
                return ValuePool.getInt(Types.SQL_NCHAR);

            case Types.SQL_CLOB :
                return ValuePool.getInt(Types.SQL_CLOB);            // SQL_CLOB

            case Types.NCLOB :
                return ValuePool.getInt(Types.SQL_CLOB);            // N/A : SQL_CLOB

            case Types.SQL_DATALINK :
                return ValuePool.getInt(Types.SQL_DATALINK);        // SQL_DATALINK

            case Types.SQL_DATE :

                // NO:  This is the _concise_ code, whereas what we want to
                //      return here is the Data Type Code column value from
                //      Table 38 in the SQL 200n FCD.  This method is used
                //      by DatabaseInformationMain to list the sql type
                //      column in the SYSTEM_TYPEINFO table, which is specified
                //      by JDBC as the sql data type code, not the concise code.
                //      That is why there is a sql datetime sub column
                //      specified as well.
                // return ValuePool.getInt(Types.SQL_DATE);         // fredt - was SQL_DATETIME
                return ValuePool.getInt(Types.SQL_DATETIME);

            case Types.SQL_DECIMAL :
                return ValuePool.getInt(Types.SQL_DECIMAL);         // SQL_DECIMAL

            case Types.DISTINCT :
                return ValuePool.getInt(Types.SQL_UDT);             // SQL_UDT

            case Types.SQL_DOUBLE :
                return ValuePool.getInt(Types.SQL_DOUBLE);          // SQL_DOUBLE

            case Types.SQL_FLOAT :
                return ValuePool.getInt(Types.SQL_FLOAT);           // SQL_FLOAT

            case Types.SQL_INTEGER :
                return ValuePool.getInt(Types.SQL_INTEGER);         // SQL_INTEGER

            case Types.JAVA_OBJECT :
                return ValuePool.getInt(Types.JAVA_OBJECT);         // N/A - maybe SQL_UDT?

            case Types.SQL_ALL_TYPES :
                return ValuePool.getInt(Types.SQL_ALL_TYPES);       // SQL_ALL_TYPES

            case Types.SQL_NUMERIC :
                return ValuePool.getInt(Types.SQL_NUMERIC);         // SQL_NUMERIC

            case Types.OTHER :
                return ValuePool.getInt(Types.OTHER);               // N/A - maybe SQL_UDT?

            case Types.SQL_REAL :
                return ValuePool.getInt(Types.SQL_REAL);            // SQL_REAL

            case Types.ROWID :
                return ValuePool.getInt(Types.SQL_GUID);

            case Types.SQL_REF :
                return ValuePool.getInt(Types.SQL_REF);             // SQL_REF

            case Types.SQL_SMALLINT :
                return ValuePool.getInt(Types.SQL_SMALLINT);        // SQL_SMALLINTEGER

            case Types.STRUCT :
                return ValuePool.getInt(Types.SQL_UDT);             // SQL_UDT

            case Types.SQL_TIME :

                // NO:  This is the _concise_ code, whereas what we want to
                //      return here is the Data Type Code column value from
                //      Table 38 in the SQL 200n FCD.  This method is used
                //      by DatabaseInformationMain to list the sql type
                //      column in the SYSTEM_TYPEINFO table, which is specified
                //      by JDBC as the sql data type code, not the concise code.
                //      That is why there is a sql datetime sub column
                //      specified as well.
                // return ValuePool.getInt(Types.SQL_TIME);         // fredt - was SQL_DATETIME
                return ValuePool.getInt(Types.SQL_DATETIME);

            case Types.SQL_TIMESTAMP :

                // NO:  This is the _concise_ code, whereas what we want to
                //      return here is the Data Type Code column value from
                //      Table 38 in the SQL CLI 200n FCD.  This method is used
                //      by DatabaseInformationMain to list the sql type
                //      column in the SYSTEM_TYPEINFO table, which is specified
                //      by JDBC as the sql data type code, not the concise code.
                //      That is why there is a sql datetime sub column
                //      specified as well.
                // return ValuePool.getInt(Types.SQL_TIMESTAMP);    // fredt - was SQL_DATETIME
                return ValuePool.getInt(Types.SQL_DATETIME);

            case Types.TINYINT :
                return ValuePool.getInt(Types.TINYINT);             // N/A

            case Types.SQL_VARBINARY :
                return ValuePool.getInt(Types.SQL_BLOB);            // SQL_BIT_VARYING

            case Types.SQL_VARCHAR :
                return ValuePool.getInt(Types.SQL_VARCHAR);         // SQL_VARCHAR

            case Types.VARCHAR_IGNORECASE :
                return ValuePool.getInt(Types.SQL_VARCHAR);         // SQL_VARCHAR

            case Types.SQL_NVARCHAR :
                return ValuePool.getInt(Types.SQL_NVARCHAR);

            case Types.SQL_XML :
                return ValuePool.getInt(Types.SQL_XML);             // SQLXML

            default :
                return null;
        }
    }
1039151
@Nullable
    public String getStringValueForType(SchemaService.RecordType type) {
        switch (type) {
            case NAMESPACE:
                return getNamespace();
            case SCOPE:
                return getScope();
            case METRIC:
                return getMetric();
            case TAGK:
                return getTagKey();
            case TAGV:
                return getTagValue();
            case RETENTION_DISCOVERY:
                return getRetentionDiscovery()==null?null:getRetentionDiscovery().toString();
            default:
                return null;
        }
    }
1269987
def _get_dbal_column_type(self, type_):
        
        type_ = type_.lower()

        if type_ == "big_integer":
            type_ = "bigint"
        elif type == "small_integer":
            type_ = "smallint"
        elif type_ in ["medium_text", "long_text"]:
            type_ = "text"

        return type_
1373918
public String getType() {
		if (this.type == null)
			this.type = this.resultHandler.getRelationType(getId(), this.rowIndex);
		return this.type;
	}
975609
public String getSQLType(boolean bIncludeLength, Map<String, Object> properties) 
    {
        String strType = (String)properties.get(DBSQLTypes.BOOLEAN);
        if (strType == null)
            strType = DBSQLTypes.BYTE;      // The default SQL Type (Byte)
        return strType;
    }
326942
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
    public static int getType(Cursor cursor, String columnName) {
        if (cursor == null) {
            return Cursor.FIELD_TYPE_NULL;
        }

        return cursor.getType(cursor.getColumnIndex(columnName));
    }
1115990
def get_arg_value_as_type(self, key, default=None, convert_int=False):
        

        val = self.get_query_argument(key, default)

        if isinstance(val, int):
            return val

        if val.lower() in ['true', 'yes']:
            return True

        if val.lower() in ['false', 'no']:
            return False

        return val
591538
public static <T> T getOrDefaultValue(String primaryKey, T defaultValue) {
        Object val = CFG.get(primaryKey);
        return val == null ? defaultValue : (T) CompatibleTypeUtils.convert(val, defaultValue.getClass());
    }