[arquillian-issues] [JBoss JIRA] (ARQ-1817) Ad-hoc H2 java functions are treated as comments

Cesar Ricardez (JIRA) issues at jboss.org
Tue Dec 9 22:26:39 EST 2014


    [ https://issues.jboss.org/browse/ARQ-1817?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13026508#comment-13026508 ] 

Cesar Ricardez commented on ARQ-1817:
-------------------------------------

Hi,
I tried to reproduce this bug on the current master branch, and it seems that is a problem with the ScriptExecutor.java file. As far i can see, on line 84 we use the ScriptExecutor#removeComments() which use the ANSI_SQL_COMMENTS_PATTERN constant define in the same class perform a String#replaceAll call against the script.

The ANSI_SQL_COMMENTS_PATTERN is a hard-coded string, which contains the follow: "--.*|//.*|(?s)/\*.*?\*/|(?s)\{.*?\}"

Steps to reproduce:
1. Open the ScriptExecutor.java 
2. put a debug breakpoint at line 85 of ScriptExecutor
3. Add the user provided statement to the scripts/two-inserts-with-comment.sql
4. debug ScriptExecutorTest#should_execute_two_statements_when_script_contains_two_insert_statements_and_comment 
5. When the flow hits the breakpoint, you must see the follow:

{code:text}


INSERT INTO useraccount (id, firstname, lastname, username, password) VALUES (1, 'John', 'Smith', 'doovde', 'password');

INSERT INTO useraccount (id, firstname, lastname, username, password) VALUES (2, 'Clark', 'Kent', 'superman', 'kryptonite');

CREATE ALIAS NEXT_PRIME AS $$
  String nextPrime(String value) 
$$;

{code} 

I'll update later...





> Ad-hoc H2 java functions are treated as comments
> ------------------------------------------------
>
>                 Key: ARQ-1817
>                 URL: https://issues.jboss.org/browse/ARQ-1817
>             Project: Arquillian
>          Issue Type: Bug
>          Components: Extension - Persistence
>    Affects Versions: persistence_1.0.0.Alpha7
>            Reporter: Bartosz Majsak
>            Assignee: Bartosz Majsak
>             Fix For: persistence_1.0.0.next
>
>




--
This message was sent by Atlassian JIRA
(v6.3.8#6338)


More information about the arquillian-issues mailing list