Thread: Bug in JDBC CREATE FUNCTION syntax?

Bug in JDBC CREATE FUNCTION syntax?

From
Olivier Hubaut
Date:
I'm trying to do a create function using JDBC 3,0 in Eclipse IDE with
JFaceDBC plugin.

This function doesn't work:

CREATE FUNCTION @user_schema@.@igloo_login@_log_constraints_set ()
     RETURNS boolean
     LANGUAGE SQL
     AS '
     ALTER TABLE @user_schema@.@igloo_login@_log_transaction
         ADD CONSTRAINT @user_schema@_@igloo_login@_log_transaction_pk
PRIMARY KEY (batch)
     ;
     ALTER TABLE @user_schema@.@igloo_login@_log_object
         ADD CONSTRAINT
@user_schema@_@igloo_login@_log_object_batch_id_uq UNIQUE (batch, id)
     ;
     ALTER TABLE @user_schema@.@igloo_login@_log_object
         ADD CONSTRAINT
@user_schema@_@igloo_login@_log_object_batch_id_class_pk PRIMARY KEY
(batch, id, class)
     ;
     SELECT true;'
;


But the same, written using a different indetation protocol, works:

CREATE FUNCTION @user_schema@.@igloo_login@_log_constraints_set ()
     RETURNS boolean
     LANGUAGE SQL
     AS '
     ALTER TABLE @user_schema@.@igloo_login@_log_transaction
         ADD CONSTRAINT @user_schema@_@igloo_login@_log_transaction_pk
PRIMARY KEY (batch); ALTER TABLE @user_schema@.@igloo_login@_log_object
         ADD CONSTRAINT
@user_schema@_@igloo_login@_log_object_batch_id_uq UNIQUE (batch, id);
         ALTER TABLE @user_schema@.@igloo_login@_log_object
         ADD CONSTRAINT
@user_schema@_@igloo_login@_log_object_batch_id_class_pk PRIMARY KEY
(batch, id, class)
     ; SELECT true;'
;


It seem's that the problem is about the semi-colon position. The
following query MUST be on the same line to make it works...

Does anyone else notice the same thing?

Thanks,


Re: Bug in JDBC CREATE FUNCTION syntax?

From
Kris Jurka
Date:

On Wed, 10 Dec 2003, Olivier Hubaut wrote:

> I'm trying to do a create function using JDBC 3,0 in Eclipse IDE with
> JFaceDBC plugin.

I don't know the JFaceDBC plugin does, but it seems like the @user_schema@
and what not indicate a replacement scheme.  Is it possible that it also
alters the function body somehow?

I don't think this is a backend or JDBC problem.  If you think otherwise a
more complete example that can be run without Eclipse will be necessary.

Kris Jurka



Re: Bug in JDBC CREATE FUNCTION syntax?

From
Olivier Hubaut
Date:
Kris Jurka wrote:

>
> On Wed, 10 Dec 2003, Olivier Hubaut wrote:
>
>
>>I'm trying to do a create function using JDBC 3,0 in Eclipse IDE with
>>JFaceDBC plugin.
>
>
> I don't know the JFaceDBC plugin does, but it seems like the @user_schema@
> and what not indicate a replacement scheme.  Is it possible that it also
> alters the function body somehow?
>
> I don't think this is a backend or JDBC problem.  If you think otherwise a
> more complete example that can be run without Eclipse will be necessary.
>
> Kris Jurka
>
>
>
Thanks for your fast response.

The @user_schema@ and other similar pattern are just ANT's variables
used to create the functions on demand. The real query contains the réal
schema name and function name, and this one doesn't work.

I've already tried to make some other multiple queries, without any
problems. There is only with the CREATE FUNCTION that this bug appear.

I don't Think JFaceDBC is the cause, it's only a quite simple editor to
write queries with colorization, noting else.

--
Ci-git une signature avortee.
** RIP **