Re: ParameterMetaData getPrecision() always zero?

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: ParameterMetaData getPrecision() always zero?
Дата
Msg-id alpine.BSO.2.00.1001291617290.31378@leary.csoft.net
обсуждение исходный текст
Ответ на ParameterMetaData getPrecision() always zero?  (Simon Temple <simon.temple@amalto.com>)
Список pgsql-jdbc

On Thu, 28 Jan 2010, Simon Temple wrote:

>     ParameterMetaData m = stat.getParameterMetaData(  );
>     int colWidth = m.getPrecision( parameterIndex );
>
> For varchar columns I would expect to get the maximum column width.  So 8
> for a varchar(8).
>
> I always get zero as a result.
>

This is the best the JDBC driver can do.  When preparing a statement, the
server only returns the datatypes, not additional details about the size.
This is because the parameters do not always match up with a table column.
Consider "WHERE replace(col, 'a', 'bb') = ?"  you won't be able to tell
the parameter size from that.

Kris Jurka

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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: LIKE and ESCAPING in JDBC Select Statement
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: Object types and ResultSets (java.sql.Struct)