[Zope] How can you insert strings with newlines into SQL database?

Jim Sanford jsanford@atinucleus.com
Mon, 10 Jan 2000 11:06:41 -0600


I use ODBC with Visual FoxPro tables

CR=Carriage Return [chr(13)]
LF=Line Feed [chr(10)]

I turn all CR/LF pairs into single CRs and remaining LFs to CRs with the following code:

<dtml-sqlvar "_.string.replace(_.string.replace(textfield,_.chr(13)+_.chr(10),_.chr(13)),_.chr(10),_.chr(13))" type=string>
 __________________________________________________________________
 
              Jim Sanford
      .       Database Engineer
     / \  /   Accelerated Technology, Inc.
    /   /     720 Oak Circle Drive East
   /  /  \    Mobile, AL 36609
  / /     \   Voice: 334-661-5770  fax: 334-661-5788
 /         \  E-Mail: jsanford@atinucleus.com
              Web: http://www.atinucleus.com
  
 Source Code, No Royalties, Any CPU...It just make sense !
 __________________________________________________________________


----- Original Message ----- 
From: Michel Pelletier <michel@digicool.com>
To: 'Anthony Baxter' <anthony@interlink.com.au>
Cc: <itamars@ibm.net>; <zope@zope.org>
Sent: Monday, January 10, 2000 10:33 AM
Subject: RE: [Zope] How can you insert strings with newlines into SQL database? 


Post the patch to the collector it will get done...

-Michel

> -----Original Message-----
> From: Anthony Baxter [mailto:anthony@interlink.com.au]
> Sent: Monday, January 10, 2000 7:47 AM
> Cc: itamars@ibm.net; zope@zope.org
> Subject: Re: [Zope] How can you insert strings with newlines into SQL
> database? 
> 
> 
> >>> Anthony Baxter wrote
> > Aaron Watters posted a patch for gadfly to fix this - you might
> > want to check either the Zope list archives or the gadfly list
> > archive (at egroups.com). It should probably be applied to the
> > version that's in the Zope CVS....
> 
> Ok, I found it:
> 
> > Anthony Baxter has mentioned a number of times that
> > gadfly barfs on strings with embedded newlines.  There is a
> > one line patch to this. In sqlgen.py replace
> > 
> >    charstre = "'[^\n']*'"
> > 
> > with
> > 
> >    charstre = "'[^']*'"
> > 
> > Sorry!  -- Aaron Watters
> 
> (this would be a nice patch to apply to the CVS tree :)
> Anthony
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 

_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )