Thread: Problem with character in strings

Problem with character in strings

From
theofilu@eunet.at (Theofilu Andreas)
Date:
-----BEGIN PGP SIGNED MESSAGE-----

Hi to all,

As explained in a previous mail today, I'm porting an Informix based
application to PostgreSQL. Now this work is nearly done, but there is
still a problem with the character ' in strings. I'm using 'ecpg' for
develop. Whenever a ' appears in a string that should be inserted into the
database, it crashes with the error 'too many arguments in line'. I found
out that the ' is interpreted as 'end of string'. How's that possible? I'm
using normal variables in the application. Is there a workaround possible?

However. I know I can precede every ' with a backslash, but that would make
my code completely incompatible to the still supported Informix. Can I
change the delimiter for strings in some way?

Some data: PostgreSQL 6.5.1 Linux 2.2.7 (SuSE 6.1) Intel Pentium egcs-2.91.66


- --
Theofilu Andreas
http://members.eunet.at/theofilu
              -------------------------------------------------                          Enjoy the science of Linux!
                 Genieße die Wissenschaft von Linux!              -------------------------------------------------
 

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: latin1

iQCVAwUBN9v/pmj/BcrYxhjVAQE11gP/VJaJh+8e6Y+2c666Rswg6B5htbujsMOU
oYJotlP2w6u7gr81m2sG14FM4pq0KfhvKXj9HQ9Fr4O6GXz4/Bf4xZ4jwBPWK3NZ
1Ml3ffTAadGLFsol9cN32ERRv35pW11snPeVBOZ9orxULle1TLNHzvwZfEJbhk+q
MmmhdRqsPbA=
=r23y
-----END PGP SIGNATURE-----


Re: [INTERFACES] Problem with character in strings

From
Rusty Brooks
Date:
On Sun, 12 Sep 1999, Theofilu Andreas wrote:

==>As explained in a previous mail today, I'm porting an Informix based
==>application to PostgreSQL. Now this work is nearly done, but there is
==>still a problem with the character ' in strings. I'm using 'ecpg' for
==>develop. Whenever a ' appears in a string that should be inserted into the
==>database, it crashes with the error 'too many arguments in line'. I found
==>out that the ' is interpreted as 'end of string'. How's that possible? I'm
==>using normal variables in the application. Is there a workaround possible?

Actually, ' is the end of string character, not end of line.

==>However. I know I can precede every ' with a backslash, but that would make
==>my code completely incompatible to the still supported Informix. Can I
==>change the delimiter for strings in some way?

To comment out the ', use ''.  For example, change the string
Rusty's Home
to 
Rusty''s Home.

Are you sure that the above won't work with Informix?  It's pretty
standard.

   ..uu.                                      .uH  Rusty Brooks   $""`?i           z'                     .x*`
rbrooks@utdallas.edu `M  .@"          x"                   .uf`         'Z :#"  .   .    f 8M               .@8   '&H?`
:$f U8   <  MP   x#'        'E9F  uf"          ,     ,  d#`    XM  $5.  $  M' xM"            9h+"   $M    eH. 8b. .8
......!">    @  'f`$L:M  R.@!`            .8`     $'   M 'E  `R;'   d?"""`"#
 
+`  >     R  X  "NXF  R"*L            ` E      @    b  d   9R    ?*     @   k    'f  M   "$$ :E  5.             >
K.zM`%M'   9'    Xf   .f   %    `~  "    `  'K  'M            ;       R'          9     M  .=`                     'E
`h          t                   M     Mx~                     X     `          @                  lR    z
     *                @                  `   ;"                                                            `
 
Is there anybody out there?
----------------------------------
Wouldn't the sentence "I want to put a hyphen between the words Fish
and And and And and Chips in my Fish-And-Chips sign" have been clearer if
quotation marks had been placed before Fish, and between Fish and and, and
and and And, and And and and, and and and And, and And and and, and and
and Chips, as well as after Chips?