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>
Re: ParameterMetaData getPrecision() always zero? Kris Jurka <books@ejurka.com>


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
Дата:
От: Kris Jurka
Дата:
FAQ