Re: sending a block through jdbc

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: sending a block through jdbc
Дата
Msg-id alpine.BSO.2.00.1005010959380.24884@leary.csoft.net
обсуждение исходный текст
Ответ на sending a block through jdbc  (Maxime Lévesque <maxime.levesque@gmail.com>)
Список pgsql-jdbc

On Fri, 30 Apr 2010, Maxime L?vesque wrote:

> I want to drop a constraint if it exists, and not get an error if it
> doesn't exist, ideally I'd get a jdbc error code, and silence the
> 'consrtaint does not exist' exception, but since postgress doesn't send
> error codes to jdbc, I'd like to put the statement in a block and
> silence the exception like this

PG sets SQLState in the SQLException since it is standardized and not
error code which is vendor specific.

>    sb.append("begin \n");
>    sb.append("alter table " + foreingKeyTable.name + " drop
> constraint " + fkName + ";\n");
>    sb.append("exception when true then \n");
>    sb.append("end;");
>
> It seems that this is either unsupported or I have bad syntax....

PG will only support anonymous blocks in the upcoming 9.0 release, and
then with a different syntax.

http://developer.postgresql.org/pgdocs/postgres/sql-do.html

Kris Jurka

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

Предыдущее
От: Maxime Lévesque
Дата:
Сообщение: sending a block through jdbc
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: Very Dangerous bug in XA connection pooling and SL EJBs with jboss-4.2.3 & latest postgresql-8.4-701.jdbc3.jar