Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL import syntax error #112

Open
Xalares opened this issue Jan 2, 2022 · 3 comments
Open

SQL import syntax error #112

Xalares opened this issue Jan 2, 2022 · 3 comments

Comments

@Xalares
Copy link

Xalares commented Jan 2, 2022

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
Copy link
Author

Xalares commented Jan 2, 2022

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.

@henrikssonkevin
Copy link

henrikssonkevin commented Jan 7, 2022

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?

@Xalares
Copy link
Author

Xalares commented Jan 7, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants