Problem with Encode and Decode Functions
am 15.10.2002 19:21:09 von Ross Rannells--Boundary_(ID_VzDz6dzUtHHmLIfLhWhgTg)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: quoted-printable
I am having problem with the encode and decode functions in MySQL. When
the second argument is a call to the char function, they return an
error, yet they work fine when a string is the second argument. I am
using MySQL version 3.23.33 on Solaris 5.7.
=20
An example of the problem from MySQL command line interface follows:
=20
select encode("Password","key");
+--------------------------+
| encode("Password","key") |
+--------------------------+
| m=E9LC..É£ |
+--------------------------+
=20
select decode("Password","key");
+--------------------------+
| decode("Password","key") |
+--------------------------+
| ß}=AA lÉÛ |
+--------------------------+
=20
select encode(char(80,97,115,115,119,111,114,100),"key");
+---------------------------------------------------+
| encode(char(80,97,115,115,119,111,114,100),"key") |
+---------------------------------------------------+
| m=E9LC..É£ |
+---------------------------------------------------+
=20
=20
select decode(char(80,97,115,115,119,111,114,100),"key");
+---------------------------------------------------+
| decode(char(80,97,115,115,119,111,114,100),"key") |
+---------------------------------------------------+
| ß}=AA lÉÛ |
+---------------------------------------------------+
=20
select encode("Password",char(107,101,121));
ERROR 1064: You have an error in your SQL syntax near
'char(107,101,121))' at line 1
=20
select decode("Password",char(107,101,121));
ERROR 1064: You have an error in your SQL syntax near
'char(107,101,121))' at line 1
=20
select encode(char(80,97,115,115,119,111,114,100),char(107,101,121) );
ERROR 1064: You have an error in your SQL syntax near
'char(107,101,121))' at line 1
=20
select decode(char(80,97,115,115,119,111,114,100),char(107,101,121) );
ERROR 1064: You have an error in your SQL syntax near
'char(107,101,121))' at line 1
=20
Ross Rannells
Senior Software Developer
Donnell Systems
(574) 232-3784, ext 213
=20
=20
How-To-Repeat:
select encode("Password","key");
select decode("Password","key");
select encode(char(80,97,115,115,119,111,114,100),"key");
select decode(char(80,97,115,115,119,111,114,100),"key");
select encode("Password",char(107,101,121));
select decode("Password",char(107,101,121));
select encode(char(80,97,115,115,119,111,114,100),char(107,101,121) );
select decode(char(80,97,115,115,119,111,114,100),char(107,101,121) );
=20
--Boundary_(ID_VzDz6dzUtHHmLIfLhWhgTg)--