我正在尝试通过mariadb驱动程序使用typeorm保存数据。但是我得到了这个错误:
error: Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' 'In 1972, a popular student in Yomiyama North Middle School\'s class 3-3 named ' at line 1
at Packet.asError (D:\kiramanga_fetch\node_modules\mysql2\lib\packets\packet.js:722:17)
at Query.execute (D:\kiramanga_fetch\node_modules\mysql2\lib\commands\command.js:28:26)
at PoolConnection.handlePacket (D:\kiramanga_fetch\node_modules\mysql2\lib\connection.js:456:32)
at PacketParser.onPacket (D:\kiramanga_fetch\node_modules\mysql2\lib\connection.js:85:12)
at PacketParser.executeStart (D:\kiramanga_fetch\node_modules\mysql2\lib\packet_parser.js:75:16)
at Socket.<anonymous> (D:\kiramanga_fetch\node_modules\mysql2\lib\connection.js:92:25)
at Socket.emit (events.js:375:28)
at addChunk (internal/streams/readable.js:290:12)
at readableAddChunk (internal/streams/readable.js:265:9)
at Socket.Readable.push (internal/streams/readable.js:204:10) {
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlState: '42000',
sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use
near ' 'In 1972, a popular student in Yomiyama North Middle School\\'s class 3-3 named ' at line 1",
sql: 'INSERT INTO `Anime`(`id`, `anf_id`, `original`, `title`, `en_title`, `synonyms`, `synopsis`, `background`, `related`, `featured`, `url`, `show_type`, `status`, `source`, `episodes`, `songs`, `trailer`, `airing`, `airing_now`, `duration`, `rating`, `rate`, `update_time`, `seasonId`) VALUES (DEFAULT, \'11111\', \'アナザー\', \'Another\', \'Another\', , \'In 1972, a popular student in Yomiyama North Middle School\\\'s class 3-3 named Misaki passed away during the school year. Since then, the town of Yomiyama has been shrouded by a fearful atmosphere, from the dark secrets
hidden deep within. Twenty-six years later, 15-year-old Kouichi Sakakibara transfers into class 3-3 of Yomiyama North and soon after discovers that a strange, gloomy mood seems to hang over all the students. He also finds himself drawn to the mysterious, eyepatch-wearing student Mei Misaki;
however, the rest of the class and the teachers seem to treat her like she doesn\\\'t exist. Paying no heed to warnings from everyone including Mei herself, Kouichi begins to get closer not only to her, but also to the truth behind the gruesome phenomenon plaguing class 3-3 of Yomiyama North. Another follows Kouichi, Mei, and their classmates as they are pulled into the enigma surrounding a series of inevitable, tragic events—but unraveling the horror of Yomiyama may just cost them the ultimate price. [Written by MAL Rewrite]\', \'In 1972, a popular student in Yomiyama North Middle School\\\'s class 3-3 named Misaki passed away during the school year. Since then, the town of Yomiyama has been shrouded by a fearful atmosphere, from the dark secrets hidden deep within.Twenty-six years later, 15-year-old Kouichi Sakakibara transfers into class 3-3 of Yomiyama North and soon after discovers that a strange, gloomy mood seems to hang over all the students. He also finds himself drawn to the mysterious, eyepatch-wearing student Mei Misaki; however, the rest of the class and the teachers seem to treat her like she doesn\\\'t exist. Paying no heed to warnings from everyone including Mei herself, Kouichi begins to get closer not only to her, but also to the truth behind the gruesome phenomenon plaguing
class 3-3 of Yomiyama North.Another follows Kouichi, Mei, and their classmates as they are pulled into the enigma surrounding a series of inevitable, tragic events—but unraveling the horror of Yomiyama may just cost them the ultimate price.[Written by MAL Rewrite]Pre-screening on 26 December 2011. The regular TV airing started on 09 January 2012.\', \'{\\"prequel\\":[{\\"anf_id\\":11701,\\"title\\":\\"Another: The Other - Inga\\",\\"url\\":\\"/anime/11701/another-the-other-inga\\"}],\\"adaptation\\":[{\\"anf_id\\":29699,\\"title\\":\\"Another\\",\\"url\\":\\"/manga/29699/another\\"}],\\"other\\":[{\\"anf_id\\":20365,\\"title\\":\\"Another: Misaki Mei - Shizukani\\",\\"url\\":\\"/anime/20365/another-misaki-mei-shizukani\\"}]}\', \'https://ik.imagekit.io/feedani/another\', \'/anime/11111/another\', \'TV\', \'Finished Airing\', \'Light novel\', 12, \'{\\"opening\\":[\\"\\\\\\"Kyoumu Densen (凶夢伝染)\\\\\\" by ALI PROJECT\\"],\\"ending\\":[\\"\\\\\\"anamnesis\\\\\\" by Annabel\\"]}\', \'https://www.youtube.com/embed/UGoAl3L13bc?enablejsapi=1&wmode=opaque&autoplay=1\', \'{\\"from\\":\\"2012-01-10T00:00:00+00:00\\",\\"to\\":\\"2012-03-27T00:00:00+00:00\\",\\"details\\":{\\"from\\":{\\"day\\":10,\\"month\\":1,\\"year\\":2012},\\"to\\":{\\"day\\":27,\\"month\\":3,\\"year\\":2012}},\\"data\\":\\"Jan 10, 2012 to Mar 27, 2012\\"}\', false, \'24 min per ep\', \'R - 17+ (violence & profanity)\', 7.51, 1631599252606, 2)'
}但我不知道出了什么问题,所以我在这里问。谢谢。如果需要,我会提供其他信息。
发布于 2021-09-07 08:12:03
我太愚蠢了,我忘了把数组转换成字符串,所以查询搞砸了。如果有人有类似问题,我建议在插入之前检查数据,如果有任何数据是数组,请确保将其转换为字符串。
https://stackoverflow.com/questions/69083091
复制相似问题