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:
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.

  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
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
Configures the current TSqlMapManager using the given xml configuration file defined in ConfigFile.
void
Flushes all cached objects that belong to this SqlMap
TChainedCacheDependency
TSqlMapCacheModel
getCacheModel ( string $name)
Gets a cache by name
TDbConnection
IMappedStatement
getMappedStatement ( string $name)
Gets a MappedStatement by name.
TMap
TParameterMap
getParameterMap ( string $name)
TMap
TResultMap
getResultMap ( string $name)
Gets a named result map
TMap
TSqlMapGateway
TTypeHandlerFactory
void
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$cacheModelthe cache to add.
Output
Exception
throwsTSqlMapConfigurationException

addMappedStatement

public void addMappedStatement (IMappedStatement $statement , IMappedStatement 1 )

Adds a (named) MappedStatement.

Input
IMappedStatement$statementThe key name
IMappedStatement1The statement to add
Output
Exception
throwsTSqlMapDuplicateException

addParameterMap

public void addParameterMap (TParameterMap $parameter )

Input
TParameterMap$parameteradd a new parameter map to this SQLMap.
Output
Exception
throwsTSqlMapDuplicateException

addResultMap

public void addResultMap (TResultMap $result )

Input
TResultMap$resultadd a new result map to this SQLMap
Output
Exception
throwsTSqlMapDuplicateException

configureXml

public void configureXml (string $file )

Loads and parses the SqlMap configuration file.

Input
string$filexml 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$namethe name of the cache to get.
Output
TSqlMapCacheModel the cache object.
Exception
throwsTSqlMapConfigurationException

getDbConnection

public TDbConnection getDbConnection ()

Output
TDbConnection default database connection
Exception

getMappedStatement

public IMappedStatement getMappedStatement (string $name )

Gets a MappedStatement by name.

Input
string$nameThe name of the statement.
Output
IMappedStatement The MappedStatement
Exception
throwsTSqlMapUndefinedException

getMappedStatements

public TMap getMappedStatements ()

Output
TMap mapped statements collection.
Exception

getParameterMap

public TParameterMap getParameterMap (string $name )

Input
string$nameparameter map ID name.
Output
TParameterMap the parameter with given ID.
Exception
throwsTSqlMapUndefinedException

getParameterMaps

public TMap getParameterMaps ()

Output
TMap parameter maps collection.
Exception

getResultMap

public TResultMap getResultMap (string $name )

Gets a named result map

Input
string$nameresult name.
Output
TResultMap the result map.
Exception
throwsTSqlMapUndefinedException

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$conndefault database connection
Output
Exception