火车头采集器使用‘导入数据库’形式发布数据到帝国CMS数据库的过程(原创)适用于ECMS7.2

网上有不少相关的信息,有部分文章已经相当不错了,但是还是并不能正确的写入记录,或者说只能兼容比较老的版本(具体是之前哪个版本,还并不知晓)(本文描述的内容,是可以适用于EmpireCMS7.2的),比如有一种说法,只需要修改:phome_ecms_news(一次insert,一次update),phome_ecms_news_data_1(一次insert)两张表,现实是如果只操作这两张表,一般都会出现如下的错误:

而且在删除数据的时候,一样会报一些数据库方面的错误。这种情况下唯一的办法就是查看清楚,每一条新录入的数据,在录入过程中,到底对数据库操作了什么?

打开SQL语句日志功能,可以查看在执行添加一条新信息的时候,数据库到底做了哪些操作,

SET GLOBAL log_output = 'TABLE';SET GLOBAL general_log = 'ON';(记得之后要关闭,不然会产生太多不必要的日志文件)

执行完成后,发现新增记录过程中,所有执行过的SQL语句如下:

mysql> SELECT * from mysql.general_log ORDER BY event_time DESC;
+----------------------------+------------------------------+-----------+-----------+--------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| event_time | user_host | thread_id | server_id | command_type | argument |
+----------------------------+------------------------------+-----------+-----------+--------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 2018-10-11 13:45:14.338256 | root[root] @ localhost [::1] | 1344 | 1 | Query | SET GLOBAL general_log = 'OFF' |
| 2018-10-11 13:45:09.951519 | root[root] @ localhost [::1] | 1653 | 1 | Quit | |
| 2018-10-11 13:45:09.949531 | root[root] @ localhost [::1] | 1653 | 1 | Query | select andauth from phome_enewsuserloginck where userid='1' |
| 2018-10-11 13:45:09.948513 | root[root] @ localhost [::1] | 1653 | 1 | Query | select userid,groupid,classid,userprikey,uprnd from phome_enewsuser where userid='1' and username='admin' and rnd='og7Q9XlQgP4v7l4Aq1mQ' and checked=0 limit 1 |
| 2018-10-11 13:45:09.947509 | root[root] @ localhost [::1] | 1653 | 1 | Init DB | empirecms |
| 2018-10-11 13:45:09.946506 | root[root] @ localhost [::1] | 1653 | 1 | Query | SET character_set_connection=utf8,character_set_results=utf8,character_set_client=binary,sql_mode='' |
| 2018-10-11 13:45:09.945504 | [root] @ localhost [::1] | 1653 | 1 | Connect | root@localhost on using TCP/IP |
| 2018-10-11 13:45:09.888351 | root[root] @ localhost [::1] | 1652 | 1 | Quit | |
| 2018-10-11 13:45:09.886346 | root[root] @ localhost [::1] | 1652 | 1 | Query | select sitename from phome_enewsbefrom |
| 2018-10-11 13:45:09.885342 | root[root] @ localhost [::1] | 1652 | 1 | Query | select writer from phome_enewswriter |
| 2018-10-11 13:45:09.884339 | root[root] @ localhost [::1] | 1652 | 1 | Query | select firsttitlename,isgoodname from phome_enewspublic limit 1 |
| 2018-10-11 13:45:09.883337 | root[root] @ localhost [::1] | 1652 | 1 | Query | select typeid,tname from phome_enewsinfotype where mid='1' order by myorder |
| 2018-10-11 13:45:09.883337 | root[root] @ localhost [::1] | 1652 | 1 | Query | select tempid,tempname from phome_enewsnewstemp order by modid,tempid |
| 2018-10-11 13:45:09.883337 | root[root] @ localhost [::1] | 1652 | 1 | Query | select tempid,tempname from phome_enewsvotetemp order by tempid |
| 2018-10-11 13:45:09.882334 | root[root] @ localhost [::1] | 1652 | 1 | Query | select definfovoteid from phome_enewsclass where classid='2' |
| 2018-10-11 13:45:09.882334 | root[root] @ localhost [::1] | 1652 | 1 | Query | select ttids from phome_enewsclassadd where classid='2' |
| 2018-10-11 13:45:09.880329 | root[root] @ localhost [::1] | 1652 | 1 | Query | select groupid,adminclass from phome_enewsuser where userid='1' limit 1 |
| 2018-10-11 13:45:09.880329 | root[root] @ localhost [::1] | 1652 | 1 | Query | select doall,doselfinfo,doaddinfo,doeditinfo,dodelinfo,docheckinfo,dogoodinfo,dodocinfo,domoveinfo,domustcheck,docheckedit from phome_enewsgrou

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值