Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: single quotes in text datatypes
Date: Apr 16 1998 3:29PM

David Carter writes:
 > Hi,
 > Hope this is an easy one for my first posting:
 > How do I insert a TEXT datatype containing a '?

I've had a lot of success using dbwritetext().
What dbsafestr() does is double the quotes that you wish to quote
(sic), so "isn't it" becomes "isn''t it", and is stored like that in
the db (which is ugly).

 > Read the FAQ, but didn't find a satisfactory solution (the description for
 > dbsafestr seems to imply that it will convert ' to "). It's not correct to
 > say `David"s book`. Besides - it looks wierd. As would `David`s Book`.
 > Perhaps I should invent a code like &^*$-m, which should
 > never occur in text, to mean ' :-)
 > The Que Sybase book I've got says "TEXT and IMAGE" types are the same, yet
 > our server cries when I try to feed it 0x..... expecting a TEXT type. It
 > also cries when I try to feed it 'The quick brown fox jumps over the lazy
 > dog's tail.'

You can insert that with dbwritetext() quite easily. See the manual
and the example script in the /eg directory of the sybperl

Michael Peppler         -||-  Data Migrations Inc.    -||-
Int. Sybase User Group  -||-