我在 MySQL 中有一个 GeoIP 表。IP 范围用 定义BINARY(16)
。当我使用查询查找 IP 地址时:
SELECT `countries_countryID` FROM `geoIP` WHERE INET_ATON("84.224.199.84") BETWEEN `geoIP`.`ipFrom` AND `geoIP`.`ipTo` LIMIT 1;
我收到警告消息(20-30000),说:"Truncated incorrect DOUBLE value: '17498112\x00\x00\x00\x00\x00\x00\x00\x00'"
桌子:
DROP TABLE IF EXISTS `geoIP` ;
CREATE TABLE IF NOT EXISTS `geoIP` (
`geoIPID` INT NOT NULL AUTO_INCREMENT ,
`IPFrom` BINARY(16) NOT NULL ,
`IPTo` BINARY(16) NOT NULL ,
`countries_countryID` INT NOT NULL ,
PRIMARY KEY (`geoIPID`) ,
INDEX `fk_geoIP_countries1_idx` (`countries_countryID` ASC) ,
INDEX `IPTo_INDEX` (`IPTo` ASC) ,
INDEX `IPFrom_INDEX` (`IPFrom` ASC) ,
CONSTRAINT `fk_geoIP_countries1`
FOREIGN KEY (`countries_countryID` )
REFERENCES `countries` (`countryID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
结果正确,国家代码正确返回,但有这些警告信息。怎么了?