Methods summary
public
string
|
#
getID( )
Returns
string Name used to identify the TMappedStatement amongst the others. This the name of
the SQL statement by default.
Implementation of
|
public
TSqlMapStatement
|
#
getStatement( )
Returns
Implementation of
|
public
TSqlMapper
|
#
getManager( )
Returns
TSqlMapper The SqlMap used by this MappedStatement
Implementation of
|
public
TPreparedCommand
|
|
protected
|
#
initialGroupByResults( )
Empty the group by results cache.
Empty the group by results cache.
|
public
|
|
public
|
|
protected
mixed
|
#
executeSQLQueryLimit( IDbConnection $connection, array $command, mixed $max, mixed $skip )
Execute SQL Query with limits.
Execute SQL Query with limits.
Parameters
- $connection
IDbConnection database connection
- $command
array SQL statement and parameters.
- $max
- $skip
Returns
mixed record set if applicable.
Throws
|
public
array
|
#
executeQueryForList( IDbConnection $connection, mixed $parameter, object $result = null, integer $skip = -1, integer $max = -1, callable $delegate = null )
Executes the SQL and retuns a List of result objects.
Executes the SQL and retuns a List of result objects.
Parameters
- $connection
IDbConnection database connection
- $parameter
mixed The object used to set the parameters in the SQL.
- $result
object result collection object.
- $skip
integer The number of rows to skip over.
- $max
integer The maximum number of rows to return.
- $delegate
callable row delegate handler
Returns
array a list of result objects
See
Implementation of
|
public
array
|
#
runQueryForList( IDbConnection $connection, mixed $parameter, array $sql, object $result, integer $delegate = null )
Executes the SQL and retuns a List of result objects.
Executes the SQL and retuns a List of result objects.
This method should only be called by internal developers, consider using
executeQueryForList() first.
Parameters
- $connection
IDbConnection database connection
- $parameter
mixed The object used to set the parameters in the SQL.
- $sql
array SQL string and subsititution parameters.
- $result
object result collection object.
- $delegate
integer The number of rows to skip over.
Returns
array a list of result objects
See
|
public
array
|
#
executeQueryForMap( IDbConnection $connection, mixed $parameter, string $keyProperty, string $valueProperty = null, callable $skip = -1, mixed $max = -1, mixed $delegate = null )
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. If valueProperty
is null, the entire result object will be entered.
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. If valueProperty
is null, the entire result object will be entered.
Parameters
- $connection
IDbConnection database connection
- $parameter
mixed The object used to set the parameters in the SQL.
- $keyProperty
string The property of the result object to be used as the key.
- $valueProperty
string The property of the result object to be used as the value (or null).
- $skip
callable row delegate handler
- $max
- $delegate
Returns
array An array of object containing the rows keyed by keyProperty.
Implementation of
|
public
array
|
#
runQueryForMap( IDbConnection $connection, mixed $parameter, array $command, string $keyProperty, string $valueProperty = null, callable $delegate = null )
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. If valueProperty
is null, the entire result object will be entered.
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. If valueProperty
is null, the entire result object will be entered.
This method should only be called by internal developers, consider using
executeQueryForMap() first.
Parameters
- $connection
IDbConnection database connection
- $parameter
mixed The object used to set the parameters in the SQL.
- $command
array SQL string and subsititution parameters.
- $keyProperty
string The property of the result object to be used as the key.
- $valueProperty
string The property of the result object to be used as the value (or null).
- $delegate
callable row delegate, a callback function
Returns
array An array of object containing the rows keyed by keyProperty.
See
|
protected
|
#
raiseRowDelegate( object $handler, mixed $param )
Raises delegate handler. This method is invoked for each new list item. It is
the responsibility of the handler to add the item to the list.
Raises delegate handler. This method is invoked for each new list item. It is
the responsibility of the handler to add the item to the list.
Parameters
- $handler
object event parameter
- $param
|
public
mixed
|
#
executeQueryForObject( IDbConnection $connection, mixed $parameter, mixed $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.
Executes an SQL statement that returns a single row as an object of the type
of the $result passed in as a parameter.
Parameters
- $connection
IDbConnection database connection
- $parameter
mixed The parameter data (object, arrary, primitive) used to set the parameters in the
SQL
- $result
mixed The result object.
Returns
mixed ${return}
Implementation of
|
public
object
|
#
runQueryForObject( IDbConnection $connection, array $command, object & $result )
Executes an SQL statement that returns a single row as an object of the type
of the $result passed in as a parameter.
Executes an SQL statement that returns a single row as an object of the type
of the $result passed in as a parameter.
This method should only be called by internal developers, consider using
executeQueryForObject() first.
Parameters
- $connection
IDbConnection database connection
- $command
array SQL string and subsititution parameters.
- $result
object The result object.
Returns
object the object.
See
|
public
string
|
#
executeInsert( IDbConnection $connection, mixed $parameter )
Execute an insert statement. Fill the parameter object with the ouput
parameters if any, also could return the insert generated key.
Execute an insert statement. Fill the parameter object with the ouput
parameters if any, also could return the insert generated key.
Parameters
- $connection
IDbConnection database connection
- $parameter
mixed The parameter object used to fill the statement.
Returns
string the insert generated key.
|
protected
string
|
#
getPreGeneratedSelectKey( IDbConnection $connection, mixed $parameter )
Gets the insert generated ID before executing an insert statement.
Gets the insert generated ID before executing an insert statement.
Parameters
- $connection
IDbConnection database connection
- $parameter
mixed insert statement parameter.
Returns
string new insert ID if pre-select key statement was executed, null otherwise.
|
protected
string
|
#
getPostGeneratedSelectKey( IDbConnection $connection, mixed $parameter )
Gets the inserted row ID after executing an insert statement.
Gets the inserted row ID after executing an insert statement.
Parameters
- $connection
IDbConnection database connection
- $parameter
mixed insert statement parameter.
Returns
string last insert ID, null otherwise.
|
protected
string
|
#
executeSelectKey( IDbConnection $connection, mixed $parameter, TSqlMapSelectKey $selectKey )
Execute the select key statement, used to obtain last insert ID.
Execute the select key statement, used to obtain last insert ID.
Parameters
- $connection
IDbConnection database connection
- $parameter
mixed insert statement parameter
- $selectKey
TSqlMapSelectKey
select key statement
Returns
string last insert ID.
|
public
integer
|
#
executeUpdate( IDbConnection $connection, mixed $parameter )
Execute an update statement. Also used for delete statement. Return the
number of rows effected.
Execute an update statement. Also used for delete statement. Return the
number of rows effected.
Parameters
- $connection
IDbConnection database connection
- $parameter
mixed The object used to set the parameters in the SQL.
Returns
integer The number of rows effected.
Implementation of
|
protected
|
#
executePostSelect( IDbConnection $connection )
Process 'select' result properties
Process 'select' result properties
Parameters
- $connection
IDbConnection database connection
|
public
|
#
onExecuteQuery( array $sql )
Raise the execute query event.
Raise the execute query event.
Parameters
- $sql
array prepared SQL statement and subsititution parameters
|
protected
object
|
#
applyResultMap( array $row, object & $resultObject = null )
Apply result mapping.
Parameters
- $row
array a result set row retrieved from the database
- $resultObject
object the result object, will create if necessary.
Returns
object the result filled with data, null if not filled.
|
protected
object
|
#
fillResultClass( string $resultClass, array $row, object $resultObject )
Fill the result using ResultClass, will creates new result object if
required.
Fill the result using ResultClass, will creates new result object if
required.
Parameters
- $resultClass
string result object class name
- $row
array a result set row retrieved from the database
- $resultObject
object the result object, will create if necessary.
Returns
object result object filled with data
|
protected
object
|
#
fillResultArrayList( array $row, object $resultObject )
Apply the result to a TList or an array.
Apply the result to a TList or an array.
Parameters
- $row
array a result set row retrieved from the database
- $resultObject
object result object, array or list
Returns
object result filled with data.
|
protected
object
|
#
fillResultObjectProperty( array $row, object $resultObject )
Apply the result to an object.
Apply the result to an object.
Parameters
- $row
array a result set row retrieved from the database
- $resultObject
object result object, array or list
Returns
object result filled with data.
|
protected
object
|
#
fillResultMap( string $resultMapName, array $row, object $parentGroup = null, mixed & $resultObject = null )
Fills the result object according to result mappings.
Fills the result object according to result mappings.
Parameters
- $resultMapName
string result map name.
- $row
array a result set row retrieved from the database
- $parentGroup
object result object to fill, will create new instances if required.
- $resultObject
Returns
object result object filled with data.
|
protected
object
|
#
addResultMapGroupBy( TResultMap $resultMap, array $row, object $parent, mixed & $resultObject )
ResultMap with GroupBy property. Save object collection graph in a tree and
collect the result later.
ResultMap with GroupBy property. Save object collection graph in a tree and
collect the result later.
Parameters
- $resultMap
TResultMap
result mapping details.
- $row
array a result set row retrieved from the database
- $parent
object the result object
- $resultObject
Returns
object result object.
|
protected
string
|
#
getResultMapGroupKey( TResultMap $resultMap, array $row )
Gets the result 'group by' groupping key for each row.
Gets the result 'group by' groupping key for each row.
Parameters
- $resultMap
TResultMap
result mapping details.
- $row
array a result set row retrieved from the database
Returns
string groupping key.
|
protected
mixed
|
#
fillDefaultResultMap( TResultMap $resultMap, array $row, object $resultObject )
Fill the result map using default settings. If $resultMap is null
the result object returned will be guessed from $resultObject.
Fill the result map using default settings. If $resultMap is null
the result object returned will be guessed from $resultObject.
Parameters
- $resultMap
TResultMap
result mapping details.
- $row
array a result set row retrieved from the database
- $resultObject
object the result object
Returns
mixed the result object filled with data.
|
protected
array
|
#
fillArrayResultMap( TResultMap $resultMap, array $row, object $resultObject )
Retrieve the result map as an array.
Retrieve the result map as an array.
Parameters
- $resultMap
TResultMap
result mapping details.
- $row
array a result set row retrieved from the database
- $resultObject
object the result object
Returns
array array list of result objects.
|
protected
mixed
|
#
getScalarResult( array $result, string $type )
Converts the first array value to scalar value of given type.
Converts the first array value to scalar value of given type.
Parameters
- $result
array list of results
- $type
string scalar type.
Returns
mixed scalar value.
|
protected
|
#
setObjectProperty( TResultMap $resultMap, TResultProperty $property, array $row, object & $resultObject )
Set a property of the result object with appropriate value.
Set a property of the result object with appropriate value.
Parameters
- $resultMap
TResultMap
result mapping details.
- $property
TResultProperty
the result property to fill.
- $row
array a result set row retrieved from the database
- $resultObject
object the result object
|
protected
|
#
enquequePostSelect( string $select, TResultMap $resultMap, TResultProperty $property, array $row, object $resultObject )
Add nested result property to post select queue.
Add nested result property to post select queue.
Parameters
- $select
string post select statement ID
- $resultMap
TResultMap
current result mapping details.
- $property
TResultProperty
current result property.
- $row
array a result set row retrieved from the database
- $resultObject
object the result object
|
protected
array
|
#
getPostSelectKeys( TResultMap $resultMap, TResultProperty $property, array $row )
Finds in the post select property the SQL statement primary selection
keys.
Finds in the post select property the SQL statement primary selection
keys.
Parameters
Returns
array list of primary key values.
|
protected
boolean
|
#
fillPropertyWithResultMap( TResultMap $resultMap, array $row, object & $resultObject )
Fills the property with result mapping results.
Fills the property with result mapping results.
Parameters
- $resultMap
TResultMap
nested result mapping details.
- $row
array a result set row retrieved from the database
- $resultObject
object the result object
Returns
boolean true if the data was found, false otherwise.
|
public
|
#
__wakeup( )
Do not call this method. This is a PHP magic method that will be called
automatically after any unserialization; it can perform reinitialization tasks
on the object.
Do not call this method. This is a PHP magic method that will be called
automatically after any unserialization; it can perform reinitialization tasks
on the object.
Overrides
|
public
|
#
__sleep( )
Returns an array with the names of all variables of that object that should
be serialized. Do not call this method. This is a PHP magic method that will be
called automatically prior to any serialization.
Returns an array with the names of all variables of that object that should
be serialized. Do not call this method. This is a PHP magic method that will be
called automatically prior to any serialization.
Overrides
|