Java Doc for SQLExec.java in  » Build » ANT » org » apache » tools » ant » taskdefs » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Build » ANT » org.apache.tools.ant.taskdefs 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.tools.ant.taskdefs.JDBCTask
   org.apache.tools.ant.taskdefs.SQLExec

SQLExec
public class SQLExec extends JDBCTask (Code)
Executes a series of SQL statements on a database using JDBC.

Statements can either be read in from a text file using the src attribute or from between the enclosing SQL tags.

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.

The autocommit attribute specifies whether auto-commit should be turned on or off whilst executing the statements. If auto-commit is turned on each statement will be executed and committed. If it is turned off the statements will all be executed as one transaction.

The onerror attribute specifies how to proceed when an error occurs during the execution of one of the statements. The possible values are: continue execution, only show the error; stop execution and commit transaction; and abort execution and transaction and fail task.


since:
   Ant 1.2

Inner Class :public static class DelimiterType extends EnumeratedAttribute
Inner Class :public static class OnError extends EnumeratedAttribute
Inner Class :public class Transaction



Method Summary
public  voidadd(ResourceCollection rc)
     Adds a collection of resources (nested element).
public  voidaddFileset(FileSet set)
     Adds a set of files (nested fileset attribute).
public  voidaddText(String sql)
     Set an inline SQL command to execute.
public  TransactioncreateTransaction()
    
protected  voidexecSQL(String sql, PrintStream out)
     Exec the sql statement.
public  voidexecute()
    
public  booleangetExpandProperties()
    
protected  voidprintResults(PrintStream out)
    
protected  voidprintResults(ResultSet rs, PrintStream out)
     print any results in the result set.
protected  voidrunStatements(Reader reader, PrintStream out)
    
public  voidsetAppend(boolean append)
     whether output should be appended to or overwrite an existing file.
public  voidsetDelimiter(String delimiter)
     Set the delimiter that separates SQL statements.
public  voidsetDelimiterType(DelimiterType delimiterType)
     Set the delimiter type: "normal" or "row" (default "normal").

The delimiter type takes two values - normal and row.

public  voidsetEncoding(String encoding)
    
public  voidsetEscapeProcessing(boolean enable)
     Set escape processing for statements.
public  voidsetExpandProperties(boolean expandProperties)
    
public  voidsetKeepformat(boolean keepformat)
     whether or not format should be preserved.
public  voidsetOnerror(OnError action)
    
public  voidsetOutput(File output)
     Set the output file; optional, defaults to the Ant log.
public  voidsetPrint(boolean print)
    
public  voidsetShowheaders(boolean showheaders)
     Print headers for result sets from the statements; optional, default true.
public  voidsetShowtrailers(boolean showtrailers)
    
public  voidsetSrc(File srcFile)
     Set the name of the SQL file to be run.



Method Detail
add
public void add(ResourceCollection rc)(Code)
Adds a collection of resources (nested element).
Parameters:
  rc - a collection of resources containing SQL commands,each resource is run in a separate transaction.
since:
   Ant 1.7



addFileset
public void addFileset(FileSet set)(Code)
Adds a set of files (nested fileset attribute).
Parameters:
  set - a set of files contains SQL commands, each File is run ina separate transaction.



addText
public void addText(String sql)(Code)
Set an inline SQL command to execute. NB: Properties are not expanded in this text unless SQLExec.expandProperties is set.
Parameters:
  sql - an inline string containing the SQL command.



createTransaction
public Transaction createTransaction()(Code)
Add a SQL transaction to execute a Transaction to be configured.



execSQL
protected void execSQL(String sql, PrintStream out) throws SQLException(Code)
Exec the sql statement.
Parameters:
  sql - the SQL statement to execute
Parameters:
  out - the place to put output
throws:
  SQLException - on SQL problems



execute
public void execute() throws BuildException(Code)
Load the sql file and then execute it
throws:
  BuildException - on error.



getExpandProperties
public boolean getExpandProperties()(Code)
is property expansion inside inline text enabled? true if properties are to be expanded.
since:
   Ant 1.7



printResults
protected void printResults(PrintStream out) throws SQLException(Code)
print any results in the statement SQLExec.printResults(java.sql.ResultSet,java.io.PrintStream)the two arg version
Parameters:
  out - the place to print results
throws:
  SQLException - on SQL problems.



printResults
protected void printResults(ResultSet rs, PrintStream out) throws SQLException(Code)
print any results in the result set.
Parameters:
  rs - the resultset to print information about
Parameters:
  out - the place to print results
