ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Collin Peters <cadio...@gmail.com>
Subject Re: Using iBatis to create a Postgres function - fails because of semi-colon
Date Wed, 17 Mar 2010 21:19:30 GMT
Oh - I forgot to mention a few other details.
 * I am using the iBatis spring integration (ibatis-sqlmap-2.3.0.jar,
spring-ibatis-2.0.8.jar)
 * The weirdest part here is that the code fully works when I run it
through a unit test, but when I run it as a deployed webapp, it fails.


On Wed, Mar 17, 2010 at 2:13 PM, Collin Peters <cadiolis@gmail.com> wrote:
> Hi all,
>
> I am trying to accomplish an obscure use-case.  I am trying to
> implement the generation of a Postgres function (aka stored procedure)
> via iBatis.  I am using an <insert> tag and simply have the standard
> PostgreSQL syntax for creating the funciton within it.  I created all
> this functionality through unit tests and everything worked great.  As
> soon as I tried to run the application from within my webapp (Tomcat)
> however, it bailed with an "unterminated dollar-quoted string at or
> near..." error.  After some debugging I found out that it was
> truncating the query after the semi-colon.
>
> I guess this makes sense as iBatis uses prepared statements and can
> therefore only execute one SQL statement at a time.  So in this case I
> am executing one SQL statement which is a 'CREATE FUNCTION' but within
> that statement there are multiple SQL statements (i.e. the code within
> the function).  iBatis doesn't seem to be able to handle this though
> and simple searches through the generated SQL statement and stops at
> the first semi-colon.
>
> I am wondering if there are any work-arounds to this problem?  The
> only solution that I can think of is to pass off the generation of my
> custom function to another postgres function, and simply call that
> function with the necessary arguments.
>
> Regards,
> Collin
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message