## Class TSqlMapManager

Description

TSqlMapManager class holds the sqlmap configuation result maps, statements parameter maps and a type handler factory.

Use SqlMapGateway property to obtain the gateway instance used for querying statements defined in the SqlMap configuration files.

     $conn = new TDbConnection($dsn,$dbuser,$dbpass);
     $manager = new TSqlMapManager($conn);
     $manager->configureXml('mydb-sqlmap.xml');
     $sqlmap = $manager->getSqlMapGateway();
     $result = $sqlmap->queryForObject('Products');

- since: 3.1
- version: $Id: TSqlMapManager.php 2659 2009-05-23 07:52:15Z godzilla80@gmx.net $
- author: Wei Zhuo <weizhuo[at]gmail[dot]com>

Located in /Data/SqlMap/TSqlMapManager.php (line 44)

    TComponent
       |
       --TSqlMapManager

Method Summary
TSqlMapManager __construct ([TDbConnection $connection = null], string 1)
void addCacheModel (TSqlMapCacheModel $cacheModel)
void addMappedStatement (IMappedStatement $statement, IMappedStatement 1)
void addParameterMap (TParameterMap $parameter)
void addResultMap (TResultMap $result)
void configureXml (string $file)
TSqlMapGateway createSqlMapGateway ()
void flushCacheModels ()
TChainedCacheDependency getCacheDependencies ()
TSqlMapCacheModel getCacheModel (string $name)
TDbConnection getDbConnection ()
IMappedStatement getMappedStatement (string $name)
TMap getMappedStatements ()
TParameterMap getParameterMap (string $name)
TMap getParameterMaps ()
TResultMap getResultMap (string $name)
TMap getResultMaps ()
TSqlMapGateway getSqlmapGateway ()
TTypeHandlerFactory getTypeHandlers ()
void setDbConnection (TDbConnection $conn)
Methods
Constructor __construct (line 61)

Constructor, create a new SqlMap manager.

- access: public

TSqlMapManager __construct ([TDbConnection $connection = null], string 1)

- string 1: configuration file.
- TDbConnection $connection: database connection

addCacheModel (line 244)

Adds a named cache.

- access: public
- throws: TSqlMapConfigurationException

void addCacheModel (TSqlMapCacheModel $cacheModel)

- TSqlMapCacheModel $cacheModel: the cache to add.

addMappedStatement (line 166)

Adds a (named) MappedStatement.

- access: public
- throws: TSqlMapDuplicateException

void addMappedStatement (IMappedStatement $statement, IMappedStatement 1)

- IMappedStatement 1: The statement to add
- string $statement: The key name

addParameterMap (line 231)

- access: public
- throws: TSqlMapDuplicateException

void addParameterMap (TParameterMap $parameter)

- TParameterMap $parameter: add a new parameter map to this SQLMap.

addResultMap (line 199)

- access: public
- throws: TSqlMapDuplicateException

void addResultMap (TResultMap $result)

- TResultMap $result: add a new result map to this SQLMap

configureXml (line 111)

Loads and parses the SqlMap configuration file.

- access: public

void configureXml (string $file)

- string $file: xml configuration file.

createSqlMapGateway (line 134)

Configures the current TSqlMapManager using the given xml configuration file defined in ConfigFile.

- return: create and configure a new TSqlMapGateway.
- access: protected

TSqlMapGateway createSqlMapGateway ()
flushCacheModels (line 268)

Flushes all cached objects that belong to this SqlMap

- access: public

void flushCacheModels ()
getCacheDependencies (line 121)

- access: public
- since: 3.1.5

TChainedCacheDependency getCacheDependencies ()
getCacheModel (line 258)

Gets a cache by name

- return: the cache object.
- access: public
- throws: TSqlMapConfigurationException

TSqlMapCacheModel getCacheModel (string $name)

- string $name: the name of the cache to get.

getDbConnection (line 82)

- return: default database connection
- access: public

TDbConnection getDbConnection ()
getMappedStatement (line 153)

Gets a MappedStatement by name.

- return: The MappedStatement
- access: public
- throws: TSqlMapUndefinedException

IMappedStatement getMappedStatement (string $name)

- string $name: The name of the statement.

getMappedStatements (line 142)

- return: mapped statements collection.
- access: public

TMap getMappedStatements ()
getParameterMap (line 220)

- return: the parameter with given ID.
- access: public
- throws: TSqlMapUndefinedException

TParameterMap getParameterMap (string $name)

- string $name: parameter map ID name.

getParameterMaps (line 210)

- return: parameter maps collection.
- access: public

TMap getParameterMaps ()
getResultMap (line 188)

Gets a named result map

- return: the result map.
- access: public
- throws: TSqlMapUndefinedException

TResultMap getResultMap (string $name)

- string $name: result name.

getResultMaps (line 177)

- return: result maps collection.
- access: public

TMap getResultMaps ()
getSqlmapGateway (line 100)

- return: SqlMap gateway.
- access: public

TSqlMapGateway getSqlmapGateway ()
getTypeHandlers (line 90)

- return: The TypeHandlerFactory
- access: public

TTypeHandlerFactory getTypeHandlers ()
setDbConnection (line 74)

- access: public

void setDbConnection (TDbConnection $conn)

- TDbConnection $conn: default database connection

#### Inherited Methods

Inherited From TComponent

> TComponent::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Documentation generated on Mon, 22 Feb 2010 12:18:42 +0000 by phpDocumentor 1.3.0RC4