gpt4 book ai didi

mysql - {Mysql2::Error} 使用 mysql2 时,列计数与第 1 行的值计数不匹配

转载 作者:行者123 更新时间:2023-11-29 11:47:53 26 4
gpt4 key购买 nike

这是我的full sql ,我尝试以下代码并提出 使用 mysql2 时列数与第 1 行的值计数不匹配

conf = {adapter: "mysql2", host: "localhost", username: "root", password: "root", database: 'ro_article_prod', port: 3306, encoding: 'utf8mb4', flags: (Mysql2::Client::FOUND_ROWS | Mysql2::Client::MULTI_STATEMENTS), encoding: 'utf8', checkout_timeout: 1.day, connect_timeout: 1.hour, reconnect: true, pool: 2000}
m = Mysql2::Client.new(conf)
m.query(RoFile.read("chk/val.sql"));
m.abandon_results!

但是当我在 mysql shell 中运行以下代码时,它可以工作并且不会引发任何错误

insert articles (title, url, ctn, ctn_md5, created_at, updated_at) values("Amy (Character)  - Quotes", "http:/www.imdb.com/character/ch0052152/quotes", "", "", "2016-01-05 07:12:55", "2016-01-05 07:12:55");
insert articles (title, url, ctn, ctn_md5, created_at, updated_at) values("Amy (Character)", "http:/www.imdb.com/character/ch0052152/maindetails", "", "", "2016-01-05 07:12:55", "2016-01-05 07:12:55");
insert articles (title, url, ctn, ctn_md5, created_at, updated_at) values("Amy (Character) - Filmography by type", "http:/www.imdb.com/character/ch0052152/filmotype", "", "", "2016-01-05 07:12:55", "2016-01-05 07:12:55");

最佳答案

在您链接到的完整 SQL 中,所有行都有六列,但其中一列有五个值。错误的是:

insert articles (title, url, ctn, ctn_md5, created_at, updated_at) values("Trudy Chelgren (Character)  - Filmography by rating", "http:/www.imdb.com/character/ch0052168/filmorate", "", "2016-01-05 07:12:55", "2016-01-05 07:12:55");

关于mysql - {Mysql2::Error} 使用 mysql2 时,列计数与第 1 行的值计数不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34604265/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com