We am having a problem with the encode() and decode() functions.  When
the second argument to the functions is a quoted string, the functions
return values as expected.  When the second argument to the functions is
another function call, i.e. the char() function, encode() and decode()
return SQL syntax errors.

The System is specs are:
Solaris SunOS sven 5.7 Generic_106541-16 sun4u sparc SUNW,Ultra-5_10, 
MySQL version 3.23.33 

I looked through the bug fix lists of the later versions and could not
find a reference to any problem like this on.  If it has been fixed, in
what version was it fixed?

An example from the MySQL command line is as follows:
select encode("Password","key");
+--------------------------+
| encode("Password","key") |
+--------------------------+
| méLC..É£                 |
+--------------------------+

select decode("Password","key");
+--------------------------+
| decode("Password","key") |
+--------------------------+
| ß}ª  lÉÛ                 |
+--------------------------+

select encode(char(80,97,115,115,119,111,114,100),"key");
+---------------------------------------------------+
| encode(char(80,97,115,115,119,111,114,100),"key") |
+---------------------------------------------------+
| méLC..É£                                          |
+---------------------------------------------------+

select decode(char(80,97,115,115,119,111,114,100),"key");
+---------------------------------------------------+
| decode(char(80,97,115,115,119,111,114,100),"key") |
+---------------------------------------------------+
| ß}ª  lÉÛ                                          |
+---------------------------------------------------+

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

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

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

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


Any assistance in solving or finding a workaround for this problem would
be greatly appreciated.

Ross Rannells
Adjunct Professor, Purdue University
Donnell Systems Senior Systems Analyst


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to