The SQLMap DataMapper API provides four core functions:
The API also provides support for retrieving paginated lists and managing transactions.
An XML document is a wonderful tool for describing a database configuration , but you can't execute XML. In order to use the SQLMap configuration and definitions in your PHP application, you need a class you can call.
The framework provides service methods that you can call which read the configuration file (and any of its definition files) and builds a TSqlMapper object. The TSqlMapper object provides access to the rest of the framework. The following example shows a singleton TMapper that is similar to the one bundled with the framework.
To obtain the TSqlMapper instance, first configure the mapper once.
The TDomSqlMapBuilder object will go throught the the sqlmap.config file and build a TSqlMapper instance. To use TSqlMapper in your application, specify one of the TSqlMapper methods. Here's an example:
If you need access to more than one database from the same application, create a DataMapper configuration file for that database and another Mapper class to go with it.
If you find that you already have loaded your DataMapper configuration information as a SimpleXMLElement instance within your application, the TDomSqlMapBuilder provides Configure overloads for those types as well.