码迷,mamicode.com
首页 > Web开发 > 详细

pilipili在线视频网站开发日志(一)

时间:2019-12-26 13:03:17      阅读:11752      评论:0      收藏:0      [点我收藏+]

标签:setting   VID   desc   updating   语法   may   解决   引号   href   

 模仿bilibili做了一个pilipili在线视频网站

源码已全部托管至github:https://github.com/BrucessKING/pilipili

我主要负责接口的实现

leader给了我两个接口:UserDao VideoDao

使用的框架为SSM

今天遇到的错误问题:

1 org.apache.ibatis.exceptions.PersistenceException: 
2 ### Error updating database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘desc, releaseDate, clickTimes, pictureUrls, videoUrl, state, user_id, category_i‘ at line 1
3 ### The error may involve defaultParameterMap
4 ### The error occurred while setting parameters
5 ### SQL: insert into p_video(name, desc, releaseDate, clickTimes, pictureUrls, videoUrl, state, user_id, category_id) values(?, ?, ?, ?, ?, ?, ?, ?, ?)
6 ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘desc, releaseDate, clickTimes, pictureUrls, videoUrl, state, user_id, category_i‘ at line 1

明明没有语法错误,可是仍然报错。。。

后来发现,在建表时,居然使用了desc关键字作为列名

解决的方法为:使用反单引号把desc引起来

sql语句如下:

 1 insert into p_video(`name`, `desc`, releaseDate, clickTimes, pictureUrls, videoUrl, state, user_id, category_id) values(#{video.name}, #{video.desc}, #{video.releaseDate}, #{video.clickTimes}, #{video.pictureUrls}, #{video.videoUrl}, #{video.state}, #{user_id}, #{category_id}) 

pilipili在线视频网站开发日志(一)

标签:setting   VID   desc   updating   语法   may   解决   引号   href   

原文地址:https://www.cnblogs.com/ABKing/p/12101233.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有 京ICP备13008772号-2
迷上了代码!