Get column of mysql type: unsigned bigint
16639
public java.math.BigInteger getBigInteger(String column) {
		return (java.math.BigInteger)getColumns().get(column);
	}
965810
private Integer[] getColumnSizeAndRadix(Column column)
    {
        Integer[] col_size_radix = {null, null};
        // This looks similar to VoltType.getTypePrecisionAndRadix.  However,
        // the String/VARBINARY values depend on the schema, not an intrinsic property
        // of the type, so it stays here for now.
        VoltType type = VoltType.get((byte) column.getType());
        switch(type)
        {
        //
        case TINYINT:
        case SMALLINT:
        case INTEGER:
        case BIGINT:
        case TIMESTAMP:
            col_size_radix[0] = (column.getSize() * 8) - 1;
            col_size_radix[1] = 2;
            break;
        case FLOAT:
            col_size_radix[0] = 53;  // magic for double
            col_size_radix[1] = 2;
            break;
        case STRING:
            col_size_radix[0] = column.getSize();
            col_size_radix[1] = null;
            break;
        case DECIMAL:
            col_size_radix[0] = VoltDecimalHelper.kDefaultPrecision;
            col_size_radix[1] = 10;
            break;
        case VARBINARY:
            col_size_radix[0] = column.getSize();
            col_size_radix[1] = null;
            break;
        default:
            // XXX What's the right behavior here?
        }
        return col_size_radix;
    }
754708
@Override
    public int getInt(int columnIndex) throws SQLException {
        checkColumnBounds(columnIndex);
        try {
            Long longValue = getPrivateInteger(columnIndex);
            if (longValue > Integer.MAX_VALUE || longValue < Integer.MIN_VALUE) {
                throw new SQLException("Value out of int range");
            }
            return longValue.intValue();
        } catch (Exception x) {
            throw SQLError.get(x);
        }
    }
255112
private static function getSchemaType($column)
    {
        // primary key
        if ($column->isPrimaryKey && $column->autoIncrement) {
            if ('bigint' === $column->type) {
                return 'bigPrimaryKey()';
            }
            return 'primaryKey()';
        }

        // boolean
        if ('tinyint(1)' === $column->dbType) {
            return 'boolean()';
        }

        // smallint
        if ('smallint' === $column->type) {
            if (null === $column->size) {
                return 'smallInteger()';
            }
            return 'smallInteger';
        }

        // bigint
        if ('bigint' === $column->type) {
            if (null === $column->size) {
                return 'bigInteger()';
            }
            return 'bigInteger';
        }

        // enum
        if (null !== $column->enumValues) {
            // https://github.com/yiisoft/yii2/issues/9797
            $enumValues = array_map('addslashes', $column->enumValues);
            return "enum(['".implode('\', \'', $enumValues)."'])";
        }

        // others
        if (null === $column->size && 0 >= $column->scale) {
            return $column->type.'()';
        }
        return $column->type;
    }
352374
static Long convertToLong(SessionInterface session, Object a) {

        if (a instanceof Integer) {
            return ValuePool.getLong(((Integer) a).intValue());
        } else if (a instanceof Long) {
            return (Long) a;
        } else if (a instanceof BigDecimal) {
            BigDecimal bd = (BigDecimal) a;

            if (bd.compareTo(MAX_LONG) > 0 || bd.compareTo(MIN_LONG) < 0) {
                throw Error.error(ErrorCode.X_22003);
            }

            return ValuePool.getLong(bd.longValue());
        } else if (a instanceof Double || a instanceof Float) {
            double d = ((Number) a).doubleValue();

            if (session instanceof Session) {
                if (!((Session) session).database.sqlConvertTruncate) {
                    d = java.lang.Math.rint(d);
                }
            }

            if (Double.isInfinite(d) || Double.isNaN(d)
                    || d >= (double) Long.MAX_VALUE + 1
                    || d <= (double) Long.MIN_VALUE - 1) {
                throw Error.error(ErrorCode.X_22003);
            }

            return ValuePool.getLong((long) d);
        } else {
            throw Error.error(ErrorCode.X_42561);
        }
    }
459588
Integer getColNullability(int i) {

        ColumnSchema column = table.getColumn(i);

        return (column.isNullable() && !column.isPrimaryKey())
               ? ValuePool.getInt(DITypeInfo.columnNullable)
               : ValuePool.getInt(DITypeInfo.columnNoNulls);
    }
