Skip to content

Embedding PPA

sweiguny edited this page Aug 18, 2014 · 6 revisions

To use PPA with all its features in your project, you simply need to include the PPA.php file and initialize PPA.

require_once '/<path to ppa>/PPA.php';

\PPA\PPA::init($dataSourceName, $username, $password);

PPA takes the complete connection management over. For connecting PPA uses the PDO extension and, therefore, the same credentials for its initialization as the PDO constructor. In an example: \PPA\PPA::init("mysql:dbname=ppa;host=127.0.0.1;charset=utf8", "ppa", "ppa");

PPA also handles class loading for you. It should be flexible enough to work in every directory of your webspace.

Important: PPA will assure that the database connection is running in auto-commit-mode. On starting transactions, the auto-commit-mode is turned off and on ending transactions, the auto-commit-mode is turned on again. When there are open transactions during an exception or shutdown, the transaction is rolled back.

You can also set up logging for PPA...