ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Rouillier <guyr-...@burntmail.com>
Subject Re: Using iBatis to create a Postgres function - fails because of semi-colon
Date Thu, 18 Mar 2010 02:54:02 GMT
I'm not following your situation.  You say it works fine through a unit 
test but fails in Tomcat.  By fine, do you mean that you can create your 
stored proc via iBATIS in your unit test?  If so and it fails on your 
webapp, then I'm guessing your webapp is using $ signs for other 
purposes.  You don't mention what language your webapp is using.

At any rate, if you webapp language uses $ signs for its own purposes, 
PostgreSQL allows you to define whatever character you wish for delimiters.

On 3/17/2010 5:13 PM, Collin Peters 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
>
>


-- 
Guy Rouillier

---------------------------------------------------------------------
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