Get column of mysql type: int, integer, tinyint(n) n > 1, smallint, mediumint
552667
public Integer getInt(String column) {
		Number n = getNumber(column);
		return n != null ? n.intValue() : null;
	}
1306593
def unsigned_integer(self, column, auto_increment=False):
        
        return self.integer(column, auto_increment, True)
178123
function GetSqliteType()
	{
		$rt = $this->Type;
		switch ($this->Type)
		{
			case "int":
				$rt = "integer";
				break;
			case "smallint":
				$rt = "integer";
				break;
			case "tinyint":
				$rt = "integer";
				break;
			case "varchar":
				$rt = "text";
				break;
			case "text":
				$rt = "text";
				break;
			case "tinytext":
				$rt = "text";
				break;
			case "date":
				$rt = "datetime";
				break;
			case "datetime":
				$rt = "datetime";
				break;
			case "mediumint":
				$rt = "integer";
				break;
			case "bigint":
				$rt = "integer";
				break;
			case "decimal":
				$rt = "real";
				break;
			case "float":
				$rt = "real";
				break;
			default;
				break;
		}

		return $rt;
	}
362316
def tiny_integer(self, column, auto_increment=False, unsigned=False):
        
        return self._add_column('tiny_integer', column,
                                auto_increment=auto_increment,
                                unsigned=unsigned)
866421
public int getScale(int column) throws SQLException
    {
        sourceResultSet.checkColumnBounds(column);
        VoltType type = sourceResultSet.table.getColumnType(column - 1);
        Integer result = type.getMaximumScale();
        if (result == null) {
            result = 0;
        }
        return result;
    }
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");
        }
    }
561587
function MetaType($t,$len=-1,$fieldobj=false)
	{
		if (is_object($t)) {
			$fieldobj = $t;
			$t = $fieldobj->type;
			$len = $fieldobj->max_length;
		}

		$len = -1; // mysql max_length is not accurate
		switch (strtoupper($t)) {
		case 'R':
		case 'INT':
		case 'INTEGER': return  'I';
		case 'BIT':
		case 'TINYINT': return  'I1';
		case 'SMALLINT': return 'I2';
		case 'BIGINT':  return  'I8';
		case 'SMALLDATETIME': return 'T';
		case 'REAL':
		case 'FLOAT': return 'F';
		default: return parent::MetaType($t,$len,$fieldobj);
		}
	}
436118
def getTypeInfo(self, sql_type):  # nopep8
        
        fut = self._run_operation(self._impl.getTypeInfo, sql_type)
        return fut
459588
Integer getColNullability(int i) {

        ColumnSchema column = table.getColumn(i);

        return (column.isNullable() && !column.isPrimaryKey())
               ? ValuePool.getInt(DITypeInfo.columnNullable)
               : ValuePool.getInt(DITypeInfo.columnNoNulls);
    }
733597
Integer getMinScale() {

        switch (type) {

            case Types.SQL_BIGINT :
            case Types.SQL_DATE :
            case Types.SQL_INTEGER :
            case Types.SQL_SMALLINT :
            case Types.SQL_TIME :
            case Types.SQL_TIME_WITH_TIME_ZONE :
            case Types.SQL_TIMESTAMP :
            case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
            case Types.TINYINT :
            case Types.SQL_DECIMAL :
            case Types.SQL_NUMERIC :
                return ValuePool.INTEGER_0;

            case Types.SQL_FLOAT :
            case Types.SQL_REAL :
            case Types.SQL_DOUBLE :
                return ValuePool.getInt(-324);

            default :
                return null;
        }
    }
