You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2007/09/18 09:26:20 UTC

DO NOT REPLY [Bug 43413] New: - ant sql task tries to execute commented lines with keepformat="true" and fails

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43413>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43413

           Summary: ant sql task tries to execute commented lines with
                    keepformat="true" and fails
           Product: Ant
           Version: 1.7.0
          Platform: Other
        OS/Version: Windows NT
            Status: NEW
          Severity: major
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: barahlo@hot.ee


SQL task manual (http://ant.apache.org/manual/CoreTasks/sql.html) states, 
that "...Multiple statements can be provided, separated by semicolons (or the 
defined delimiter). Individual lines within the statements can be commented 
using either --, // or REM at the start of the line..."

Having keepformat="true", ant sql task attempts to execute commented lines and 
fails.

<target name="sql.test">
    <sql driver="${database.driver}" 
        url="${database.url}" 
        userid="${database.user_name}" 
        password="${database.user_pwd}"
        classpathref="classpath-database"
        keepformat="true"
    >
        <transaction>
            REM test
        </transaction>
    </sql>
</target>

Results in:
java.sql.SQLException: ORA-00900: invalid SQL statement

With other types of comments
<transaction>--test</transaction>
and
<transaction>//test</transaction>
execution results in:
java.sql.SQLException: Invalid SQL type

Having keepformat="false" all calls succeed.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 43413] - ant sql task tries to execute commented lines with keepformat="true" and fails

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43413>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43413





------- Additional Comments From barahlo@hot.ee  2007-09-18 02:06 -------
Attaching error stacktrace:

C:\myproject\build.xml:23: java.sql.SQLException: Invalid SQL type
        at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:454)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute
(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.sql.SQLException: Invalid SQL type
        at oracle.jdbc.driver.DatabaseError.throwSqlException
(DatabaseError.java:112)
        at oracle.jdbc.driver.DatabaseError.throwSqlException
(DatabaseError.java:146)
        at oracle.jdbc.driver.DatabaseError.throwSqlException
(DatabaseError.java:208)
        at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:67)
        at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:946)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout
(OracleStatement.java:1168)
        at oracle.jdbc.driver.OracleStatement.executeInternal
(OracleStatement.java:1687)
        at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1653)
        at org.apache.tools.ant.taskdefs.SQLExec.execSQL(SQLExec.java:564)
        at org.apache.tools.ant.taskdefs.SQLExec.runStatements(SQLExec.java:532)
        at org.apache.tools.ant.taskdefs.SQLExec$Transaction.runTransaction
(SQLExec.java:768)
        at org.apache.tools.ant.taskdefs.SQLExec$Transaction.access$000
(SQLExec.java:707)
        at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:438)
        ... 16 more
--- Nested Exception ---
java.sql.SQLException: Invalid SQL type
        at oracle.jdbc.driver.DatabaseError.throwSqlException
(DatabaseError.java:112)
        at oracle.jdbc.driver.DatabaseError.throwSqlException
(DatabaseError.java:146)
        at oracle.jdbc.driver.DatabaseError.throwSqlException
(DatabaseError.java:208)
        at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:67)
        at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:946)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout
(OracleStatement.java:1168)
        at oracle.jdbc.driver.OracleStatement.executeInternal
(OracleStatement.java:1687)
        at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1653)
        at org.apache.tools.ant.taskdefs.SQLExec.execSQL(SQLExec.java:564)
        at org.apache.tools.ant.taskdefs.SQLExec.runStatements(SQLExec.java:532)
        at org.apache.tools.ant.taskdefs.SQLExec$Transaction.runTransaction
(SQLExec.java:768)
        at org.apache.tools.ant.taskdefs.SQLExec$Transaction.access$000
(SQLExec.java:707)
        at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:438)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute
(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.Main.runBuild(Main.java:698)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 43413] - ant sql task tries to execute commented lines with keepformat="true" and fails

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43413>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43413





------- Additional Comments From barahlo@hot.ee  2007-09-18 02:08 -------
Note: when the commented line is surrounded by correct sql clauses, script 
execution succeeds even with keepformat="true"

i.e. 

<transaction>
    select 1 from dual;
    -- test
    select 2 from dual;
</transaction>

is executed without errors

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 43413] - ant sql task tries to execute commented lines with keepformat="true" and fails

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43413>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43413





------- Additional Comments From riznob@hotmail.com  2007-09-26 10:31 -------
The keepformat attribute was created specifically for loading sql packages, 
functions and procedures, in order to maintain the formatting of the files 
being loaded, including comments. Unless you are loading packages, functions or 
procedures, you probably want to leave keepformat="false". 

-Rob Anderson

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 43413] - ant sql task tries to execute commented lines with keepformat="true" and fails

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43413>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43413





------- Additional Comments From stevel@apache.org  2007-09-18 03:23 -------
This doesnt surprise me; When I took the sql code for use in my own project, I
took one look at the statement parsing code and decided to leave it well alone.

Anyway, thanks for the tests; we should be able to replicate this pretty easily.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org