addslashes
Richard Kreiss
rkreiss at verizon.net
Thu Aug 26 07:27:17 PDT 2010
> -----Original Message-----
> From: filepro-list-bounces+rkreiss=verizon.net at lists.celestial.com
[mailto:filepro-list-
> bounces+rkreiss=verizon.net at lists.celestial.com] On Behalf Of Fairlight
> Sent: Wednesday, August 25, 2010 7:42 PM
> To: filepro-list at lists.celestial.com
> Subject: Re: addslashes
>
> At Wed, Aug 25, 2010 at 06:58:02PM -0400 or thereabouts,
> suspect Jose Lerebours was observed uttering:
> > On Wed, Aug 25, 2010 at 4:39 PM, richard <richard at appgrp.net> wrote:
> > >
> > > Is there a simple way in filepro to turn "Robert's golf clubs" into
> > > "Robert\'s golf clubs"?
> >
> > You could try using replace() function or simply write a routine that
> > seeks out these characters, splits the string and escapes the
> > characters.
>
> Is REPLACE() a new function in 5.0 or 5.6? It's not in the 4.8 docs.
>
> Personally, I'd loop through the string with INSTR(), take everything
> before the offending character and put it in an uncast variable, put the
> requisite escape character for the offending character, then the offending
> character itself onto the new buffer, and then start from the character
> after that with INSTR() on the original string. Rinse, repeat until done.
>
> > One thing comes to mind, you may truncate some of the field content by
> > inserting escape characters ...
>
> Use an uncast dummy as the repository. The contents won't be truncated
> unless they exceed (32KB - 1 byte), which is longer than any real field
> you'd input into anyway. SQL won't have anything truncated, as the escape
> isn't going to be stored.
>
> > There might be a way to simply dump the content to a text file, run a
> > shell script to do a global search and replace and read back the final
> > output.
>
> s/might be/is/
>
> [Now there's irony for you...] :)
>
> It's called sed.
>
> mark->
Not aware of a replace() as a normal filepro function. In checking the 5.6
docs, replace appears in the odbc version.
This is not part of fpsql if that is what is being used for a query.
Richard Kreiss
GCC Consulting
rkreiss at gccconsulting.net
More information about the Filepro-list
mailing list