我在nodejs中有以下代码。我正在使用npm的mysql库,并且我知道mysql数据库中的所有列都是正确的,但是我不断收到以下错误:“'field list'中的未知列's3_id'”,但是当我从custom_videos中选择s3_id时,我得到了返回的行。我怎么会有一个未知的列存在?
router.post("/submitCustomVideo", async (req, res, next) => {
try {
const data = {};
const {
s3Id,
name,
renderTime,
duration,
description,
selectedCategories,
selectedKeywords,
customFields
} = req.body;
const VALUES = {
s3_id: s3Id,
name,
duration,
description,
render_time: renderTime,
custom_fields: customFields
};
const updateCustomVideoInfoResult = await database.query(
"call updateCustomVideoInfo(?)",
[VALUES]
);
} catch (error) {
console.log(error);
next(error);
}
});
这是我的存储过程
CREATE DEFINER=`mystuff`@`%` PROCEDURE `updateCustomVideoInfo`(s3_id_param varchar(255), name_param varchar(255), duration_param int, description_param varchar(255), render_time_param int, custom_fields_param json)
BEGIN
UPDATE custom_videos SET name = name_param, duration = duration_param, description = description_param, render_time = render_time_param, custom_fields = custom_fields_param WHERE s3_id = s3_id_param;
END
答案 0 :(得分:0)
尝试将列设置为字符串,并检查列的数据类型。