450683
def get(self, key, default=None, cast=True):
        
        tablename, _, key = key.rpartition(':')
        if tablename and tablename not in self.fields.name.split('+'):
            raise ItsdbError('column requested from wrong table: {}'
                             .format(tablename))
        try:
            index = self.fields.index(key)
            value = list.__getitem__(self, index)
        except (KeyError, IndexError):
            value = default
        else:
            if cast:
                field = self.fields[index]
                value = _cast_to_datatype(value, field)
        return value
505300
protected function _getIntegerColumn(Column\Integer $column)
    {

        if ($column->getAutoIncrement()) {
            $this->_disablePrimaryConstraint = true;
            return $column->getName().' INTEGER PRIMARY KEY AUTOINCREMENT';
        }

        $type = 'INTEGER';

        $default = '';
        if ($column->getDefault()) {
            $default = ' DEFAULT '.$column->getDefault();
        }

        return sprintf(
            '%s %s%s%s%s',
            $column->getName(),
            $type,
            $this->_columnLength($column),
            $this->_nullableColumn($column),
            $default
        );
    }
217479
private Number getIdColumnData(ResultSet resultSet, ResultSetMetaData metaData, int columnIndex)
			throws SQLException {
		int typeVal = metaData.getColumnType(columnIndex);
		switch (typeVal) {
			case Types.BIGINT:
			case Types.DECIMAL:
			case Types.NUMERIC:
				return (Number) resultSet.getLong(columnIndex);
			case Types.INTEGER:
				return (Number) resultSet.getInt(columnIndex);
			default:
				String columnName = metaData.getColumnName(columnIndex);
				throw new SQLException(
						"Unexpected ID column type " + TypeValMapper.getSqlTypeForTypeVal(typeVal) + " (typeVal "
								+ typeVal + ") in column " + columnName + "(#" + columnIndex + ") is not a number");
		}
	}
1248272
public Class<?> getJavaType(int sqlType, String typeName, int size, int digits, String tableName, String columnName) {
        // table.column mapped class
        Type<?> type = javaTypeMapping.getType(tableName, columnName);
        if (type != null) {
            return type.getReturnedClass();
        } else if (typeName != null && !typeName.isEmpty()) {
            typeName = typeName.toLowerCase();
            // typename mapped class
            Class<?> clazz = typeToName.get(typeName);
            if (clazz != null) {
                return clazz;
            }
            if (sqlType == Types.ARRAY) {
                if (typeName.startsWith("_")) {
                    typeName = typeName.substring(1);
                } else if (typeName.endsWith(" array")) {
                    typeName = typeName.substring(0, typeName.length() - 6);
                }
                if (typeName.contains("[")) {
                    typeName = typeName.substring(0, typeName.indexOf("["));
                }
                if (typeName.contains("(")) {
                    typeName = typeName.substring(0, typeName.indexOf("("));
                }

                Integer sqlComponentType = templates.getCodeForTypeName(typeName);
                if (sqlComponentType == null) {
                    logger.warn("Found no JDBC type for " + typeName + " using OTHER instead");
                    sqlComponentType = Types.OTHER;
                }
                Class<?> componentType = jdbcTypeMapping.get(sqlComponentType, size, digits);
                return Array.newInstance(componentType, 0).getClass();
            }
        }
        // sql type mapped class
        return jdbcTypeMapping.get(sqlType, size, digits);
    }
1003923
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.DOUBLE);
            else
                statement.setDouble(iParamColumn, Double.NaN);
        }
        else
            statement.setDouble(iParamColumn, this.getValue());
    }
417254
def get_type_len(self):
        """"""
        # Check types and set type/len
        self.get_sql()
        return self.type, self.len, self.len_decimal
950884
Integer getColSqlDateTimeSub(int i) {

        ti.setTypeCode(table.getColumn(i).getDataType().getJDBCTypeCode());

        return ti.getSqlDateTimeSub();
    }
