## 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 2541 2008-10-21 15:05:13Z qiang.xue $
- author: Wei Zhuo <weizhuo[at]gmail[dot]com>

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

    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 ()
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 59)

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 230)

Adds a named cache.

- access: public
- throws: TSqlMapConfigurationException

void addCacheModel (TSqlMapCacheModel $cacheModel)

- TSqlMapCacheModel $cacheModel: the cache to add.

addMappedStatement (line 152)

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 217)

- access: public
- throws: TSqlMapDuplicateException

void addParameterMap (TParameterMap $parameter)

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

addResultMap (line 185)

- access: public
- throws: TSqlMapDuplicateException

void addResultMap (TResultMap $result)

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

configureXml (line 109)

Loads and parses the SqlMap configuration file.

- access: public

void configureXml (string $file)

- string $file: xml configuration file.

createSqlMapGateway (line 120)

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 254)

Flushes all cached objects that belong to this SqlMap

- access: public

void flushCacheModels ()
getCacheModel (line 244)

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 80)

- return: default database connection
- access: public

TDbConnection getDbConnection ()
getMappedStatement (line 139)

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 128)

- return: mapped statements collection.
- access: public

TMap getMappedStatements ()
getParameterMap (line 206)

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

TParameterMap getParameterMap (string $name)

- string $name: parameter map ID name.

getParameterMaps (line 196)

- return: parameter maps collection.
- access: public

TMap getParameterMaps ()
getResultMap (line 174)

Gets a named result map

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

TResultMap getResultMap (string $name)

- string $name: result name.

getResultMaps (line 163)

- return: result maps collection.
- access: public

TMap getResultMaps ()
getSqlmapGateway (line 98)

- return: SqlMap gateway.
- access: public

TSqlMapGateway getSqlmapGateway ()
getTypeHandlers (line 88)

- return: The TypeHandlerFactory
- access: public

TTypeHandlerFactory getTypeHandlers ()
setDbConnection (line 72)

- 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 Sun, 11 Jan 2009 20:23:54 -0500 by phpDocumentor 1.3.0RC4