Uninote
Uninote
用户根目录
每日点滴

<!DOCTYPE html> <html><head><meta http-equiv='Content-Type' content='text/html; charset=utf8'><title>db differ</title> <script> var g_resRoot = '../../__res/'; var g_json_outline = '{"children":[{"children":[],"level":1,"lvNumber":"1","text":"note"},{"children":[],"level":1,"lvNumber":"2","text":"db differ todo"},{"children":[],"level":1,"lvNumber":"3","text":"直接数据转换"},{"children":[],"level":1,"lvNumber":"4","text":"直接比较记录"}],"level":0,"lvNumber":"","text":"db differ"}'; </script> <link rel='stylesheet' type='text/css' href='../../__res/common.css'><style>.s0{color:#000000;} .s1{color:#000000;} .s2{color:#000000;} .s3{color:#000000;} .s4{color:#0000ff;} .s5{color:#0000ff;} </style> </head><body> <script src='../../__res/util.js'></script><div id='outline'> <li><a href='#ol_0' style='font-weight:bold; font-size:22px'>db differ</a></li> <li> <a href='#ol_1' >note</a></li> <li> <a href='#ol_2' >db differ todo</a></li> <li> <a href='#ol_3' >直接数据转换</a></li> <li> <a href='#ol_4' >直接比较记录</a></li> </div>

<pre id='ol_0' class='title'>db differ</pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>代码仓库:</d><d class='s1'>git@47.97.186.229:cyb/misc.git</d><d class='s0'></d></pre> <pre><d class='s0'>E:\projects\misc\dbdiffer</d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'><a href='http://a.misc.my/dbdiffer/index.php'>http://a.misc.my/dbdiffer/index.php</a></d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'><a href='..\js/js_tp.html#6a4b0f4c-d589-4cb6-a27e-311c2c30021c'>mergely -- diff files online </a></d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>- 生成当前dump:</d></pre> <pre><d class='s0'>mysqldump --skip-extended-i</d><d class='s2'>nsert --skip-dump-date -uroot -proot -P3333 p2p21_piaojuke_czbank > tmp1.sql</d></pre> <pre><d class='s2'>- 执行某些操作之后再dump:</d></pre> <pre><d class='s0'>mysqldump --skip-extended-i</d><d class='s2'>nsert --skip-dump-date -uroot -proot -P3333 p2p21_piaojuke_czbank > tmp2.sql</d></pre> <pre><d class='s2'></d></pre> <pre><d class='s2'>- 进入differ界面,列出所有dump目录下的文件</d></pre> <pre><d class='s2'>- 选择两个文件a、b,通过diff(git自带的工具)命令生成diff文件:</d></pre> <pre><d class='s2'><img src='..\pic\c71724bcd985115674bfc03e05d87456.jpg' /></d><d class='s0'></d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>- 分析diff文件a、b,生成两个待比较的文件,</d></pre> <pre><d class='s0'> * 分析出表名name,再调用desc name 得到表头字段。</d></pre> <pre><d class='s0'> * 综合表头&数据,并转置</d></pre> <pre><d class='s0'> * 文件名规则:a-b-a,a-b-b,存入out目录。如果文件已经存在,则询问是否覆盖。</d></pre> <pre><d class='s0'>比如,比较03,04,最终生成的文件比较结果:</d></pre> <pre><d class='s0'><img src='..\pic\23009989268ff73fb88bf5eade54cd6f.jpg' /></d><d class='s0'></d></pre> <pre><d class='s0'></d></pre> <h1 id='ol_1'>note</h1> <pre><d class='s3'>需要eval,不能简单批分:</d></pre> <pre><d class='s3'>'4028218166dcfcf40166de4b283f000e','支付成功','【票据客】尊敬的15310405001:您投资的银票宝2375期,金额3000元,订单已支付成功。','2018-11-04 18:35:59','15310405001','-1100|服务器端序列号错误,序列号不存在内存中,或尝试攻击的用户','2018-11-04 18:36:00',2,'{"orderAmount":"3000","payAmount":"3000.00","phone":"15310405001","realNm":"秦尉寒","realCd":"ogjHRqk5","triggerNode":"order.pay.success","productName":"银票宝2375期"}','order.pay.success','21','system','2018-11-04 18:35:59',1,0,'system','2018-11-04 18:35:59'</d></pre> <pre><d class='s3'>-- 使用eval进行处理最简单,不用语法分析。</d></pre> <pre><d class='s3'></d></pre> <pre><d class='s3'>web diff插件</d></pre> <pre><d class='s3'></d></pre> <pre><d class='s3'>diff命令需要在path中。</d></pre> <pre><d class='s3'></d></pre> <pre><d class='s3'>local_web.php进行配置</d></pre> <pre><d class='s0'></d></pre> <t id='c6728bc5-e136-40a4-bdee-9da947fbb903'> <pre class='tnd_head'>lv1= lv2= type=todo</pre> <h1 id='ol_2'>db differ todo</h1> <pre><d class='s2'>1 做成service,上传两个dump文件,再上传数据库schema或者链接配置,就能显示差异。</d></pre> <pre><d class='s2'>2 如果上传了mysql链接配置,其实可以用户手动dump的,这样不用上传dump文件了。</d></pre> <pre><d class='s2'>3 上传字段注释文件,作为字段的解释?</d></pre> <pre><d class='s2'></d></pre> <pre><d class='s2'>SELECT table_name, COLUMN_NAME, COLUMN_COMMENT FROM INFORMATION_SCHEMA.Columns WHERE </d></pre> <pre><d class='s2'>table_schema='p2p21_piaojuke_czbank' </d></pre> <pre><d class='s2'></d></pre> <pre><d class='s2'>mysql_cache.txt</d></pre> <pre><d class='s2'></d></pre> <pre><d class='s2'>如果没有缓存文件,仍旧链接数据库获取;</d></pre> <pre><d class='s4'></d></pre> <pre><d class='s2'>支持上传dump、cache文件</d></pre> <pre><d class='s4'></d></pre> <pre><d class='s2'>支持 输入记录</d></pre> <pre><d class='s4'></d></pre> </t> <pre><d class='s5'></d></pre> <pre><d class='s4'></d></pre> <t id='06038d61-3f51-4b8b-86c4-5caef448aab3'> <pre class='tnd_head'>lv1= lv2= type=todo</pre> <h1 id='ol_3'>直接数据转换</h1> <pre><d class='s2'>用于直接查看insert的插入数据详情,在主页面上加此功能:</d><d class='s4'></d></pre> <pre><d class='s4'><img src='..\pic\53e486571893de599f6ca953135b71da.jpg' /></d><d class='s4'></d></pre> <pre><d class='s0'>INSERT INTO product_order VALUES ('4028218166dcfcf40166de4b27eb000c','system','2018-11-04 18:35:59',0,3000.00,14.50,NULL,14.50,NULL,'PP1810121746916',0,'J181104183559334817','20181104','J181104183559334817','PJK2018110418355900011','PP1810121746916','2018-11-04 18:35:59',1,NULL,'4028218166da2a890166da2b6b9500a4',3000,1,'PP1810121746916',1.00000000,1,'ff80808162272ed1016227340b250002',0,'system','2018-11-04 18:35:59',0,'支付成功',1,'6210193310200514239','秦尉寒',NULL,0.0600,NULL);</d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>每一条insert语句,直接做如下转换:</d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>--- table product_order----</d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>orderId : '4028218166dcfcf40166de4b27eb000c'</d></pre> <pre><d class='s0'>createBy : 'system'</d></pre> <pre><d class='s0'>createTime : '2018-11-04 18:35:59'</d></pre> <pre><d class='s0'>version : 0</d></pre> <pre><d class='s0'>amount : 3000.00</d></pre> <pre><d class='s0'>anticipatedIncome : 14.50</d></pre> <pre><d class='s0'>createDate : NULL</d></pre> <pre><d class='s0'>expectedIncome : 14.50</d></pre> <pre><d class='s0'>freezeStatus : NULL</d></pre> <pre><d class='s0'>freezeTrxId : 'PP1810121746916'</d></pre> <pre><d class='s0'>investWay : 0</d></pre> <pre><d class='s0'>orderCd : 'J181104183559334817'</d></pre> <pre><d class='s0'>orderDate : '20181104'</d></pre> <pre><d class='s0'>orderNo : 'J181104183559334817'</d></pre> <pre><d class='s0'>outsideOrderNo : 'PJK2018110418355900011'</d></pre> <pre><d class='s0'>outsideSerialNo : 'PP1810121746916'</d></pre> <pre><d class='s0'>payEndDate : '2018-11-04 18:35:59'</d></pre> <pre><d class='s0'>payStatus : 1</d></pre> <pre><d class='s0'>payUrl : NULL</d></pre> <pre><d class='s0'>productId : '4028218166da2a890166da2b6b9500a4'</d></pre> <pre><d class='s0'>quantity : 3000</d></pre> <pre><d class='s0'>status : 1</d></pre> <pre><d class='s0'>trxId : 'PP1810121746916'</d></pre> <pre><d class='s0'>unitprice : 1.00000000</d></pre> <pre><d class='s0'>verifyStatus : 1</d></pre> <pre><d class='s0'>memberId : 'ff80808162272ed1016227340b250002'</d></pre> <pre><d class='s0'>deleted : 0</d></pre> <pre><d class='s0'>updateBy : 'system'</d></pre> <pre><d class='s0'>updateTime : '2018-11-04 18:35:59'</d></pre> <pre><d class='s0'>operationSrc : 0</d></pre> <pre><d class='s0'>resultStr : '支付成功'</d></pre> <pre><d class='s0'>stageFlag : 1</d></pre> <pre><d class='s0'>tradeBankCard : '6210193310200514239'</d></pre> <pre><d class='s0'>tradeRealNm : '秦尉寒'</d></pre> <pre><d class='s0'>couponAmount : NULL</d></pre> <pre><d class='s0'>rate : 0.0600</d></pre> <pre><d class='s0'>couponOutsideOrderNo : NULL</d></pre> </t> <pre><d class='s0'></d></pre> <t id='ccff7150-b63b-4a40-bbe5-d3a0caf88e89'> <pre class='tnd_head'>lv1= lv2= type=todo</pre> <h1 id='ol_4'>直接比较记录</h1> <pre><d class='s0'>在<a href='dbdiffer.html#06038d61-3f51-4b8b-86c4-5caef448aab3'>直接数据转换 </a>的基础上,选择比较,如果有两条以上的记录,则直接展开、比较(在比较页面)前两条记录。</d><d class='s4'></d></pre> </t> </d></pre> </body></html>

config_my

fiddler

点赞(0) 阅读(70) 举报
目录
标题