296206
public BigInteger getInternalBigInteger(ColumnInformation columnInfo) throws SQLException {
    if (lastValueWasNull()) {
      return null;
    }
    switch (columnInfo.getColumnType()) {
      case BIT:
        return BigInteger.valueOf((long) buf[pos]);
      case TINYINT:
        return BigInteger.valueOf((long)
            (columnInfo.isSigned() ? buf[pos] : (buf[pos] & 0xff)));
      case SMALLINT:
      case YEAR:
        short valueShort = (short) ((buf[pos] & 0xff) | ((buf[pos + 1] & 0xff) << 8));
        return BigInteger
            .valueOf((long) (columnInfo.isSigned() ? valueShort : (valueShort & 0xffff)));
      case INTEGER:
      case MEDIUMINT:
        int valueInt = ((buf[pos] & 0xff)
            + ((buf[pos + 1] & 0xff) << 8)
            + ((buf[pos + 2] & 0xff) << 16)
            + ((buf[pos + 3] & 0xff) << 24));
        return BigInteger.valueOf(((columnInfo.isSigned()) ? valueInt
            : (valueInt >= 0) ? valueInt : valueInt & 0xffffffffL));
      case BIGINT:
        long value = ((buf[pos] & 0xff)
            + ((long) (buf[pos + 1] & 0xff) << 8)
            + ((long) (buf[pos + 2] & 0xff) << 16)
            + ((long) (buf[pos + 3] & 0xff) << 24)
            + ((long) (buf[pos + 4] & 0xff) << 32)
            + ((long) (buf[pos + 5] & 0xff) << 40)
            + ((long) (buf[pos + 6] & 0xff) << 48)
            + ((long) (buf[pos + 7] & 0xff) << 56)
        );
        if (columnInfo.isSigned()) {
          return BigInteger.valueOf(value);
        } else {
          return new BigInteger(1, new byte[]{(byte) (value >> 56),
              (byte) (value >> 48), (byte) (value >> 40), (byte) (value >> 32),
              (byte) (value >> 24), (byte) (value >> 16), (byte) (value >> 8),
              (byte) value});
        }
      case FLOAT:
        return BigInteger.valueOf((long) getInternalFloat(columnInfo));
      case DOUBLE:
        return BigInteger.valueOf((long) getInternalDouble(columnInfo));
      case DECIMAL:
      case OLDDECIMAL:
        return BigInteger.valueOf(getInternalBigDecimal(columnInfo).longValue());
      default:
        return new BigInteger(new String(buf, pos, length, StandardCharsets.UTF_8));
    }
  }
530158
public int getInternalInt(ColumnInformation columnInfo) throws SQLException {
    if (lastValueWasNull()) {
      return 0;
    }
    long value = getInternalLong(columnInfo);
    rangeCheck(Integer.class, Integer.MIN_VALUE, Integer.MAX_VALUE, value, columnInfo);
    return (int) value;
  }
921556
public int getColumnType(final int column) throws SQLException {
    ColumnInformation ci = getColumnInformation(column);
    switch (ci.getColumnType()) {
      case BIT:
        if (ci.getLength() == 1) {
          return Types.BIT;
        }
        return Types.VARBINARY;
      case TINYINT:
        if (ci.getLength() == 1 && options.tinyInt1isBit) {
          return Types.BIT;
        }
        return Types.TINYINT;
      case YEAR:
        if (options.yearIsDateType) {
          return Types.DATE;
        }
        return Types.SMALLINT;
      case BLOB:
        if (ci.getLength() < 0 || ci.getLength() > 16777215) {
          return Types.LONGVARBINARY;
        }
        return Types.VARBINARY;
      case VARCHAR:
      case VARSTRING:
        if (ci.isBinary()) {
          return Types.VARBINARY;
        }
        if (ci.getLength() < 0) {
          return Types.LONGVARCHAR;
        }
        return Types.VARCHAR;
      case STRING:
        if (ci.isBinary()) {
          return Types.BINARY;
        }
        return Types.CHAR;
      default:
        return ci.getColumnType().getSqlType();
    }

  }
397339
public long getLong(int columnIndex) {
		Object fieldValue = data[columnIndex];
		if (fieldValue == null) {
			return 0;
		}
		if (fieldValue instanceof Number) {
			return ((Number) fieldValue).longValue();
		}
		throw new DBFException("Unsupported type for Number at column:" + columnIndex + " "
				+ fieldValue.getClass().getCanonicalName());
	}