842538
private static int getSize(Object[] data, int l, Type[] types) {

        int s = 0;

        for (int i = 0; i < l; i++) {
            Object o = data[i];

            s += 1;    // type or null

            if (o != null) {
                switch (types[i].typeCode) {

                    case Types.SQL_ALL_TYPES :
                        throw Error.runtimeError(ErrorCode.U_S0500,
                                                 "RowOutputBinary");
                    case Types.SQL_CHAR :
                    case Types.SQL_VARCHAR :
                    case Types.VARCHAR_IGNORECASE :
                        s += 4;
                        s += StringConverter.getUTFSize((String) o);
                        break;

                    case Types.TINYINT :
                    case Types.SQL_SMALLINT :
                        s += 2;
                        break;

                    case Types.SQL_INTEGER :
                        s += 4;
                        break;

                    case Types.SQL_BIGINT :
                    case Types.SQL_REAL :
                    case Types.SQL_FLOAT :
                    case Types.SQL_DOUBLE :
                        s += 8;
                        break;

                    case Types.SQL_NUMERIC :
                    case Types.SQL_DECIMAL :
                        s += 8;

                        BigDecimal bigdecimal = (BigDecimal) o;
                        BigInteger bigint =
                            JavaSystem.unscaledValue(bigdecimal);

                        s += bigint.toByteArray().length;
                        break;

                    case Types.SQL_BOOLEAN :
                        s += 1;
                        break;

                    case Types.SQL_DATE :
                        s += 8;
                        break;

                    case Types.SQL_TIME :
                        s += 8;
                        break;

                    case Types.SQL_TIME_WITH_TIME_ZONE :
                        s += 12;
                        break;

                    case Types.SQL_TIMESTAMP :
                        s += 12;
                        break;

                    case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
                        s += 16;
                        break;

                    case Types.SQL_INTERVAL_YEAR :
                    case Types.SQL_INTERVAL_YEAR_TO_MONTH :
                    case Types.SQL_INTERVAL_MONTH :
                        s += 8;
                        break;

                    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 :
                        s += 12;
                        break;

                    case Types.SQL_BINARY :
                    case Types.SQL_VARBINARY :
                        s += 4;
                        s += ((BinaryData) o).length(null);
                        break;

                    case Types.SQL_BIT :
                    case Types.SQL_BIT_VARYING :
                        s += 4;
                        s += ((BinaryData) o).length(null);
                        break;

                    case Types.SQL_CLOB :
                    case Types.SQL_BLOB :
                        s += 8;
                        break;

                    case Types.OTHER :
                        JavaObjectData jo = (JavaObjectData) o;

                        s += 4;
                        s += jo.getBytesLength();
                        break;

                    default :
                        throw Error.runtimeError(ErrorCode.U_S0500,
                                                 "RowOutputBinary");
                }
            }
        }

        return s;
    }
781405
int getIndex(int row, int column) {
        check(row, column);
        return row + (2 * n - (column + 1)) * column / 2;
    }
1316923
def get_columns(context, query):
        """"""
        table_info = context.sql_client.send(query)
        if 'fields' in table_info:
            return Column.from_sql_api_fields(table_info['fields'])

        return None
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;
        }
    }
1316104
public int getInt(int columnIndex) {
		Object fieldValue = data[columnIndex];
		if (fieldValue == null) {
			return 0;
		}
		if (fieldValue instanceof Number) {
			return ((Number) fieldValue).intValue();
		}
		throw new DBFException("Unsupported type for Number at column:" + columnIndex + " "
				+ fieldValue.getClass().getCanonicalName());
	}
1346751
public String getSQLType(boolean bIncludeLength, Map<String, Object> properties) 
    {
        String strType = (String)properties.get(DBSQLTypes.SHORT);
        if (strType == null)
            strType = DBSQLTypes.SMALLINT;      // The default SQL Type (Byte)
        return  strType;        // The default SQL Type
    }
333346
public static function parse($intStr){
		
		$int = new static(\strlen($intStr));
		
		if(Number::between($int, MySQL::getConstant('TINYINT_MIN'),
				MySQL::getConstant('TINYINT_MAX'))){
			$int->_IntType = static::TINY_INT;
		}
		else if(Number::between($int, MySQL::getConstant('SMALLINT_MIN'),
				MySQL::getConstant('SMALLINT_MAX'))){
			$int->_IntType = static::SMALL_INT;
		}
		else if(Number::between($int, MySQL::getConstant('MEDIUMINT_MIN'),
				MySQL::getConstant('MEDIUMINT_MAX'))){
			$int->_IntType = static::MEDIUM_INT;
		}
		else if(Number::between($int, MySQL::getConstant('INT_MIN'),
				MySQL::getConstant('INT_MAX'))){
			$int->_IntType = static::INT;
		}
		else if(Number::between($int, MySQL::getConstant('BIGINT_MIN'),
				MySQL::getConstant('BIGINT_MAX'))){
			$int->_IntType = static::BIG_INT;
		}
		else{
			//No types can hold this
			return null;
		}
				
		return $int;
		
	}