Re: How to retrieve column names for tables with underscores

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: How to retrieve column names for tables with underscores
Дата
Msg-id 4D8BB345.8000206@ejurka.com
обсуждение исходный текст
Ответ на Re: How to retrieve column names for tables with underscores  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-jdbc
On 3/24/2011 1:45 PM, Thomas Kellerer wrote:
>
> Kris Jurka wrote on 24.03.2011 21:18:
>> The escape needed depends on the value of
>> standard_conforming_strings. You should use this call to find the
>> escape needed:
>>
>>
>> http://download.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html#getSearchStringEscape()
>
>>
>
> Interesting enough, the setting of standard_conforming_strings does
> not seem to affect this at all. Am I missing something?

Nope, that's my memory failing me.  The comment in getSearchStringEscape
escape gives some details on why this doesn't depend on
standard_conforming_strings.  Turning a search pattern into a literal
happens as a separate step and it's at that time you need to know the
value of s_c_s.

     public String getSearchStringEscape() throws SQLException
     {
         // This method originally returned "\\\\" assuming that it
         // would be fed directly into pg's input parser so it would
         // need two backslashes.  This isn't how it's supposed to be
         // used though.  If passed as a PreparedStatement parameter
         // or fed to a DatabaseMetaData method then double backslashes
         // are incorrect.  If you're feeding something directly into
         // a query you are responsible for correctly escaping it.
         // With 8.2+ this escaping is a little trickier because you
         // must know the setting of standard_conforming_strings, but
         // that's not our problem.

         return "\\";
     }

Kris Jurka

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

Предыдущее
От: Maciek Sakrejda
Дата:
Сообщение: Re: How to retrieve column names for tables with underscores
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: How to retrieve column names for tables with underscores