|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tools.ant.Task | +--org.apache.tools.ant.taskdefs.SQLExec
Reads in a text file containing SQL statements seperated with semicolons and executes it in a given db. Both -- and // maybe used as comments.
Inner Class Summary | |
static class |
SQLExec.OnError
Enumerated attribute with the values "continue", "stop" and "abort" for the onerror attribute. |
class |
SQLExec.Transaction
Contains the definition of a new transaction element. |
Fields inherited from class org.apache.tools.ant.Task |
description, location, project, target, taskName, taskType, wrapper |
Constructor Summary | |
SQLExec()
|
Method Summary | |
void |
addText(java.lang.String sql)
Set the sql command to execute |
Path |
createClasspath()
Create the classpath for loading the driver. |
SQLExec.Transaction |
createTransaction()
Set the sql command to execute |
protected void |
execSQL(java.lang.String sql,
java.io.PrintStream out)
Exec the sql statement. |
void |
execute()
Load the sql file and then execute it |
protected boolean |
isValidRdbms(java.sql.Connection conn)
Verify if connected to the correct RDBMS |
protected void |
printResults(java.io.PrintStream out)
print any results in the statement. |
protected void |
runStatements(java.io.Reader reader,
java.io.PrintStream out)
|
void |
setAutocommit(boolean autocommit)
Set the autocommit flag for the DB connection. |
void |
setClasspath(Path classpath)
Set the classpath for loading the driver. |
void |
setClasspathRef(Reference r)
Set the classpath for loading the driver using the classpath reference. |
void |
setDriver(java.lang.String driver)
Set the JDBC driver to be used. |
void |
setOnerror(SQLExec.OnError action)
Set the action to perform onerror |
void |
setOutput(java.io.File output)
Set the output file. |
void |
setPassword(java.lang.String password)
Set the password for the DB connection. |
void |
setPrint(boolean print)
Set the print flag. |
void |
setRdbms(java.lang.String vendor)
Set the rdbms required |
void |
setShowheaders(boolean showheaders)
Set the showheaders flag. |
void |
setSrc(java.io.File srcFile)
Set the name of the sql file to be run. |
void |
setUrl(java.lang.String url)
Set the DB connection url. |
void |
setUserid(java.lang.String userId)
Set the user name for the DB connection. |
void |
setVersion(java.lang.String version)
Set the version required |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getProject, getRuntimeConfigurableWrapper, getTaskName, init, log, log, maybeConfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SQLExec()
Method Detail |
public void setClasspath(Path classpath)
public Path createClasspath()
public void setClasspathRef(Reference r)
public void setSrc(java.io.File srcFile)
public void addText(java.lang.String sql)
public SQLExec.Transaction createTransaction()
public void setDriver(java.lang.String driver)
public void setUrl(java.lang.String url)
public void setUserid(java.lang.String userId)
public void setPassword(java.lang.String password)
public void setAutocommit(boolean autocommit)
public void setPrint(boolean print)
public void setShowheaders(boolean showheaders)
public void setOutput(java.io.File output)
public void setRdbms(java.lang.String vendor)
public void setVersion(java.lang.String version)
public void setOnerror(SQLExec.OnError action)
public void execute() throws BuildException
execute
in class Task
org.apache.tools.ant.Task
BuildException
- if someting goes wrong with the buildprotected void runStatements(java.io.Reader reader, java.io.PrintStream out) throws java.sql.SQLException, java.io.IOException
protected boolean isValidRdbms(java.sql.Connection conn)
protected void execSQL(java.lang.String sql, java.io.PrintStream out) throws java.sql.SQLException
protected void printResults(java.io.PrintStream out) throws java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |