目标库mysql版本:5.6.17
修改前:
INSERT INTO `test_company` (
`url`,
`dir`,
`title`,
`a`,
`b`,
`style`,
`js`,
`c`,
`who`,
`op_time`,
`ver`
)
VALUES
(
'test/company/edit',
'test/company',
'测试',
NULL,
NULL,
'#edit{\n display: none;/*隐藏框*/\n width: 100%;\n height: 100%;\n position: fixed;/*固定定位*/\n overflow: auto;/*不滚动*/\n background-color: rgba(0,0,0,0.7);\n top: 0px;\n left: 0px;\n z-index: 9999;/*图层浮在最上*/\n }\n .close{\n font-size: 40px;\n font-weight: bold;\n position: absolute;\n top: 110px;\n right:30px;\n color:#CAE1FF;\n }\n .close:hover,\n .close:focus{\n color:red;\n cursor:pointer;\n }\n #img{\n display: block;/*以块展示*/\n margin:0px auto;/*居中对齐*/\n margin-top:150px;\n width: 90%;\n max-width: 1600px;/*宽度自适应*/\n }\n \n}',
'$(\"#addr\").attr(\'placeholder\',\'请填写详细地址\');\nvar id = getParam(\'id\');\nvar userno = getParam(\'userno\');\n}',
'0',
'',
NULL,
'4'
);
insert会报syntax error:[Err] 1064 - Erreur de syntaxe près de ''#edit{\n display: none;/*隐藏框*/\n width: 100%' à la ligne 21
用数据库V5.1.73-log测试也报syntax error。把style的值(\n已解析)从表里 copy出来,粘贴保存ok。
最后发现在注释和代码之间'display: none;/*隐藏框*/'
,中间加上空格:'display: none; /*隐藏框*/'
,insert就成功了。其实也没有整行都加一遍,不知什么原理。
修改后:
INSERT INTO `test_company` (
`url`,
`dir`,
`title`,
`a`,
`b`,
`style`,
`js`,
`c`,
`who`,
`op_time`,
`ver`
)
VALUES
(
'test/company/edit',
'test/company',
'测试',
NULL,
NULL,
'#edit{\n display: none; /*隐藏框*/\n width: 100%;\n height: 100%;\n position: fixed; /*固定定位*/\n overflow: auto; /*不滚动*/\n background-color: rgba(0,0,0,0.7);\n top: 0px;\n left: 0px;\n z-index: 9999; /*图层浮在最上*/\n }\n .close{\n font-size: 40px;\n font-weight: bold;\n position: absolute;\n top: 110px;\n right:30px;\n color:#CAE1FF;\n }\n .close:hover,\n .close:focus{\n color:red;\n cursor:pointer;\n }\n #img{\n display: block; /*以块展示*/\n margin:0px auto; /*居中对齐*/\n margin-top:150px;\n width: 90%;\n max-width: 1600px;/*宽度自适应*/\n }\n',
'$(\"#addr\").attr(\'placeholder\',\'请填写详细地址\');\nvar id = getParam(\'id\');\nvar userno = getParam(\'userno\');\n}',
'0',
'',
NULL,
'4'
);