throws:
  SQLException - on SQL problems.
since:
   Ant 1.6.3



runStatements
protected void runStatements(Reader reader, PrintStream out) throws SQLException, IOException(Code)
read in lines and execute them
Parameters:
  reader - the reader contains sql lines.
Parameters:
  out - the place to output results.
throws:
  SQLException - on sql problems
throws:
  IOException - on io problems



setAppend
public void setAppend(boolean append)(Code)
whether output should be appended to or overwrite an existing file. Defaults to false.
since:
   Ant 1.5
Parameters:
  append - if true append to an existing file.



setDelimiter
public void setDelimiter(String delimiter)(Code)
Set the delimiter that separates SQL statements. Defaults to ";"; optional

For example, set this to "go" and delimitertype to "ROW" for Sybase ASE or MS SQL Server.


Parameters:
  delimiter - the separator.



setDelimiterType
public void setDelimiterType(DelimiterType delimiterType)(Code)
Set the delimiter type: "normal" or "row" (default "normal").

The delimiter type takes two values - normal and row. Normal means that any occurrence of the delimiter terminate the SQL command whereas with row, only a line containing just the delimiter is recognized as the end of the command.


Parameters:
  delimiterType - the type of delimiter - "normal" or "row".



setEncoding
public void setEncoding(String encoding)(Code)
Set the file encoding to use on the SQL files read in
Parameters:
  encoding - the encoding to use on the files



setEscapeProcessing
public void setEscapeProcessing(boolean enable)(Code)
Set escape processing for statements.
Parameters:
  enable - if true enable escape processing, default is true.
since:
   Ant 1.6



setExpandProperties
public void setExpandProperties(boolean expandProperties)(Code)
Enable property expansion inside nested text
Parameters:
  expandProperties - if true expand properties.
since:
   Ant 1.7



setKeepformat
public void setKeepformat(boolean keepformat)(Code)
whether or not format should be preserved. Defaults to false.
Parameters:
  keepformat - The keepformat to set



setOnerror
public void setOnerror(OnError action)(Code)
Action to perform when statement fails: continue, stop, or abort optional; default "abort"
Parameters:
  action - the action to perform on statement failure.



setOutput
public void setOutput(File output)(Code)
Set the output file; optional, defaults to the Ant log.
Parameters:
  output - the output file to use for logging messages.



setPrint
public void setPrint(boolean print)(Code)
Print result sets from the statements; optional, default false
Parameters:
  print - if true print result sets.



setShowheaders
public void setShowheaders(boolean showheaders)(Code)
Print headers for result sets from the statements; optional, default true.
Parameters:
  showheaders - if true print headers of result sets.



setShowtrailers
public void setShowtrailers(boolean showtrailers)(Code)
Print trailing info (rows affected) for the SQL Addresses Bug/Request #27446
Parameters:
  showtrailers - if true prints the SQL rows affected
since:
   Ant 1.7



setSrc
public void setSrc(File srcFile)(Code)
Set the name of the SQL file to be run. Required unless statements are enclosed in the build file
Parameters:
  srcFile - the file containing the SQL command.



Methods inherited from org.apache.tools.ant.taskdefs.JDBCTask
public Path createClasspath()(Code)(Java Doc)
public Path getClasspath()(Code)(Java Doc)
protected Connection getConnection() throws BuildException(Code)(Java Doc)
protected AntClassLoader getLoader()(Code)(Java Doc)
protected static Hashtable getLoaderMap()(Code)(Java Doc)
public String getPassword()(Code)(Java Doc)
public String getRdbms()(Code)(Java Doc)
public String getUrl()(Code)(Java Doc)
public String getUserId()(Code)(Java Doc)
public String getVersion()(Code)(Java Doc)
public boolean isAutocommit()(Code)(Java Doc)
public void isCaching(boolean value)(Code)(Java Doc)
protected boolean isValidRdbms(Connection conn)(Code)(Java Doc)
public void setAutocommit(boolean autocommit)(Code)(Java Doc)
public void setCaching(boolean enable)(Code)(Java Doc)
public void setClasspath(Path classpath)(Code)(Java Doc)
public void setClasspathRef(Reference r)(Code)(Java Doc)
public void setDriver(String driver)(Code)(Java Doc)
public void setPassword(String password)(Code)(Java Doc)
public void setRdbms(String rdbms)(Code)(Java Doc)
public void setUrl(String url)(Code)(Java Doc)
public void setUserid(String userId)(Code)(Java Doc)
public void setVersion(String version)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.