
|
How to use multiple databases |
You may use multiple MySQL databases (Currently only MySQL database engine is supported).
The easiest way to use multiple databases is to specialize the class Site for different applications. You can specialize class Site by copying it to the application classFolder and including the new class file from the index.php script in the application folder. Then you can override loadSettings to connect to a different database. This allows you to use one database per application, or even one database per request.
If you want to use multiple databases in the same application and request, you may override the method getNewQueryHandler to return a QueryHandler that works on a different database. This allows you to use one database per peanuts class. The use of multiple databases during the same request has not yet been tested. It is certain that PntSqlSort and PntSqlFilter instances that require joins will not work with joins combining multiple databases in a single query. If you think that it is possible to solve that, please inform us.
Wherever you can override default behavior with respect to persistency, you can choose to use whatever database or other persistency technique you want. This allows you to completely control the combining of multiple databases.
|
|
User Contributed Notes