Overview

Namespaces

  • DSchoenbauer
    • Sql
      • Command
      • Exception
      • Where

Classes

  • Create
  • Delete
  • Select
  • Update

Interfaces

  • CommandInterface

Traits

  • WhereTrait
  • Overview
  • Namespace
  • Class

Class Create

adds values to a PDO connected resource

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

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

Since

v1.0.0
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
# 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

string
will return the lastInsertId from the PDO connection object

Throws

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
# getTable( )

retrieves the table with which you wish to append to

retrieves the table with which you wish to append to

Returns

string
table with which you wish to append to

Since

v1.0.0
public array
# getData( )

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

retrieves the data that is used to generate the create 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 added into the table

Since

v1.0.0

Implementation of

DSchoenbauer\Sql\Command\CommandInterface::getData()
public DSchoenbauer\Sql\Command\Create
# setTable( string $table )

defines a table with which you wish to append to

defines a table with which you wish to append to

Parameters

$table
a table with which you wish to append to

Returns

DSchoenbauer\Sql\Command\Create
for method chaining

Since

v1.0.0
public DSchoenbauer\Sql\Command\Create
# setData( array $data )

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

sets the data that is used to generate the create 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 new values to be added into the table

Returns

DSchoenbauer\Sql\Command\Create
for method chaining

Since

v1.0.0
API documentation generated by ApiGen