Quick search:


How to use an other database then MySQL

To use other databases them MySQL, you need version 1.4.beta1 or higher. This version delegates database-specific function to the QueryHandler. The simpelest way to use a different database is to modify the class QueryHandler in the root application folder to extend a different superclass. The following superclasses are available:

PntMysqlDao is the default. It accesses MySQL through the old procedural mysql interface. It should work with MySQL 3.23.2 or higher. This is currently the only Dao class that supports addDbFieldProps.

PntSqliteDao accesses SqlLite through the procedural interface. It has been tested with version 2.8.17, but it should work with other versions that are supported by this php interface too. For version 3 you need to use PntPdoDao. PntSqliteDao does not support the use of addDbFieldProps.

PntPdoDao accesses a driver of your choice through the PDO interface. It is tested with MySQL 4.1 but should work with other databases too. Known limitations are:

  • phpPeanuts relies on the quote method to be implemented by the driver. It appears that ODBC drivers do not implement this method. If you can write a reliable quote method yourself you van subclass PntPdoDao and add your own quote method there.
  • phpPeanuts uses explicit JOIN syntax, some databases do not support this syntax (for example oracle 8 and lower)
  • PntPdoDao does not support dataSeek. PhpPeanuts does not need it, but if your application relies on it, it will not work with PntPdoDao.
  • does not support addDbFieldProps

Please inform us on your test results with phpPeanuts and other databases the MySQL on the forum!

Furthermore you can develop your own subclass of PntDao. You can use the above subclasses as your example. If you do not need dataSeek and want to use the faster ubuffered queries you may look at PntPdoDao::supportsSelectRowCount. If you want to use prepared statements with parameter binding you may look at the methods of PntPdoDao that use the parameters member variable. By overriding methods inherited from PntDao you may make phpPeanuts use parameter binding, except for PntSqlFilters and therefore PntFilterFormPart. You therefore have ot implement the quote method anyway.  Please consider donating your PntDao subclass to the phpPeanuts community.