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.

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

  • since: 3.1
  • version: $Id: TSqlMapManager.php 1579 2006-12-20 03:15:04Z wei $
  • 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)
TParameterMap getParameterMap (string $name)
TResultMap getResultMap (string $name)
TTypeHandlerFactory getTypeHandlers ()
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)
addMappedStatement (line 152)

Adds a (named) MappedStatement.

  • access: public
  • throws: TSqlMapDuplicateException
void addMappedStatement (IMappedStatement $statement, IMappedStatement 1)
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)

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, 21 Apr 2008 11:36:17 -0400 by phpDocumentor 1.3.0RC4