PHP Class Prado\Data\SqlMap\TSqlMapGateway

# execute an update query (including insert and delete). # execute a select query for a single object # execute a select query for a list of objects This class should be instantiated from a TSqlMapManager instance.
Since: 3.1
Inheritance: extends Prado\TComponent
Show file Open project: pradosoft/prado

Public Methods

Method Description
__construct ( $manager )
delete ( $statementName, $parameter = null ) : integer Executes a Sql DELETE statement. Delete returns the number of rows effected.
flushCaches ( ) Flushes all cached objects that belong to this SqlMap
getDbConnection ( ) : TDbConnection
getSqlMapManager ( ) : TSqlMapManager
insert ( $statementName, $parameter = null ) : mixed Executes a Sql INSERT statement.
queryForList ( $statementName, $parameter = null, $result = null, $skip, $max ) : TList Executes a Sql SELECT statement that returns data to populate a number of result objects.
queryForMap ( $statementName, $parameter = null, $keyProperty = null, $valueProperty = null, $skip, $max ) : TMap 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.
queryForMapWithRowDelegate ( $statementName, $delegate, $parameter = null, $keyProperty = null, $valueProperty = null, $skip, $max ) : TMap Runs a query with a custom object that gets a chance to deal with each row as it is processed.
queryForObject ( $statementName, $parameter = null, $result = null ) : object Executes a Sql SELECT statement that returns that returns data to populate a single object instance.
queryForPagedList ( $statementName, $parameter = null, $pageSize = 10, $page ) : TPagedList Executes the SQL and retuns a subset of the results in a dynamic TPagedList that can be used to automatically scroll through results from a database table.
queryForPagedListWithRowDelegate ( $statementName, $delegate, $parameter = null, $pageSize = 10, $page ) : TPagedList Executes the SQL and retuns a subset of the results in a dynamic TPagedList that can be used to automatically scroll through results from a database table.
queryWithRowDelegate ( $statementName, $delegate, $parameter = null, $result = null, $skip, $max ) : TList Runs a query for list with a custom object that gets a chance to deal with each row as it is processed.
registerTypeHandler ( $typeHandler )
update ( $statementName, $parameter = null ) : integer Executes a Sql UPDATE statement.

Method Details

__construct() public method

public __construct ( $manager )

delete() public method

Executes a Sql DELETE statement. Delete returns the number of rows effected.
public delete ( $statementName, $parameter = null ) : integer
return integer The number of rows effected.

flushCaches() public method

Flushes all cached objects that belong to this SqlMap
public flushCaches ( )

getDbConnection() public method

public getDbConnection ( ) : TDbConnection
return TDbConnection database connection.

getSqlMapManager() public method

public getSqlMapManager ( ) : TSqlMapManager
return TSqlMapManager sqlmap manager.

insert() public method

Insert is a bit different from other update methods, as it provides facilities for returning the primary key of the newly inserted row (rather than the effected rows), The parameter object is generally used to supply the input data for the INSERT values.
public insert ( $statementName, $parameter = null ) : mixed
return mixed The primary key of the newly inserted row. This might be automatically generated by the RDBMS, or selected from a sequence table or other source.

queryForList() public method

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.
public queryForList ( $statementName, $parameter = null, $result = null, $skip, $max ) : TList
return TList A List of result objects.

queryForMap() public method

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.
public queryForMap ( $statementName, $parameter = null, $keyProperty = null, $valueProperty = null, $skip, $max ) : TMap
return TMap Array object containing the rows keyed by keyProperty.

queryForMapWithRowDelegate() public method

Example: $sqlmap->queryForMapWithRowDelegate('getAccounts', array($this, 'rowHandler'));
public queryForMapWithRowDelegate ( $statementName, $delegate, $parameter = null, $keyProperty = null, $valueProperty = null, $skip, $max ) : TMap
return TMap Array object containing the rows keyed by keyProperty.

queryForObject() public method

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.
public queryForObject ( $statementName, $parameter = null, $result = null ) : object
return object A single result object populated with the result set data.

queryForPagedList() public method

Executes the SQL and retuns a subset of the results in a dynamic TPagedList that can be used to automatically scroll through results from a database table.
public queryForPagedList ( $statementName, $parameter = null, $pageSize = 10, $page ) : TPagedList
return TPagedList A PaginatedList of beans containing the rows.

queryForPagedListWithRowDelegate() public method

Runs paged list query with row delegate Example: $sqlmap->queryForPagedListWithRowDelegate('getAccounts', array($this, 'rowHandler'));
public queryForPagedListWithRowDelegate ( $statementName, $delegate, $parameter = null, $pageSize = 10, $page ) : TPagedList
return TPagedList A PaginatedList of beans containing the rows.

queryWithRowDelegate() public method

Example: $sqlmap->queryWithRowDelegate('getAccounts', array($this, 'rowHandler'));
public queryWithRowDelegate ( $statementName, $delegate, $parameter = null, $result = null, $skip, $max ) : TList
return TList A List of result objects.

registerTypeHandler() public method

public registerTypeHandler ( $typeHandler )

update() public method

Update can also be used for any other update statement type, such as inserts and deletes. Update returns the number of rows effected. The parameter object is generally used to supply the input data for the UPDATE values as well as the WHERE clause parameter(s).
public update ( $statementName, $parameter = null ) : integer
return integer The number of rows effected.