PHP Class Prado\Data\SqlMap\Statements\TMappedStatement

This class is usualy instantiated during SQLMap configuration by TSqlDomBuilder.
Since: 3.0
Inheritance: extends Prado\TComponent, implements Prado\Data\SqlMap\Statements\IMappedStatement
Afficher le fichier Open project: pradosoft/prado

Méthodes publiques

Méthode Description
__construct ( TSqlMapManager $sqlMap, TSqlMapStatement $statement ) Creates a new mapped statement.
__sleep ( )
__wakeup ( )
executeInsert ( $connection, $parameter ) : string Execute an insert statement. Fill the parameter object with the ouput parameters if any, also could return the insert generated key.
executeQueryForList ( $connection, $parameter, $result = null, $skip, $max, $delegate = null ) : array Executes the SQL and retuns a List of result objects.
executeQueryForMap ( $connection, $parameter, $keyProperty, $valueProperty = null, $skip, $max, $delegate = null ) : array Executes the SQL and retuns all rows selected in a map that is keyed on the property named in the keyProperty parameter. The value at each key will be the value of the property specified in the valueProperty parameter.
executeQueryForObject ( $connection, $parameter, $result = null ) Executes an SQL statement that returns a single row as an object of the type of the $result passed in as a parameter.
executeUpdate ( $connection, $parameter ) : integer Execute an update statement. Also used for delete statement.
getCommand ( ) : TPreparedCommand
getID ( ) : string
getManager ( ) : TSqlMapper
getSqlString ( )
getStatement ( ) : TSqlMapStatement
onExecuteQuery ( $sql ) Raise the execute query event.
runQueryForList ( $connection, $parameter, $sql, $result, $delegate = null ) : array Executes the SQL and retuns a List of result objects.
runQueryForMap ( $connection, $parameter, $command, $keyProperty, $valueProperty = null, $delegate = null ) : array Executes the SQL and retuns all rows selected in a map that is keyed on the property named in the keyProperty parameter. The value at each key will be the value of the property specified in the valueProperty parameter.
runQueryForObject ( $connection, $command, &$result ) : object Executes an SQL statement that returns a single row as an object of the type of the $result passed in as a parameter.

Méthodes protégées

Méthode Description
addResultMapGroupBy ( $resultMap, $row, $parent, &$resultObject ) : object ResultMap with GroupBy property. Save object collection graph in a tree and collect the result later.
applyResultMap ( $row, &$resultObject = null ) : object Apply result mapping.
enquequePostSelect ( $select, $resultMap, $property, $row, $resultObject ) Add nested result property to post select queue.
executePostSelect ( $connection ) Process 'select' result properties
executeSQLQueryLimit ( $connection, $command, $max, $skip ) : mixed Execute SQL Query with limits.
executeSelectKey ( $connection, $parameter, $selectKey ) : string Execute the select key statement, used to obtain last insert ID.
fillArrayResultMap ( $resultMap, $row, $resultObject ) : array Retrieve the result map as an array.
fillDefaultResultMap ( $resultMap, $row, $resultObject ) : mixed Fill the result map using default settings. If $resultMap is null the result object returned will be guessed from $resultObject.
fillPropertyWithResultMap ( $resultMap, $row, &$resultObject ) : boolean Fills the property with result mapping results.
fillResultArrayList ( $row, $resultObject ) : object Apply the result to a TList or an array.
fillResultClass ( $resultClass, $row, $resultObject ) : object Fill the result using ResultClass, will creates new result object if required.
fillResultMap ( $resultMapName, $row, $parentGroup = null, &$resultObject = null ) : object Fills the result object according to result mappings.
fillResultObjectProperty ( $row, $resultObject ) : object Apply the result to an object.
getPostGeneratedSelectKey ( $connection, $parameter ) : string Gets the inserted row ID after executing an insert statement.
getPostSelectKeys ( $resultMap, $property, $row ) : array Finds in the post select property the SQL statement primary selection keys.
getPreGeneratedSelectKey ( $connection, $parameter ) : string Gets the insert generated ID before executing an insert statement.
getResultMapGroupKey ( $resultMap, $row ) : string Gets the result 'group by' groupping key for each row.
getScalarResult ( $result, $type ) : mixed Converts the first array value to scalar value of given type.
initialGroupByResults ( ) Empty the group by results cache.
raiseRowDelegate ( $handler, $param ) Raises delegate handler.
setObjectProperty ( $resultMap, $property, $row, &$resultObject ) Set a property of the result object with appropriate value.

Method Details

__construct() public méthode

Creates a new mapped statement.
public __construct ( TSqlMapManager $sqlMap, TSqlMapStatement $statement )
$sqlMap Prado\Data\SqlMap\TSqlMapManager
$statement Prado\Data\SqlMap\Configuration\TSqlMapStatement

__sleep() public méthode

public __sleep ( )

__wakeup() public méthode

public __wakeup ( )

addResultMapGroupBy() protected méthode

ResultMap with GroupBy property. Save object collection graph in a tree and collect the result later.
protected addResultMapGroupBy ( $resultMap, $row, $parent, &$resultObject ) : object
Résultat object result object.

applyResultMap() protected méthode

Apply result mapping.
protected applyResultMap ( $row, &$resultObject = null ) : object
Résultat object the result filled with data, null if not filled.

enquequePostSelect() protected méthode

Add nested result property to post select queue.
protected enquequePostSelect ( $select, $resultMap, $property, $row, $resultObject )

executeInsert() public méthode

Execute an insert statement. Fill the parameter object with the ouput parameters if any, also could return the insert generated key.
public executeInsert ( $connection, $parameter ) : string
Résultat string the insert generated key.

executePostSelect() protected méthode

