|
FAQ
- How does MDB2 compare to DB, ADODB .. etc?
- MDB2 has much more feature rich than any known database abstraction layer for PHP. Performance is also very high, comparable with the fastest ones available, especially when using a bytecode cache like pecl.php.net/apc. Furthermore MDB2 is very extensible letting you easily add new functionality. Finally MDB2 will be very API compatible with the upcoming pdo extension. You can find more information on the relative performance of MDB2 and feature set here and here
- How hard is it to port from DB to MDB2
- It should not take very long at all. There are some differences in the method names and parameter orders. This blog post covers the main aspects. Looking at the PEAR DB wrapper might give alot of pointers as well.
- How does MDB2 compare to MDB?
- MDB2 has improved performance. The API has been reduced to be more consistent and compact. Finally the code has been restructure so that more funtionality is only ondemand. This reduces the amount of code needed to be loaded and also makes MDB2 more flexible since the modules with the ondemand code can be changed more easily.
- How does MDB2 compare to ext/pdo?
- The upcoming pdo extension is currently targeted to be bundled with php 5.1. It is written in C and will therefore be faster than any other solution available, very close in performance to the current set of database extensions in php and maybe faster than some due to making heavy use of php5's new features. However the pdo extension is mainly concerned with unifiying the client API and not so much in actually abstracting the data that you exchange with the database server. It will probably only abstract things like error codes and prepare/execute. It might feature abstraction for cursors and LOB at a later stage of development. Actually the MDB2 development team was involved in the pdo extension development from day one. And from day one it was decided to leave higher levels of abstraction to a separate layer implemented in php userland. Once pdo matures there will likely be separate pdo based drivers that should perform much faster (and be much reduced in code size too). To conclude MDB2 and pdo are complimentary efforts.
- Does MDB2 require me to use only specific datatypes?
- No, all of the datatype handling is entirely optional. If you want your code to be portable you will probably however need to use the datatype handling.
- MDB2 uses XML. But XML is slow!?
- The XML based schema handling is entirely optional. It is a convinience tool to be able to manage your database schema in an RDBMS independant form. It also allows you to automatically generate the necessary alter statements when you change your database schema. However no XML is read at runtime when you are not using the MDB2 schema manager, which you only have to do if you want to change the structure of your database based on the XML schema definition you have created. As a matter of fact the schema management has been spun out into its own package MDB2_Schema
- Why do empty strings end up as NULL in the database? Why do I get an NULL not allowed in NOT NULL text fields eventhough the default value is ""?
- The problem is that for some RDBMS (most noteably Oracle) an empty string is NULL. Therefore MDB2 provides a portability option to enforce the same behaviour on all RDBMS.
- Since all portability options are enabled by default you will have to disable the feature if you dont want to have this behaviour: $mdb2->setOption('portability', MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL);
- Does MDB2 'text' datatype support Unicode ?
- Basic support for character sets is available using the optional "charset" DSN parameter. Progress on CharacterSet support in other aspects of MDB2 is slowly progressing.
- I have installed MDB2, but I get an "unable to find package" error?
- For MDB2 you need to install every driver separately. So in order to connect to PostGreSQL you also need to install the MDB2_Driver_pgsql package.
- How can I load a module? How can I access one of the methods in the Manager, Datatype, Function, Reverse, Native directories?
- You first need to load the module into a property and then call the module in the property: $mdb2->loadModule('Manager'); $mdb2->manager->listTables();
- On PHP5 you can call on the $mdb2 instance directly after calling loadModule(): $mdb2->loadModule('Manager'); $mdb2->listTables();
- On PHP5 you can also skip the call to loadModule() by prefixing the method name with a short prefix (you can get the defined shorthand prefixes with $mdb2->getOption('modules')): $mdb2->rvTableInfo();
- When I try to install a driver package it complains about a missing extension, but I know its installed!?
- This is likely due to the fact that you are loading adifferent php.ini file on your command line than in your web server. Therefore you can either add the extension to your CLI php.ini or alternatively either tell the pear installer to ignore dependencies or register the given extension as installed:
- "pear install --nodeps MDB2_Driver_mysql"
- "pecl install --register-only mysql" followed by "pear install MDB2_Driver_mysql"
This site powered by YaWiki 0.22 beta.
|
|