Author |
Topic |
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 02 October 2002 : 12:58:26
|
It seems this error is still popping up, although we have added code to fix it. Also a user pointed a change that takes up less code to fix this problem: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=36032
Basically replacing this bit of code:if strDBType = "mysql" then
fString = Replace(fString, "\0", "\\0")
fString = Replace(fString, "\'", "\\'")
fString = Replace(fString, "\""", "\\""")
fString = Replace(fString, "\b", "\\b")
fString = Replace(fString, "\n", "\\n")
fString = Replace(fString, "\r", "\\r")
fString = Replace(fString, "\t", "\\t")
fString = Replace(fString, "\z", "\\z")
fString = Replace(fString, "\%", "\\%")
fString = Replace(fString, "\_", "\\_")
end if With this:if strDBType = "mysql" then
fString = Replace(fString, "\", "\\")
end if It would catch all the other mysql special characters. This is in the inc_func_common.asp file in the chkString() function. |
Support Snitz Forums
|
|
Reinsnitz
Snitz Forums Admin
USA
3545 Posts |
Posted - 22 November 2002 : 09:39:30
|
it's funny how once we start coding the simple things evade us :) |
Reinsnitz (Mike) |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 17 June 2003 : 20:54:35
|
was there ever a definitive final solution for this? |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 17 June 2003 : 21:48:53
|
the solution was to add this near the end of the function?:
if fField_Type = "message" then
fString = Replace(fString, """", "\""")
end if
I just did and made a test post.
instead of the post coming out like this:
""""""
it came out like this:
\"\"\"\"\"\"
surely that's not what we want to happen... |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 17 June 2003 : 22:50:48
|
I've just done some testing using MySQL as the database and I don't get any SQLBind errors when there are double quotes in the message. Is this problem specific to Unix/Linux environments? |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 17 June 2003 : 23:22:38
|
I haven't been able to reproduce this in a Windows Environment. From the posts that Jake was making, it looks like he was hosted on a Unix/Linux server. Do you know what Davio was using when he was testing this? |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 17 June 2003 : 23:31:54
|
No, the post still looked the same with or without the fix. |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 18 June 2003 : 11:03:07
|
I have gotten the error a few times when testing on mysql with windows. I was using mysql 3.23 during that time (before v4.0 came out). It might be related to Unix only, or some setting that is turned on in these particular hosts, but adding the fix works for those situations. |
Support Snitz Forums
|
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 18 June 2003 : 21:16:36
|
I still haven't been able to reproduce this problem, but am going to make the suggested addition to the chkString function. Just to make sure, the fix is to leave this as is:
if strDBType = "mysql" then
fString = Replace(fString, "\0", "\\0")
fString = Replace(fString, "\'", "\\'")
fString = Replace(fString, "\""", "\\""")
fString = Replace(fString, "\b", "\\b")
fString = Replace(fString, "\n", "\\n")
fString = Replace(fString, "\r", "\\r")
fString = Replace(fString, "\t", "\\t")
fString = Replace(fString, "\z", "\\z")
fString = Replace(fString, "\%", "\\%")
fString = Replace(fString, "\_", "\\_")
end if
and then add the following right near the end of the ChkString function: if fField_Type = "message" and strDBType = "mysql" then
fString = Replace(fString, """", "\""")
end if so it looks like this: if fField_Type = "message" and strDBType = "mysql" then
fString = Replace(fString, """", "\""")
end if
chkString = fString
end function |
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 19 June 2003 : 07:42:27
|
I thought we were replacing that:if strDBType = "mysql" then
fString = Replace(fString, "\0", "\\0")
fString = Replace(fString, "\'", "\\'")
fString = Replace(fString, "\""", "\\""")
fString = Replace(fString, "\b", "\\b")
fString = Replace(fString, "\n", "\\n")
fString = Replace(fString, "\r", "\\r")
fString = Replace(fString, "\t", "\\t")
fString = Replace(fString, "\z", "\\z")
fString = Replace(fString, "\%", "\\%")
fString = Replace(fString, "\_", "\\_")
end if with this:if strDBType = "mysql" then
fString = Replace(fString, "\", "\\")
end if As I posted in my first post?
And you can include the fix for the message field type as you posted in your post. |
Support Snitz Forums
|
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 19 June 2003 : 12:38:09
|
OK, I just wanted to make sure that both changes were necessary. |
|
|
Topic |
|