my dog learned polymorphism*
The moose likes JDBC and the fly likes parse a multi-line SQL programs to get the single-line SQL statements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "parse a multi-line SQL programs to get the single-line SQL statements" Watch "parse a multi-line SQL programs to get the single-line SQL statements" New topic
Author

parse a multi-line SQL programs to get the single-line SQL statements

albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 245
Please help to write a program to parse a multi-line SQL programs to get the single-line SQL statements enclosed inside "jdbcTemplate.update".
Input is:


Output is:
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Let's see what you've tried first, preferably in the form of an SSCCE
http://mindprod.com/jgloss/sscce.html


luck, db
There are no new questions, but there may be new answers.
albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 245
This is my first attempt.
Feel free to suggest improvement.


Output is
jdbcTemplate.update("DROP TABLE assets");
DROP TABLE assets");
DROP TABLE assets
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: parse a multi-line SQL programs to get the single-line SQL statements
 
Similar Threads
Hibernate is driving me crazy !
Restore problem
Three problems with mysql...
Mapping same POJO to two tables in Hibernate XML mapping files
Using strings within strings to read vars?