Executes a series of SQL statements on a database using PDO.
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.
author |
Hans Lellelid hans@xmpl.org (Phing) |
---|---|
author |
Jeff Martin jeff@custommonkey.org (Ant) |
author |
Michael McCallum gholam@xtra.co.nz (Ant) |
author |
Tim Stephenson tim.stephenson@sybase.com (Ant) |
package |
phing.tasks.ext.pdo |
version |
$Id: 77351eabaa4786028c8d6e4b43c5ee7af295bf1b $ |
addFilelist(\FileList $list)
addText( $sql)
NB: Properties are not expanded in this text.
closeConnection()
closeFormatters()
createFormatter() : \PDOSQLExecFormatterElement
createTransaction()
execSQL( $sql)
throws | |
---|---|
getConfiguredFormatters() : array
array
PDOResultFormatter[]
getConnection() : \Connection
The calling method is responsible for closing the connection.
throws |
if the UserId/Password/Url is not set or there is no suitable driver or the driver fails to load. |
---|---|
\Connection
the newly created connection.
getDelimiter() : string
string
getDescription() : string
string
The text description of the task
getLoaderMap() : mixed
mixed
getLocation() : \Location
getOwningTarget() : \Target
getPassword() : string
string
getProject() : \Project
getRegisterSlot(string $slotName) : \RegisterSlot
getRuntimeConfigurableWrapper() : \RuntimeConfigurable
getTaskName() : string
string
Name of this task
getTaskType() : string
string
The type of this task (XML Tag)
getUrl() : string
string
getUserId() : string
string
init()
Should throw a BuildException if something goes wrong with the build
This is abstract here, but may not be overloaded by subclasses.
throws | |
---|---|
initFormatters()
isAutocommit() : \Returns
\Returns
a boolean
isCaching( $value)
isSelectSql(string $sql) : boolean
This does a pretty simple match, checking to see if statement starts with 'select' (but not 'select into').
string
boolean
Whether specified SQL looks like a SELECT query.
log(string $msg, integer $level = \Project::MSG_INFO) : void
string
The message to be logged.
integer
The message's priority at this message should have
main()
Should throw a BuildException if someting goes wrong with the build
This is abstract here. Must be overloaded by real tasks.
maybeConfigure()
perform()
throws | |
---|---|
processResults()
throws | |
---|---|
setCaching( $enable)
setDelimiter( $delimiter)
For example, set this to "go" and delimitertype to "ROW" for Sybase ASE or MS SQL Server.
setDelimiterType(string $delimiterType)
string
setDescription(string $desc)
string
The text describing the task
setFetchmode(mixed $mode)
throws | |
---|---|
mixed
The PDO fetchmode integer or constant name.
setLocation(\Location $location)
setOnerror( $action)
setOwningTarget(\Target $target)
setProject(\Project $project) : void
setRuntimeConfigurableWrapper(\RuntimeConfigurable $wrapper)
setSrc(\PhingFile $srcFile)
setTaskName(string $name) : string
string
string
A string representing the name of this task for log
setTaskType( $name)
setUserid(string $userId)
string
DELIM_ROW
DELIM_NORMAL
DELIM_NONE
goodSql : integer
var |
---|
integer
totalSql : integer
var |
---|
integer
conn : \PDO
var |
---|
\PDO
filesets : array
var |
FileSet[] |
---|
array
filelists : array
var |
FileList[] |
---|
array
formatters : array
var |
PDOSQLExecFormatterElement[] |
---|
array
statement : \PDOStatement
var |
---|
\PDOStatement
sqlCommand : string
var |
---|
string
transactions :
delimiter : string
var |
---|
string
delimiterType :
onError :
encoding :
fetchMode : integer
var |
---|
integer
caching :
autocommit :
url :
userId :
password :
rdbms :
description : string
var |
---|
string
taskType : string
var |
---|
string
taskName : string
var |
---|
string
project : \Project