WDBXEditor icon indicating copy to clipboard operation
WDBXEditor copied to clipboard

SQL import syntax error

Open Xalares opened this issue 4 years ago • 3 comments

INSERT INTO db_Item-sparse_15595 VALUES (75114,1,16,8192,1.0388,1,1,0,0,0,-1,-1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,-1,-1,-1,0,0,0,0,0,-1,-1,-1,-1,-1,4,"Deprecated Malakai\'s Medallion","","","","Upon this iron disk are stamped the words: \"Footman Malakai Stone\"",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);

Double '\' in front of ' " ' make syntax error with MySQL 8.0.27, it works with single \

Xalares avatar Jan 02 '22 18:01 Xalares

Loks like th issue is in Extensions.cs line 137-138

string val = row[i].ToString().Replace(@"'", @"\'").Replace(@"""", @"\\""").Replace(@"\\", @"\\\");
                    sb.Append("\\"" + val + "\\",");

I'll try to sort it out.

Xalares avatar Jan 02 '22 18:01 Xalares

Having this issue as well exporting 1.12.1 DBC to SQL file.

/* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Impact\\" Shot","","","","","","","",8323198,"","","","","","","","",8323196,...' at line 1 */

The actual SQL syntax looks like this: INSERT INTO db_Spell_5875VALUES (3964,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,14,0,0,15,0,0,0,101,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,4377,3575,0,0,0,0,0,0,2,1,0,0,0,0,0,0,-1,0,0,24,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3034,0,0,100,0,0,0,0,0,0,0,0,88,0,1,0,0,"Deprecated BKP \\"Impact\\" Shot","","","","","","","",8323198,"","","","","","","","",8323196,"","","","","","","","",8323196,"","","","","","","","",4128892,0,0,0,0,0,0,0,0,0,0,-1,1,1,1,0,0,0);

Something is wrong about this string conversion that you found but what problem is it trying to solve in the first place? Does it have to do with MariaDB/DBC versions?

henrikssonkevin avatar Jan 07 '22 12:01 henrikssonkevin

I've submitted a patch, the problem that it's trying to solve is to escape the \ character but it does it after escaping the " character. so for the string : Deprecated BKP "Impact" Shot, it will do Deprecated BKP \"Impact\", first to escape " character and then, Deprecated BKP \"Impact\" to escape the \ char that it has added. So the only thing to do is to reverse the regex replacement order. That's what I did.

Xalares avatar Jan 07 '22 12:01 Xalares