SQL error in versions 4.4+ - FIXED

Posted by Andala on Wed 05 Aug 2009 04:29 AM — 13 posts, 46,125 views.

#0
Disclaimer: I'm relatively completely noob-ish when it comes to scripting and whatnot. So forgive my lack of understanding.

After upgrading my mushclient from version 4.37 to version 4.40, one of my worlds("Whyte's Mapper") seems to hang without actually connecting, and presents a series of popups, as follows:

Quote:
SQL error on statement: "SELECT value FROM worlds WHERE name = 'Whyte's Mapper World Position:wp.showCmd'" near "s": syntax error


Quote:
SQL error on statement: "SELECT value FROM worlds WHERE name = 'Whyte's Mapper World Position:wp.flags'" near "s": syntax error


Quote:
SQL error on statement: "SELECT value FROM worlds WHERE name = 'Whyte's Mapper World Position:wp.ptMinPosition.x'" near "s": syntax error


Quote:
SQL error on statement: "SELECT value FROM worlds WHERE name = 'Whyte's Mapper World Position:wp.ptMinPosition.y'" near "s": syntax error


Quote:
SQL error on statement: "SELECT value FROM worlds WHERE name = 'Whyte's Mapper World Position:wp.ptMaxPosition.x'" near "s": syntax error


Quote:
SQL error on statement: "SELECT value FROM worlds WHERE name = 'Whyte's Mapper World Position:wp.ptMaxPosition.y'" near "s": syntax error


Quote:
SQL error on statement: "SELECT value FROM worlds WHERE name = 'Whyte's Mapper World Position:wp.left'" near "s": syntax error


Quote:
SQL error on statement: "SELECT value FROM worlds WHERE name = 'Whyte's Mapper World Position:wp.right'" near "s": syntax error


Quote:
SQL error on statement: "SELECT value FROM worlds WHERE name = 'Whyte's Mapper World Position:wp.bottom'" near "s": syntax error


Quote:
SQL error on statement: "SELECT value FROM worlds WHERE name = 'Whyte's Mapper:Top Height'" near "s": syntax error


Quote:
SQL error on statement: "SELECT value FROM worlds WHERE name = 'Whyte's Mapper:Bottom Height'" near "s": syntax error


It doesn't let me do anything except push OK until I end up at normal screen, as if it were connecting, but it never actually connects. Additionally, my input box doesn't show up. If I try to resize the window, the last two error boxes pop up again.

This doesn't seem to happen with any other world files. Also, if I disconnect it (from trying to connect), and reconnect, everything loads fine, except the input box still doesn't show.

Any thoughts? Am I missing something really obvious? Or what additional information can I give?

ETA: I've tried every version from 4.37-4.42. Everything up to 4.39 works, but beyond that..
Amended on Wed 05 Aug 2009 04:30 AM by Andala
USA #1
Hello,
I've also had this problem. It seems to be a problem with characters that need to have an escape sequence (backslash) placed before them to be successfully added to the database. I've had experience with this through php and MySQL, and in that case, I know you have to use a function like mysql_real_escape_string(), but I'm not sure what the SQLite equivalent would be. Anyway, this isn't your fault, and should be extremely easy to fix. Until then, though... There's not much you can do but not use world with apostrophes or quotes in the name.

Good luck.
#2
It's the ' in "Whyte's".

Maybe back up the file and try editing all these out and see if it works.
Australia Forum Administrator #3
This is in MUSHclient itself when it reads things like the world position from the database. The world name was not having quotes doubled in it.

For now, change the "Whyte's Mapper" name to lose the quote (eg. "Whytes Mapper").

Then save the world file, and try again. Perhaps back it up first just in case.

Fixed in version 4.43.
Australia Forum Administrator #4
In a script, double the quotes, like this:


      -- quotes have to be doubled
      local name = string.gsub (name, "'", "''")

#5
Thanks for the quick response.

Changing the name seems to have eliminated the alert boxes. The input box was still missing for a moment, which freaked me out, but I just had to resize the window until it showed up.

Thank you!
USA #6
The same spam of dialog boxes happens to me, too, except for entirely different reasons: if my thumb drive gets jiggled somehow, it seems to reset something internally, and when I close the client (or do something else that uses the database) it throws lots of dialog box errors before finally closing.
Australia Forum Administrator #7
Perhaps it loses its connection to the database?
Australia Forum Administrator #8
Can you give me one of the error messages please? I might be able to detect that the database was closed, and re-open it.
#9
Could also "fix" the error popups while we're at it? It's rather painful to have to dismiss about 20 separate dialogs.
USA #10
SQL error on statement:
"UPDATE worlds SET value = '3' WHERE name = 'Main window:wp.showCmd"
disc I/O error


Lots and lots of errors after that one, but they're all disc I/O errors.
Australia Forum Administrator #11
I am a bit wary of trying to detect the database being prematurely closed (you may as well do the same thing for log files etc.).

However I acknowledge the dozens of dialog boxes are highly annoying. The method of reporting SQL errors has changed in version 4.43 to have them written to a notepad window instead (since no world file is necessarily open).
Australia Forum Administrator #12
Version 4.43 now closes and re-opens the preferences database when you save your global preferences.

So, if you believe you have jiggled your thumb drive (eg. because you get lots of error messages) you can open up global preferences, and then click OK. That should re-establish the connection to the database.