This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I've just tried adding an entity to our database which
has an apostrophe in the content and I receive an error from MySQL
indicating that the apostrophe has not been escaped. Pretty-much all
other content containing apostrophes gets added correctly so I think it
may be a result of one of the less common apostrophe characters (e.g.
the curly ones that Microsoft insist on using if you author text in MS Word).
I'm using MySQL5. Here's is the exception: MySql.Data.MySqlClient.MySqlException:
You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near
'Akiapola'au was previously widespread on the island but is now
patchily distribu' at line 45 and here is the (simplified) logged SQL statement: INSERT INTO `TextItem` Am I right in thinking this is something that LightSpeed should handle or do I need to handle apostrophes in my application code? Thanks, Chris |
|
|
LightSpeed should handle this if MySQL does. We send all values in parameters, so escaping shouldn't be an issue: therefore it's possible this is an issue in MySQL (whether in the database or the driver). Could you try inserting the same text into the same database using a parameterised query in raw ADO.NET? If it fails, then I think it must be a MySQL issue (and may be bound up with some sort of locale issue, possibly different ideas about locales between the client and the server?). If it succeeds then it's a LightSpeed issue, in which case please send us the exact text or the Unicode value of the character that's causing the problem and we'll take a look. |
|
|
Just belatedly following this up in case any one else comes across a similar problem. A bug in some newer versions of the MySQL .NET client did lead me astray but the version bundled with LightSpeed 2.2 works fine as long as you add "CharSet=utf8" into the connection string. |
|