[ 
https://jira.codehaus.org/browse/MSQL-63?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Struberg closed MSQL-63.
-----------------------------

       Resolution: Fixed
    Fix Version/s: 1.5

> Problem into the SqlSplitter class when i'm using SQL statements including 
> simple and double quotes which are not opened and closed in the same line.
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MSQL-63
>                 URL: https://jira.codehaus.org/browse/MSQL-63
>             Project: Maven 2.x SQL Plugin
>          Issue Type: Bug
>            Reporter: Mickael BARON
>            Assignee: Mark Struberg
>             Fix For: 1.5
>
>
> I detect problem into the SqlSplitter class when i'm using SQL statements 
> including simple and double quotes which are not opened and closed in the 
> same line.
> For instance, the following SQL statements are used to create a function.
> {code}
> CREATE FUNCTION add_rid_oid(bigint, character varying) RETURNS boolean
>     AS $_$
> DECLARE
>  Rid    ALIAS FOR $1;
>  Oid    ALIAS FOR $2;
>  tuple  RECORD;
>  requete VARCHAR;
>  ok     INT4;
> BEGIN
> requete='INSERT INTO rid_oid(rid,oids)
>          VALUE('||quote_literal(rid)||',' 
>          ||quote_literal(Oid)||')';
> EXECUTE requete;
> {code}
> A opened simple quote is found (requete='INSERT ...). Thus, the 
> containsSqlEnd method into the SqlSplitter class is looping in infinite way 
> because no closed simple quote is found in the same line.
> {code}
> do {
>  if ( line.startsWith( quoteEscape, pos )) {
>   pos += 2;
>  }
> } while ( !line.startsWith( quoteChar, pos++ ) );
> {code}
> I propose to modify the previous code by this one
> {code}
> do {
>  if (pos > line.length()) {
>   return NO_END;
>  }
>  if ( line.startsWith( quoteEscape, pos ) ) {
>   pos += 2;
>  }
> } while ( !line.startsWith( quoteChar, pos++ ) );
> {code}
>                       
> Mickael

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to