SQLAssignmentRow
class SQLAssignmentRow
Represents a list of updates / inserts made to a single row in a table
Methods
Instantiate a new SQLAssignmentRow object with the given values
Adds assignments for a list of several fields
Sets the list of assignments to the given list
Retrieves the list of assignments in parameterised format
Set the value for a single field
Assigns a value to a field using the literal SQL expression, rather than a value to be escaped
Determine if this assignment is empty
Retrieves the list of columns updated
Clears all assignment values
Details
at line 36
__construct(array $values = array())
Instantiate a new SQLAssignmentRow object with the given values
at line 137
$this
addAssignments(array $assignments)
Adds assignments for a list of several fields
Note that field values must not be escaped, as these will be internally parameterised by the database engine.
// Basic assignments
$query->addAssignments(array(
'"Object"."Title"' => 'Bob',
'"Object"."Description"' => 'Bob was here'
))
// Parameterised assignments
$query->addAssignments(array(
'"Object"."Title"' => array('?' => 'Bob')),
'"Object"."Description"' => array('?' => null))
))
// Complex parameters
$query->addAssignments(array(
'"Object"."Score"' => array('MAX(?,?)' => array(1, 3))
));
// Assigment of literal SQL for a field. The empty array is
// important to denote the zero-number paramater list
$query->addAssignments(array(
'"Object"."Score"' => array('NOW()' => array())
));
at line 152
$this
setAssignments(array $assignments)
Sets the list of assignments to the given list
at line 164
array
getAssignments()
Retrieves the list of assignments in parameterised format
at line 191
$this
assign(string $field, mixed $value)
Set the value for a single field
E.g.
// Literal assignment
$query->assign('"Object"."Description"', 'lorum ipsum');
// Single parameter
$query->assign('"Object"."Title"', array('?' => 'Bob'));
// Complex parameters
$query->assign('"Object"."Score"', array('MAX(?,?)' => array(1, 3));
at line 204
$this
assignSQL(string $field, string $sql)
Assigns a value to a field using the literal SQL expression, rather than a value to be escaped
at line 214
boolean
isEmpty()
Determine if this assignment is empty
at line 224
array
getColumns()
Retrieves the list of columns updated
at line 234
$this
clear()
Clears all assignment values