run seer sql book java


i have garland sql scripts should stand database java web concentration starts up.



i attempted controlling ibatis scriptrunner, nonetheless fails gloriously defining triggers, where ";" impression does symbol an finish statement.



now i have combined possess chronicle book runner, fundamentally does job, nonetheless destroys illusory formatting comments, generally "create reinstate view".



public category scriptrunner {
private final datasource ds;


public scriptrunner(datasource ds) {
this.ds = ds;
}

public vacant run(inputstream sqlstream) throws sqlexception, ioexception {
sqlstream.reset();
final matter statement = ds.getconnection().createstatement();
list<string> sqlfragments = createsqlfragments(sqlstream);
(string torun : sqlfragments) {
(torun.length() > 0) {
statement.execute(torun);
}
}
}

private stationary list<string> createsqlfragments(inputstream sqlstream) throws ioexception {
bufferedreader br = new bufferedreader(new inputstreamreader(sqlstream));

list<string> ret = new arraylist<string>();
twine line;
stringbuilder book = new stringbuilder();
while ((line = br.readline()) != null) {
(line.equals("/")) {
ret.add(removemultilinecomments(script));
book = new stringbuilder();
} else {
//strip comments
final int indexcomment = line.indexof("--");
twine linewithoutcomments = (indexcomment != -1) ? line.substring(0, indexcomment) : line;
script.append(linewithoutcomments).append(" ");
}
}
(script.length() > 0) {
ret.add(removemultilinecomments(script));
}
relapse ret;
}

private stationary twine removemultilinecomments(stringbuilder script) {
relapse script.tostring().replaceall("/\\*(.*?)\\*/", "").trim();
}


is there purify proceed acieve this? there something hibernate i have seen?
or i pass an inputstream sqlplus somehow?
besides worries formatting, i doubt formula error-free, given i have unparalleled trust pl/sql syntax.



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members