Re: Problem escaping, nonstandard use of \\ in a string literal

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Problem escaping, nonstandard use of \\ in a string literal
Дата
Msg-id 48AA1B7C.6040705@opencloud.com
обсуждение исходный текст
Ответ на Re: Problem escaping, nonstandard use of \\ in a string literal  (Warren Bell <warren@clarksnutrition.com>)
Список pgsql-jdbc
Warren Bell wrote:

> I ended up going back to PostgreSQL version 8.1. I did not have the time
> to work everything out.
>
> I am using Ibatis and the prepared statement that was being used was
> something like:
>
> INSERT INTO tabel (somestringfield) VALUES (?)
>
> the parameter that was passed was 'Joe\'s'. I also tried  E'Joe\'s'. It
> did not like the escaped apostrophe. I guess Postgres 8.3 is escaping
> special characters differently. It seems like this would be something
> the driver would handle. How are you suppose to make this work? I will
> also check with the Ibatis group on this.

This should "just work" with no quoting and no escaping of the string
that you pass to setString(). i.e. you should just be doing:

   ps.setString(1, "Joe's");

If you've managed to get escaping/quoting errors somehow I'd really like
to know how .. the parameter is passed out-of-line from the query
string, not interpolated into it, so I'm really puzzled how this could
ever happen.

A testcase would be great.

-O

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Warren Bell
Дата:
Сообщение: Re: Problem escaping, nonstandard use of \\ in a string literal
Следующее
От: "Albe Laurenz"
Дата:
Сообщение: Re: Problem escaping, nonstandard use of \\ in a string literal