Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Bug Reports (Closed)
 BUG: "SQLBind parameter" error with mysql
 Forum Locked  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 02 October 2002 :  12:58:26  Show Profile
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  Show Profile  Visit Reinsnitz's Homepage  Send Reinsnitz an AOL message  Send Reinsnitz an ICQ Message  Send Reinsnitz a Yahoo! Message
it's funny how once we start coding the simple things evade us :)

Reinsnitz (Mike)
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 June 2003 :  20:54:35  Show Profile
was there ever a definitive final solution for this?
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 17 June 2003 :  21:00:22  Show Profile
See here Richard: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=42985&whichpage=2#229769

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 June 2003 :  21:48:53  Show Profile
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...
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 17 June 2003 :  22:14:47  Show Profile
I'd say you need to have an "if strDBType = "mysql" then before that statement.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 June 2003 :  22:50:48  Show Profile
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?
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 17 June 2003 :  23:04:23  Show Profile
The error occurred when there were question marks as well as double quotes in the message.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 June 2003 :  23:22:38  Show Profile
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?
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 17 June 2003 :  23:30:08  Show Profile
nope, sorry, I don't know. Maybe better wait for Davio's take on this.

Did using that fix just for MySql produce funny results?

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 June 2003 :  23:31:54  Show Profile
No, the post still looked the same with or without the fix.
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 17 June 2003 :  23:34:28  Show Profile
Well, if it's a problem only with *nix servers, then it wouldn't hurt to put it in, yes? But better confirm that it is indeed a problem.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 18 June 2003 :  11:03:07  Show Profile
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
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 18 June 2003 :  21:16:36  Show Profile
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
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 19 June 2003 :  07:42:27  Show Profile
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
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 19 June 2003 :  12:38:09  Show Profile
OK, I just wanted to make sure that both changes were necessary.
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 Forum Locked  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.24 seconds. Powered By: Snitz Forums 2000 Version 3.4.07