Re: [NEWBIE] Escaping (') from strings

From: Artovil (artovil@arcanerealms.org)
Date: 09/02/01


At 16:04 2001-09-01 -0500, Mike Stilson wrote:
>----- Original Message -----
>From: "Artovil" <artovil@ARCANEREALMS.ORG>
>
>
> > Can anyone please help me out a little?  I am currently putting in MySQL
> > into my mud, and everything works just fine for the loads, since all my
> > data is correctly put into the tables and everything, but when I save down
> > stuff the queries fubar since I haven't escaped (').
>
>Actually, I posted some code just the other day that could probably be
>easily adapted to this task.  (string_to_store, store_to_string) I'm not
>very familiar with MySQL, but I know that Postgres SQL has a function for
>translating strings back and forth.  I'd look for that before writing my
>own.

I used your string_to_store, and it works fine.  I know there is a function
in MySQL that you can use in a similar way, but it seemed way too elaborate
for me, so I am just sticking with your simple string_to_store which I
believe will be faster anyway, since all I need to escape is (').  I'd
still have to call that function for every string I wanted to escape, so
why not call your function instead?

One thing that I would like to know how to do is how to set it up so that
instead of calling it like a void, with the new and old string, it would be
very nice if I could call it inside a sprintf() for instance, and run it
directly on the string, and have it return the escaped string.  How would I
do that without messing the old string up?

Thank you for all the help! :)

Regards,
/Artovil

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST