Overview

Namespaces

  • DSchoenbauer
    • Sql
      • Command
      • Exception
      • Where

Classes

  • Create
  • Delete
  • Select
  • Update

Interfaces

  • CommandInterface

Traits

  • WhereTrait
  • Overview
  • Namespace
  • Class

Class Update

updates values in a PDO connected resource

DSchoenbauer\Sql\Command\Update implements DSchoenbauer\Sql\Command\CommandInterface uses DSchoenbauer\Sql\Command\WhereTrait
Namespace: DSchoenbauer\Sql\Command
Author: David Schoenbauer dschoenbauer@gmail.com
Since: v1.0.0
Located at Sql/Command/Update.php
Methods summary
public
# __construct( string $table, array $data, DSchoenbauer\Sql\Where\WhereStatementInterface $where = null )

Parameters

$table
table with which you wish to append to
$data

a single level associative array containing keys that represent the fields and values that represent new values to be added into the table

$where

an object that is designed to return a where statement to limit the data that is affected by the update

Since

v1.0.0
public boolean
# execute( PDO $pdo )

takes the SQL and the data provided and executes the query with the data

takes the SQL and the data provided and executes the query with the data

Parameters

$pdo

a connection object that defines where the connection is to be executed

Returns

boolean
TRUE on success or FALSE on failure.

Throws

DSchoenbauer\Sql\Exception\EmptyDatasetException

if no data has been set no fields can be discerned and no query can be made


DSchoenbauer\Sql\Exception\ExecutionErrorException

thrown when any exception or SQL failure occurs

Since

v1.0.0

Implementation of

DSchoenbauer\Sql\Command\CommandInterface::execute()
public string
# getSql( )

Generates a SQL statement ready to be prepared for execution with the intent of updating data

Generates a SQL statement ready to be prepared for execution with the intent of updating data

Returns

string

a string that represents an update statement ready to be prepared by PDO

Throws

DSchoenbauer\Sql\Exception\EmptyDatasetException

if no data has been set no fields can be discerned and no query can be made

Since

v1.0.0

Implementation of

DSchoenbauer\Sql\Command\CommandInterface::getSql()
public string
# getTable( )

retrieves the table with which you wish to update

retrieves the table with which you wish to update

Returns

string
table with which you wish to update

Since

v1.0.0
public DSchoenbauer\Sql\Command\Update
# setTable( string $table )

defines a table with which you wish to update

defines a table with which you wish to update

Parameters

$table
a table with which you wish to update

Returns

DSchoenbauer\Sql\Command\Update
for method chaining

Since

v1.0.0
public array
# getCombinedData( )

Returns a combination of data from Where statement and from this object

Returns a combination of data from Where statement and from this object

Returns

array

Since

v1.0.0
public array
# getData( )

retrieves the data that is used to generate the update statement. The fields of the array are used to generate the field list.

retrieves the data that is used to generate the update statement. The fields of the array are used to generate the field list.

Returns

array

a single level associative array containing keys that represent the fields and values that represent new values to be updated in the table

Since

v1.0.0

Implementation of

DSchoenbauer\Sql\Command\CommandInterface::getData()
public DSchoenbauer\Sql\Command\Update
# setData( array $data )

sets the data that is used to generate the update statement. The fields of the array are used to generate the field list.

sets the data that is used to generate the update statement. The fields of the array are used to generate the field list.

Parameters

$data

a single level associative array containing keys that represent the fields and values that represent values to be updated into the table

Returns

DSchoenbauer\Sql\Command\Update
for method chaining

Since

v1.0.0
Methods used from DSchoenbauer\Sql\Command\WhereTrait
getWhere(), getWhereData(), getWhereStatement(), hasWhere(), setWhere()
API documentation generated by ApiGen