- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml
Classes:
TInvalidPropertyException
TLazyLoadList
TObjectProxy
TPropertyAccess
TSqlMapApplicationCache
TSqlMapCache
TSqlMapConfig
TSqlMapConfigurationException
TSqlMapDuplicateException
TSqlMapException
TSqlMapExecutionException
TSqlMapFifoCache
TSqlMapGateway
TSqlMapLruCache
TSqlMapManager
TSqlMapPagedList
TSqlMapTypeHandler
TSqlMapTypeHandlerRegistry
TSqlMapUndefinedException

Keyword

# Class TSqlMapManager

    TComponent
       |
       --TSqlMapManager

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
Author: Wei Zhuo <weizhuo[at]gmail[dot]com>

Constructor Summary
public | __construct Array Constructor, create a new SqlMap manager.

Method Summary
void | addCacheModel ( TSqlMapCacheModel $cacheModel) Adds a named cache.
void | addMappedStatement ( IMappedStatement $statement, IMappedStatement 1) Adds a (named) MappedStatement.
void | addParameterMap ( TParameterMap $parameter)
void | addResultMap ( TResultMap $result)
void | configureXml ( string $file) Loads and parses the SqlMap configuration file.
protected TSqlMapGateway | createSqlMapGateway () Configures the current TSqlMapManager using the given xml configuration file defined in ConfigFile.
void | flushCacheModels () Flushes all cached objects that belong to this SqlMap
TChainedCacheDependency | getCacheDependencies ()
TSqlMapCacheModel | getCacheModel ( string $name) Gets a cache by name
TDbConnection | getDbConnection ()
IMappedStatement | getMappedStatement ( string $name) Gets a MappedStatement by name.
TMap | getMappedStatements ()
TParameterMap | getParameterMap ( string $name)
TMap | getParameterMaps ()
TResultMap | getResultMap ( string $name) Gets a named result map
TMap | getResultMaps ()
TSqlMapGateway | getSqlmapGateway ()
TTypeHandlerFactory | getTypeHandlers ()
void | setDbConnection ( TDbConnection $conn)

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

Constructor Details

## __construct

public __construct | Array

Constructor, create a new SqlMap manager.

Method Details

## addCacheModel

public void addCacheModel | (TSqlMapCacheModel $cacheModel )

Adds a named cache.

Input
TSqlMapCacheModel | $cacheModel | the cache to add.
Output
Exception
throws | TSqlMapConfigurationException

## addMappedStatement

public void addMappedStatement | (IMappedStatement $statement , IMappedStatement 1 )

Adds a (named) MappedStatement.

Input
IMappedStatement | $statement | The key name
IMappedStatement | 1 | The statement to add
Output
Exception
throws | TSqlMapDuplicateException

## addParameterMap

public void addParameterMap | (TParameterMap $parameter )

Input
TParameterMap | $parameter | add a new parameter map to this SQLMap.
Output
Exception
throws | TSqlMapDuplicateException

## addResultMap

public void addResultMap | (TResultMap $result )

Input
TResultMap | $result | add a new result map to this SQLMap
Output
Exception
throws | TSqlMapDuplicateException

## configureXml

public void configureXml | (string $file )

Loads and parses the SqlMap configuration file.

Input
string | $file | xml configuration file.
Output
Exception

## createSqlMapGateway

protected TSqlMapGateway createSqlMapGateway | ()

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

Output
TSqlMapGateway | create and configure a new TSqlMapGateway.
Exception

## flushCacheModels

public void flushCacheModels | ()

Flushes all cached objects that belong to this SqlMap

Output
Exception

## getCacheDependencies

public TChainedCacheDependency getCacheDependencies | ()

Output
Exception

## getCacheModel

public TSqlMapCacheModel getCacheModel | (string $name )

Gets a cache by name

Input
string | $name | the name of the cache to get.
Output
TSqlMapCacheModel | the cache object.
Exception
throws | TSqlMapConfigurationException

## getDbConnection

public TDbConnection getDbConnection | ()

Output
TDbConnection | default database connection
Exception

## getMappedStatement

public IMappedStatement getMappedStatement | (string $name )

Gets a MappedStatement by name.

Input
string | $name | The name of the statement.
Output
IMappedStatement | The MappedStatement
Exception
throws | TSqlMapUndefinedException

## getMappedStatements

public TMap getMappedStatements | ()

Output
TMap | mapped statements collection.
Exception

## getParameterMap

public TParameterMap getParameterMap | (string $name )

Input
string | $name | parameter map ID name.
Output
TParameterMap | the parameter with given ID.
Exception
throws | TSqlMapUndefinedException

## getParameterMaps

public TMap getParameterMaps | ()

Output
TMap | parameter maps collection.
Exception

## getResultMap

public TResultMap getResultMap | (string $name )

Gets a named result map

Input
string | $name | result name.
Output
TResultMap | the result map.
Exception
throws | TSqlMapUndefinedException

## getResultMaps

public TMap getResultMaps | ()

Output
TMap | result maps collection.
Exception

## getSqlmapGateway

public TSqlMapGateway getSqlmapGateway | ()

Output
TSqlMapGateway | SqlMap gateway.
Exception

## getTypeHandlers

public TTypeHandlerFactory getTypeHandlers | ()

Output
TTypeHandlerFactory | The TypeHandlerFactory
Exception

## setDbConnection

public void setDbConnection | (TDbConnection $conn )

Input
TDbConnection | $conn | default database connection
Output
Exception