From: Thimble Smith
Date: November 22 2000 4:25pm
Subject: Re: Escape characters in type CHAR fields - problem?
List-Archive: http://lists.mysql.com/internals/144
Message-Id: <20001122112539.B723@threads.polyesthetic.msg>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
On Wed, Nov 22, 2000 at 03:18:56PM -0000, Jez Tucker wrote:
> I'm not sure if this is the right list to post to (it's my first mysql list
> post) so please bear with me if I'm in the wrong place.
Actually, this should go to mysql@stripped. It doesn't
have anything to do with the internal code of MySQL (unless, of
course, you were asking how to add in a new escape code to the
string literal syntax that MySQL supports).
> I've been reading the manuals regarding the inclusion of escape characters
> in CHAR fields.
>
> E.G. INSERT INTO
VALUES('hello\\nhow are you?');
>
> Am I right in thinking that one cannot, at present, insert an escape
> character (notice not escaped character) into the field?
No, it's so simple that you don't realize it. Just insert the
actual value from your host language.
mysql> select 'foo ^[ bar';
+-----------+
| foo bar |
+-----------+
| foo bar |
+-----------+
1 row in set (0.00 sec)
mysql> select length('foo ^[ bar');
+---------------------+
| length('foo bar') |
+---------------------+
| 9 |
+---------------------+
1 row in set (0.00 sec)
Note: I had to type ^V^[ to get the real escape character in
the 'mysql' monitor. But in your real program, you won't have
to. Maybe in your editor you will, though!
Tim
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Tim Smith
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Development Team
/_/ /_/\_, /___/\___\_\___/ Boone, NC USA
<___/ www.mysql.com