Process 'select' result properties
protected executePostSelect ( $connection )

executeQueryForList() public méthode

Executes the SQL and retuns a List of result objects.
See also: executeQueryForList()
public executeQueryForList ( $connection, $parameter, $result = null, $skip, $max, $delegate = null ) : array
Résultat array a list of result objects

executeQueryForMap() public méthode

If valueProperty is null, the entire result object will be entered.
public executeQueryForMap ( $connection, $parameter, $keyProperty, $valueProperty = null, $skip, $max, $delegate = null ) : array
Résultat array An array of object containing the rows keyed by keyProperty.

executeQueryForObject() public méthode

Executes an SQL statement that returns a single row as an object of the type of the $result passed in as a parameter.
public executeQueryForObject ( $connection, $parameter, $result = null )

executeSQLQueryLimit() protected méthode

Execute SQL Query with limits.
protected executeSQLQueryLimit ( $connection, $command, $max, $skip ) : mixed
Résultat mixed record set if applicable.

executeSelectKey() protected méthode

Execute the select key statement, used to obtain last insert ID.
protected executeSelectKey ( $connection, $parameter, $selectKey ) : string
Résultat string last insert ID.

executeUpdate() public méthode

Return the number of rows effected.
public executeUpdate ( $connection, $parameter ) : integer
Résultat integer The number of rows effected.

fillArrayResultMap() protected méthode

Retrieve the result map as an array.
protected fillArrayResultMap ( $resultMap, $row, $resultObject ) : array
Résultat array array list of result objects.

fillDefaultResultMap() protected méthode

Fill the result map using default settings. If $resultMap is null the result object returned will be guessed from $resultObject.
protected fillDefaultResultMap ( $resultMap, $row, $resultObject ) : mixed
Résultat mixed the result object filled with data.

fillPropertyWithResultMap() protected méthode

Fills the property with result mapping results.
protected fillPropertyWithResultMap ( $resultMap, $row, &$resultObject ) : boolean
Résultat boolean true if the data was found, false otherwise.

fillResultArrayList() protected méthode

Apply the result to a TList or an array.
protected fillResultArrayList ( $row, $resultObject ) : object
Résultat object result filled with data.

fillResultClass() protected méthode

Fill the result using ResultClass, will creates new result object if required.
protected fillResultClass ( $resultClass, $row, $resultObject ) : object
Résultat object result object filled with data

fillResultMap() protected méthode

Fills the result object according to result mappings.
protected fillResultMap ( $resultMapName, $row, $parentGroup = null, &$resultObject = null ) : object
Résultat object result object filled with data.

fillResultObjectProperty() protected méthode

Apply the result to an object.
protected fillResultObjectProperty ( $row, $resultObject ) : object
Résultat object result filled with data.

getCommand() public méthode

public getCommand ( ) : TPreparedCommand
Résultat TPreparedCommand command to prepare SQL statements.

getID() public méthode

public getID ( ) : string
Résultat string Name used to identify the TMappedStatement amongst the others. This the name of the SQL statement by default.

getManager() public méthode

public getManager ( ) : TSqlMapper
Résultat TSqlMapper The SqlMap used by this MappedStatement

getPostGeneratedSelectKey() protected méthode

Gets the inserted row ID after executing an insert statement.
protected getPostGeneratedSelectKey ( $connection, $parameter ) : string
Résultat string last insert ID, null otherwise.

getPostSelectKeys() protected méthode

Finds in the post select property the SQL statement primary selection keys.
protected getPostSelectKeys ( $resultMap, $property, $row ) : array
Résultat array list of primary key values.

getPreGeneratedSelectKey() protected méthode

Gets the insert generated ID before executing an insert statement.
protected getPreGeneratedSelectKey ( $connection, $parameter ) : string
Résultat string new insert ID if pre-select key statement was executed, null otherwise.

getResultMapGroupKey() protected méthode

Gets the result 'group by' groupping key for each row.
protected getResultMapGroupKey ( $resultMap, $row ) : string
Résultat string groupping key.

getScalarResult() protected méthode

Converts the first array value to scalar value of given type.
protected getScalarResult ( $result, $type ) : mixed
Résultat mixed scalar value.

getSqlString() public méthode

public getSqlString ( )

getStatement() public méthode

public getStatement ( ) : TSqlMapStatement
Résultat Prado\Data\SqlMap\Configuration\TSqlMapStatement The SQL statment used by this MappedStatement

initialGroupByResults() protected méthode

Empty the group by results cache.
protected initialGroupByResults ( )

onExecuteQuery() public méthode

Raise the execute query event.
public onExecuteQuery ( $sql )

raiseRowDelegate() protected méthode

This method is invoked for each new list item. It is the responsibility of the handler to add the item to the list.
protected raiseRowDelegate ( $handler, $param )

runQueryForList() public méthode

This method should only be called by internal developers, consider using executeQueryForList() first.
See also: executeQueryForList()
public runQueryForList ( $connection, $parameter, $sql, $result, $delegate = null ) : array
Résultat array a list of result objects

runQueryForMap() public méthode

If valueProperty is null, the entire result object will be entered. This method should only be called by internal developers, consider using executeQueryForMap() first.
See also: executeQueryForMap()
public runQueryForMap ( $connection, $parameter, $command, $keyProperty, $valueProperty = null, $delegate = null ) : array
Résultat array An array of object containing the rows keyed by keyProperty.

runQueryForObject() public méthode

This method should only be called by internal developers, consider using executeQueryForObject() first.
See also: executeQueryForObject()
public runQueryForObject ( $connection, $command, &$result ) : object
Résultat object the object.

setObjectProperty() protected méthode

Set a property of the result object with appropriate value.
protected setObjectProperty ( $resultMap, $property, $row, &$resultObject )