[英]mysql- Mysql2::Error: Data too long for column 'description' at row 1
I built a scraper and it doesn't seem to like my description length. 我制作了一个刮板,它似乎不喜欢我的描述长度。 I altered the column to varchar(500) but no dice.
我将列更改为varchar(500),但没有骰子。 I think I need to convert to text, but I am not sure how to.
我想我需要转换为文本,但是我不确定该怎么做。 Does that make sense in my case?
就我而言,这有意义吗? Thanks!
谢谢!
Error- 错误-
Mysql2::Error: Data too long for column 'description' at row 1: INSERT INTO
sammiches
(country
,created_at
,description
,image
,name
,updated_at
) VALUES ('Italy', '2013-05-03 01:10:08', 'In Italy, panino is the word for a sandwich made from bread other than sliced bread, in which case Italians call it a tramezzino or porco. Examples of bread types used are ciabatta, rosetta and baguette. The bread is cut horizontally and filled with deli ingredients such as salami, ham, cheese, mortadella, or other food, and sometimes served warm after having been pressed by a warming grill. In the United States, United Kingdom and Canada, the term panini has been adopted to refer to a pressed and toasted sandwich; there is widespread availability and use of sandwich presses, often known as \\"panini presses\\" or \\"toasted sandwich makers.\\"', '/wiki/File:Italian_Sandwich.jpeg', 'Panini', '2013-05-03 01:10:08') (ActiveRecord::StatementInvalid)Mysql2 :: Error:数据太长,无法在第1行的列'description'插入到
sammiches
(country
,created_at
,description
,image
,name
,updated_at
)VALUES('Italy','2013-05-03 01:10:08 ','在意大利,panino是指用除切片面包以外的面包制成的三明治的三明治,在这种情况下,意大利人称其为tramezzino或porco。使用的面包类型包括恰巴塔面包,罗塞塔面包和法式长棍面包。在其中充满了熟食成分,例如萨拉米香肠,火腿,奶酪,熟香肠或其他食物,有时在被加热的烤架压过后可以加热。在美国,英国和加拿大,“ panini”一词是指压制和烤制的三明治;三明治压制机(通常称为“帕尼尼压制机”或“烤制三明治机”)得到广泛使用和使用。','/wiki/File:Italian_Sandwich.jpeg','Panini' ,'2013-05-03 01:10:08')(ActiveRecord :: StatementInvalid)
Your length is about 650 characters now. 您的长度现在约为650个字符。 Try to increase more.
尝试增加更多。
the type VARCHAR() just can go up to 255 characters. 类型VARCHAR()最多可以包含255个字符。 Try TEXT instead.
请尝试使用TEXT。
http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html
-- if a table restrict you to insert data becasue the length is smaller and -- you realy want to get rid of the restriction -- do this -如果表限制您插入数据,因为它的长度较小,并且-您确实想摆脱限制-请执行此操作
show global variables like '%sql%mode'; 显示全局变量,例如'%sql%mode'; set global sql_mode='NO_ENGINE_SUBSTITUTION';
设置全局sql_mode ='NO_ENGINE_SUBSTITUTION'; -- also set it here -- /etc/my.cnf -- http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html
-也在此处设置-/etc/my.cnf- http ://dev.mysql.com/doc/refman/5.6/zh-CN/sql-mode.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.