所以我想把msyql查询转换成sqlite,其中有十六进制代码中的图像,当我在sqlite浏览器中运行相同的查询时,它给了我一个错误,正确的方法是什么。
Result: hex literal too big: 0x73616666726f6e2e6a7067
At line 1:
INSERT INTO `test` (`id`, `yeild`, `image`, `city`, `info`, `fertilizer`) VALUES
(9, 'Wheat', 0x77686561742e6a7067, 'Bangalore', 'Weather that is comfortable for humans is also good for wheat. Wheat needs 12\r\nto 15 inches (31 to 38 centimetres) of water to produce a')
CREATE TABLE IF NOT EXISTS `test` (
`id` int(11) NOT NULL PRIMARY KEY,
`yeild` varchar(40) NOT NULL,
`image` blob NOT NULL,
`city` varchar(50) NOT NULL,
`info` varchar(60000) NOT NULL,
`fertilizer` varchar(5000) NOT NULL);发布于 2020-03-15 06:13:48
您希望插入blob文字,而不是数字:
X'77686561742e6a7067'来自文献资料
十六进制整数文本被解释为64位二补整数,因此被限制在16位有效数字的精度。
和
BLOB文字是包含十六进制数据的字符串文字,前面有一个"x“或"X”字符。例子: X'53514C697465‘
发布于 2020-03-15 05:53:57
INSERT INTO `test` (`id`, `yeild`, `image`, `city`, `info`, `fertilizer`) VALUES
(9, 'Wheat', '0x77686561742e6a7067', 'Bangalore', 'Weather that is comfortable for humans is also good for wheat. Wheat needs 12\r\nto 15 inches (31 to 38 centimetres) of water to produce a', 'My fertilizser');你的十六进制值应该是引号。另外,您只传递5个输入值,但该表有6个字段。
演示
https://stackoverflow.com/questions/60689924
复制相似问题