phing-tasks-ext-creole

# Class: CreoleSQLExecTask Source Location: /tasks/ext/creole/CreoleSQLExecTask.php
### Class Overview
    ProjectComponent
       |
       --Task
          |
          --CreoleTask
             |
             --CreoleSQLExecTask
Executes a series of SQL statements on a database using Creole. #### Author(s): Hans Lellelid <hans@xmpl.org> (Phing) Tim Stephenson <tim.stephenson@sybase.com> (Ant) Jeff Martin <jeff@custommonkey.org> (Ant) Michael McCallum <gholam@xtra.co.nz> (Ant) #### Version: $Revision: 557 $ #### Copyright: � 2001,2002 THYRELL. All rights reserved | ### Constants DELIM_NORMAL DELIM_ROW | ### Methods addFileset addText createFilterChain createTransaction execSQL main printResults runStatements setAppend setDelimiter setDelimiterType setEncoding setOnerror setOutput setPrint setShowheaders setSrc
### Inherited Variables #### Class: Task Task::$description Task::$location Task::$target Task::$taskName Task::$taskType Task::$wrapper #### Class: ProjectComponent ProjectComponent::$project | ### Inherited Methods #### Class: CreoleTask CreoleTask::getConnection() Creates a new Connection as using the driver, url, userid and password specified. CreoleTask::getLoaderMap() CreoleTask::getPassword() Gets the password. CreoleTask::getUrl() Gets the url. CreoleTask::getUserId() Gets the userId. CreoleTask::init() Initialize CreoleTask. CreoleTask::isAutocommit() Gets the autocommit. CreoleTask::isCaching() CreoleTask::setAutocommit() Auto commit flag for database connection; optional, default false. CreoleTask::setCaching() Caching loaders / driver. This is to avoid CreoleTask::setDriver() Set the Creole driver to be used. CreoleTask::setPassword() Sets the password; required. CreoleTask::setUrl() Sets the database connection URL; required. CreoleTask::setUserid() Set the user name for the connection; required. CreoleTask::setVersion() Sets the version string, execute task only if rdbms version match; optional. #### Class: Task Task::getDescription() Returns the textual description of the task Task::getLocation() Returns the location within the buildfile this task occurs. Used by BuildException to give detailed error messages. Task::getOwningTarget() Returns the owning target of this task. Task::getRegisterSlot() Returns a name Task::getRuntimeConfigurableWrapper() Returns the wrapper object for runtime configuration Task::getTaskName() Returns the name of task, used only for log messages Task::getTaskType() Returns the name of the task under which it was invoked, usually the XML tagname Task::init() Called by the parser to let the task initialize properly. Task::log() Provides a project level log event to the task. Task::main() Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running <em>phing target1 target2</em> will run all tasks in target3 twice. Task::maybeConfigure() Configure this task if it hasn't been done already. Task::perform() Perfrom this task Task::setDescription() Sets a textual description of the task Task::setLocation() Sets the location within the buildfile this task occurs. Called by the parser to set location information. Task::setOwningTarget() Sets the owning target this task belongs to. Task::setRuntimeConfigurableWrapper() Sets the wrapper object this task should use for runtime configurable elements. Task::setTaskName() Sets the name of this task for log messages Task::setTaskType() Sets the type of the task. Usually this is the name of the XML tag #### Class: ProjectComponent ProjectComponent::getProject() Returns a reference to current project ProjectComponent::log() Logs a message with the given priority. ProjectComponent::setProject() References the project to the current component.
### Class Details [line 54] Executes a series of SQL statements on a database using Creole. 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. #### Tags:
author: | Hans Lellelid <hans@xmpl.org> (Phing)
author: | Tim Stephenson <tim.stephenson@sybase.com> (Ant)
author: | Jeff Martin <jeff@custommonkey.org> (Ant)
author: | Michael McCallum <gholam@xtra.co.nz> (Ant)
version: | $Revision: 557 $
copyright: | � 2001,2002 THYRELL. All rights reserved
[ Top ] ### Class Methods ### method addFileset [line 158]
`void addFileset( $set)`
Adds a set of files (nested fileset attribute). #### Tags:
access: | public
#### Parameters:
FileSet | $set |
[ Top ] ### method addText [line 151]
`void addText( $sql)`
Set an inline SQL command to execute. NB: Properties are not expanded in this text. #### Tags:
access: | public
#### Parameters:
| $sql |
[ Top ] ### method createFilterChain [line 168]
`object The createFilterChain( )`
Creates a filterchain #### Tags:
return: | created filterchain object
access: | public
[ Top ] ### method createTransaction [line 176]
`void createTransaction( )`
Add a SQL transaction to execute #### Tags:
access: | public
[ Top ] ### method execSQL [line 444]
`void execSQL( $sql, [ $out = null])`
Exec the sql statement. #### Tags:
throws: | SQLException
access: | protected
#### Parameters:
| $sql |
| $out |
[ Top ] ### method main [line 267]
`void main( )`
Load the sql file and then execute it #### Tags:
throws: | BuildException
access: | public
Overrides Task::main() (Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running <em>phing target1 target2</em> will run all tasks in target3 twice.) [ Top ] ### method printResults [line 475]
`void printResults( [ $out = null])`
print any results in the statement. #### Tags:
access: | protected
#### Parameters:
| $out |
[ Top ] ### method runStatements [line 373]
`void runStatements( $reader, [ $out = null])`
read in lines and execute them #### Tags:
throws: | SQLException, IOException
access: | public
#### Parameters:
Reader | $reader |
| $out |
[ Top ] ### method setAppend [line 250]
`void setAppend( $append $append)`
whether output should be appended to or overwrite an existing file. Defaults to false. #### Tags:
access: | public
#### Parameters:
$append | $append |
[ Top ] ### method setDelimiter [line 199]
`void setDelimiter( delimiter $delimiter)`
Set the statement delimiter. For example, set this to "go" and delimitertype to "ROW" for Sybase ASE or MS SQL Server. #### Tags:
access: | public
#### Parameters:
delimiter | $delimiter |
[ Top ] ### method setDelimiterType [line 212]
`void setDelimiterType( string $delimiterType)`
Set the Delimiter type for this sql task. The delimiter type takes two values - normal and row. Normal means that any occurence 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. #### Tags:
access: | public
#### Parameters:
string | $delimiterType |
[ Top ] ### method setEncoding [line 187]
`void setEncoding( encoding $encoding)`
Set the file encoding to use on the SQL files read in #### Tags:
access: | public
#### Parameters:
encoding | $encoding | the encoding to use on the files
[ Top ] ### method setOnerror [line 259]
`void setOnerror( $action)`
Action to perform when statement fails: continue, stop, or abort optional; default &quot;abort&quot; #### Tags:
access: | public
#### Parameters:
| $action |
[ Top ] ### method setOutput [line 241]
`void setOutput( $output)`
Set the output file; optional, defaults to the console. #### Tags:
access: | public
#### Parameters:
PhingFile | $output |
[ Top ] ### method setPrint [line 222]
`void setPrint( boolean $print)`
Set the print flag. #### Tags:
access: | public
#### Parameters:
boolean | $print |
[ Top ] ### method setShowheaders [line 232]
`void setShowheaders( boolean $showheaders)`
Print headers for result sets from the statements; optional, default true. #### Tags:
access: | public
#### Parameters:
boolean | $showheaders |
[ Top ] ### method setSrc [line 143]
`void setSrc( $srcFile)`
Set the name of the SQL file to be run. Required unless statements are enclosed in the build file #### Tags:
access: | public
#### Parameters:
PhingFile | $srcFile |
[ Top ] ### Class Constants #### DELIM_NORMAL = "normal" [line 60] [ Top ] #### DELIM_ROW = "row" [line 59] [ Top ] Documentation generated on Mon, 19 Oct 2009 10:50:39 +0200 by phpDocumentor 1.4.3