MDB2 pear.php.net MDB database abstraction layer PEAR MDB2 is a merge of the PEAR DB and Metabase php database abstraction layers. It provides a common API for all supported RDBMS. The main difference to most other DB abstraction packages is that MDB2 goes much further to ensure portability. MDB2 provides most of its many features optionally that can be used to construct portable SQL statements: * Object-Oriented API * A DSN (data source name) or array format for specifying database servers * Datatype abstraction and on demand datatype conversion * Various optional fetch modes to fix portability issues * Portable error codes * Sequential and non sequential row fetching as well as bulk fetching * Ability to make buffered and unbuffered queries * Ordered array and associative array for the fetched rows * Prepare/execute (bind) named and unnamed placeholder emulation * Sequence/autoincrement emulation * Replace emulation * Limited sub select emulation * Row limit emulation * Transactions/savepoint support * Large Object support * Index/Unique Key/Primary Key support * Pattern matching abstraction * Module framework to load advanced functionality on demand * Ability to read the information schema * RDBMS management methods (creating, dropping, altering) * Reverse engineering schemas from an existing database * SQL function call abstraction * Full integration into the PEAR Framework * PHPDoc API documentation Lukas Kahwe Smith lsmith smith@pooteeweet.org no Lorenzo Alberton quipo l.alberton@quipo.it yes Paul Cooper pgc pgc@ucecom.com no Daniel Convissor danielc danielc@php.net yes David Coallier davidc david@jaws.com.mx yes 2007-05-03 2.4.1 2.4.1 stable stable BSD License - fixed bug #10407: propagate errors in MDB2_Statement_Common::execute() - fixed bug #10452: error in getDeclaration() with custom datatype_map and no datatype_map_callback function - fixed bug #10521: quote($val,'decimal') and quote($val,'float') pass unsafe characters - return length as "precision,scale" for NUMERIC and DECIMAL fields in mapNativeDatatype() - fixed bug #10537: safer check for valid MDB2 connection in singleton() [fornax] - fixed bug #10598: MDB2::singleton() not working in some rare conditions [fornax] - in getTableIndexDefinition() and getTableConstraintDefinition() in the Reverse module, also return the field position in the index/constraint - exec() now returns a reference instead of a copy to prevent memory leaks - request #10787: MDB2_Driver_Common::$phptype and $dbsyntax properties are now public open todo items: - handle autoincrement fields in alterTable() - add length handling to LOB reverse engineering - add EXPLAIN abstraction - add cursor support along the lines of PDO (Request #3660 etc.) - add PDO based drivers, especially a driver to support SQLite 3 (Request #6907) - add support to export/import in CSV format - add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.) - add support for database/table/row LOCKs - add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints - generate STATUS file from test suite results and allow users to submit test results - add support for full text index creation and querying - add tests to check if the RDBMS specific handling with portability options disabled behaves as expected - handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..) - add a getTableFieldsDefinitions() method to be used in tableInfo() - drop ILIKE from matchPattern() and instead add a second parameter to handle case sensitivity with arbitrary operators - add charset and collation support to field declaration in all drivers - handle LOBs in buffered result sets (Request #8793) 4.3.2 1.4.0b1 PEAR pear.php.net 1.3.6 MDB2_Driver_fbsql pear.php.net 0.3.0 MDB2_Driver_ibase pear.php.net 1.4.1 MDB2_Driver_mysql pear.php.net 1.4.1 MDB2_Driver_mysqli pear.php.net 1.4.1 MDB2_Driver_mssql pear.php.net 1.2.1 MDB2_Driver_oci8 pear.php.net 1.4.1 MDB2_Driver_pgsql pear.php.net 1.4.1 MDB2_Driver_querysim pear.php.net 0.6.0 MDB2_Driver_sqlite pear.php.net 1.4.1 2.4.1 2.4.1 stable stable 2007-05-03 BSD License - fixed bug #10407: propagate errors in MDB2_Statement_Common::execute() - fixed bug #10452: error in getDeclaration() with custom datatype_map and no datatype_map_callback function - fixed bug #10521: quote($val,'decimal') and quote($val,'float') pass unsafe characters - return length as "precision,scale" for NUMERIC and DECIMAL fields in mapNativeDatatype() - fixed bug #10537: safer check for valid MDB2 connection in singleton() [fornax] - fixed bug #10598: MDB2::singleton() not working in some rare conditions [fornax] - in getTableIndexDefinition() and getTableConstraintDefinition() in the Reverse module, also return the field position in the index/constraint - exec() now returns a reference instead of a copy to prevent memory leaks - request #10787: MDB2_Driver_Common::$phptype and $dbsyntax properties are now public open todo items: - handle autoincrement fields in alterTable() - add length handling to LOB reverse engineering - add EXPLAIN abstraction - add cursor support along the lines of PDO (Request #3660 etc.) - add PDO based drivers, especially a driver to support SQLite 3 (Request #6907) - add support to export/import in CSV format - add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.) - add support for database/table/row LOCKs - add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints - generate STATUS file from test suite results and allow users to submit test results - add support for full text index creation and querying - add tests to check if the RDBMS specific handling with portability options disabled behaves as expected - handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..) - add a getTableFieldsDefinitions() method to be used in tableInfo() - drop ILIKE from matchPattern() and instead add a second parameter to handle case sensitivity with arbitrary operators - add charset and collation support to field declaration in all drivers - handle LOBs in buffered result sets (Request #8793) 2.4.0 2.4.0 stable stable 2007-03-13 BSD License - propagate errors in getTableFieldDefinition() in the Reverse module - internally use MDB2::classExists() wrapper instead of directly calling class_exists() - fixed bug #9502: query result misbehaves when the number of returned columns is greater than the number of passed types - fixed bug #9748: Table name is not quoted in Extended.php buildManipSQL() - fixed bug #9800: when the php extension for the driver fails to load, the error is not propagated correctly and the script dies - propagate errors in the Datatype module - implemented guid() in the Function module [globally unique identifier] (thanks to mario dot adam at schaeffler dot com) - fixed bug #4854: Oracle Easy Connect syntax only works with array DSN - fixed bug #10105: inTransaction() was returning an incorrect value after a call to disconnect() or __destruct() - implemented a fallback mechanism within getTableIndexDefinition() and getTableConstraintDefinition() in the Reverse module to ignore the 'idxname_format' option and use the index name as provided in case of failure before returning an error - added a 'nativetype_map_callback' option to map native data declarations back to custom data types (thanks to Andrew Hill). - fixed bug #10234 and bug #10233: MDB2_Driver_Datatype_Common::mapNativeDatatype() must ensure that it returns the correct length value, or null - added support for TEMPORARY tables (patch by Andrew Hill) - phpdoc fixes - fixed tests to be compatible with PHP4 - added new tests, including some MDB2 internals tests by Andrew Hill and Monique Szpak open todo items: - handle autoincrement fields in alterTable() - add length handling to LOB reverse engineering - add EXPLAIN abstraction - add cursor support along the lines of PDO (Request #3660 etc.) - add PDO based drivers, especially a driver to support SQLite 3 (Request #6907) - add support to export/import in CSV format - add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.) - add support for database/table/row LOCKs - add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints - generate STATUS file from test suite results and allow users to submit test results - add support for full text index creation and querying - add tests to check if the RDBMS specific handling with portability options disabled behaves as expected - handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..) - add a getTableFieldsDefinitions() method to be used in tableInfo() - drop ILIKE from matchPattern() and instead add a second parameter to handle case sensitivity with arbitrary operators - add charset and collation support to field declaration in all drivers - handle LOBs in buffered result sets (Request #8793) 2.3.0 2.3.0 stable stable 2006-11-03 BSD License - added charset and collation support to field declaration - added SQL comments and quoted identifier handling inside prepared statement parser - expanded length/scale support for numeric types (Request #7170) - added statement_format option to make it possible to define the name used for native statements if supported - fixed bug when setting MDB2_PREPARE_RESULT in autoExecute() - fixed notice in exec() call in autoExecute() - reversed if logic in MDB2::fileExists checking to be more fool proof with safe_mode restrictions (Bug #8296) - moved CREATE TABLE query generation in a separate method for reuse in the drivers - added testLOBRead to test multiple LOB reads - fixed getColumnNames() optional parameter handling (Bug #8857) - phpdoc fix for fetchCol/fetchAll - added an extra if in the autoExecute method of the Extended driver (Bug #8878) - expanded tableInfo() tests - expanded prepare() tests - fix the incorrect use of currID() for lastInsertID() emulation (Bug #9107) - add test for lastInsertID() - also output php version in test results - added supported 'new_link' - dropped use of track_errors because 5.2.0 causes php_errormsg to not get populated if a custom error handler is set and it was causing issues for safe_mode users anyways - added some error handling into the bindValues()/bindParams() methods (Bug #9133) - bindValue() does not need values by reference - fix issue in execute() when parameter is a scalar integer of 0 (Bug #9158) - implemented stream_stat() method (Bug #9092) - better deal with non scalar arguments in test helper function as 5.2.0 explodes otherwise - extracted _skipDelimitedStrings() method from prepare() - added test for _skipDelimitedStrings() method - migrated to package.xml version 2 open todo items: - handle autoincrement fields in alterTable() - add length handling to LOB reverse engineering - expand charset support in schema management and result set handling (Request #4666) - add EXPLAIN abstraction - add cursor support along the lines of PDO (Request #3660 etc.) - add PDO based drivers, especially a driver to support SQLite 3 (Request #6907) - add support to export/import in CSV format - add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.) - add support for database/table/row LOCKs - add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints - generate STATUS file from test suite results and allow users to submit test results - explore use of install groups (pear install MDB2#mysql) - add support for full text index creation and querying - add tests to check if the RDBMS specific handling with portability options disabled behaves as expected - handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..) - add a getTableFieldsDefinitions() method to be used in tableInfo() - drop ILIKE from matchPattern() and instead add a second parameter to handle case sensitivity with arbitrary operators - add charset and collation support to field declaration in all drivers - handle LOBs in buffered result sets (Request #8793) 2.2.2 2.2.2 stable stable 2006-09-03 BSD License - flip positions property array in prepared statement objects to make it possible to optionally use the same named placeholder in multiple places inside a single prepared statement - expanded prepare tests to cover more edge cases - renamed valid_types property to valid_default_values in the Datatype module open todo items: - handle autoincrement fields in alterTable() - add length handling to LOB reverse engineering - expand charset support in schema management and result set handling (Request #4666) - add EXPLAIN abstraction - add cursor support along the lines of PDO (Request #3660 etc.) - expand length/scale support for numeric types (Request #7170) - add PDO based drivers, especially a driver to support SQLite 3 (Request #6907) - add support to export/import in CSV format - add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.) - add support for database/table/row LOCKs - add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints - generate STATUS file from test suite results and allow users to submit test results - add a package2.xml and explore use of install groups (pear install MDB2#mysql) - add support for full text index creation and querying - add tests to check if the RDBMS specific handling with portability options disabled behaves as expected - handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..) 2.2.1 2.2.1 stable stable 2006-08-21 BSD License - fixed missing code in tableInfo() (Bug #8289) - fixed handling of indexes and constraints and types in tableInfo() (fixes BC break) - do not set nested transaction error if error is expected - explictly default to NULL when the column is NULLable and no default is set (related to Bug #8359) - added support for case insensitive matching via ILIKE in matchPattern() - added getAsKeyword() for generating "AS" keyword as required by the RDBMS - return an error if a named placeholder name is used twice inside a single statement - add support for multi column PRIMARY KEYs in createTable() - added lower() and upper() to the function module - moved escaping tests to datatype tests - added summary at the end of a test run for each RDBMS - explicitly pass the php_type var in all internal loadModule() calls - added support for 'primary' option in createTable() - expanded NULL tests - fixed handling return values when disable_query is set in _doQuery() and _execute() - check if safe_mode is enabled in fileExists() to determine what algo to use (Bug #8296) - added a test case for updating LOBs - added rtrim test case for LOBs - if result types are specified only rtrim() type 'text' fields (otherwise it will mean that for some drivers LOB's would get rtrimmed) - phpdoc fixes to the convertResult*() methods - added execParam() method and code tweaks for get*() methods in the Extended module - removed redundant assertions when testing if a given feature is unsupported - removed tests of portability off (users should just set the given portability setting they want to test in their test_setup.php) open todo items: - handle autoincrement fields in alterTable() - add length handling to LOB reverse engineering - expand charset support in schema management and result set handling (Request #4666) - add EXPLAIN abstraction - add cursor support along the lines of PDO (Request #3660 etc.) - expand length/scale support for numeric types (Request #7170) - add PDO based drivers, especially a driver to support SQLite 3 (Request #6907) - add support to export/import in CSV format - add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.) - add support for database/table/row LOCKs - add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints - generate STATUS file from test suite results and allow users to submit test results - add a package2.xml and explore use of install groups (pear install MDB2#mysql) - add support for full text index creation and querying - add tests to check if the RDBMS specific handling with portability options disabled behaves as expected 2.2.0 2.2.0 stable stable 2006-07-23 BSD License - added MDB2_AUTOQUERY_SELECT (Request #7817) - added nested transaction support (inspired by ADODB's smart transactions) but expanded to optionally use SAVEPOINTs *EXPERIMENTAL* beginNestedTransaction(), completeNestedTransaction(), failNestedTransaction(), getNestedTransactionError() - inTransaction() will now return an integer with the nested transaction depth if a nested transaction has been started - added setTransactionIsolation() - added savepoint support to beginTransaction(), commit() and rollback() - added Native base class for consistency - added missing colnum parameter to queryOne() [used by getOne()] - added new tests for get*() Extended module methods - fixed missing db variable from getValidTypes() - added testing of a prepared statement with no parameters - added handling of empty result sets to result set verification in the test suite - oci8 and ibase (and possibly other rdbms) do not like freeing the statement before reading the result set (Bug #8068): * moved statement freeing after reading the result set in get*() Extended methods * bypass prepared statement API for queries without parameters in autoExecute() (this means you cannot use parameters with SELECT statements in autoExecute() on the above mentioned platforms) - use data type callback in getValidTypes() - fixed identifier quoting in buildManipSQL() for SELECT statements (thx Kailoran) - phpdoc and cosmetic fixes in limitQuery() - added matchPattern() and patternEscapeString(), escapePattern() *EXPERIMENTAL* - added ability to escape wildcard characters in escape() and quote() - added debug() call at the end of a query/prepare/execute calling (Request #7933) - added context array parameter to debug() and make use of it whereever sensible - added optional method name parameter to raiseError() and use whereever possible - added a new option "debug_expanded_output" which needs to be set to true to get additional context information and to get "post" callback calls - added testPortabilityOptions() - set length of 8 and fixed for user_password in the test suite - reworked tableInfo() to use a common implementation based on getTableFieldDefinition() when a table name is passed (Bug #8124) - disconnect after changing database/DSN (otherwise transactions may be left open) open todo items: - handle autoincrement fields in alterTable() - add length handling to LOB reverse engineering - expand charset support in schema management and result set handling (Request #4666) - add EXPLAIN abstraction - add cursor support along the lines of PDO (Request #3660 etc.) - expand length/scale support for numeric types (Request #7170) - add PDO based drivers, especially a driver to support SQLite 3 (Request #6907) - add support to export/import in CSV format - add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.) - add support to generating "AS" keyword if required - add support for database/table/row LOCKs - add ActiveRecord implementation (probably as a separate package) - add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints - extended to support for case insensitive matching via ILIKE/collate in matchPattern() - generate STATUS file from test suite results and allow users to submit test results 2.1.0 2.1.0 stable stable 2006-06-15 BSD License - removed bogus code from execute() - new test case for floats/decimals and locale - reworked fix for float/decimal handling - expanded scientific notation handling - fixed several minor issues with the datatype tests - removed use of "*" in all places in the test suite that are followed by a fetch - tweaked handling of free() for prepared statements - return error if a prepared statement is attempted to be free'ed or executed again - added result_wrap_class param to limitQuery() - added parameter to not quote return value of getBeforeId() - added setCharset() - enable transactions by default - added decimal reverse engineering test - fixed parameter order in assertions in reverse engineering fields tests - generalized quoteIdentifier() with a property - switched most array_key_exists() calls to !empty() to improve readability and performance - fixed a few edge cases and potential warnings - added ability to rewrite queries for query(), exec() and prepare() using a debug handler callback - added 'datatype_map' option (Request #7797) - added reverse parameter to getColumnNames() - added 'datatype_map_callback' option - added getValidTypes() method to handle additional types from the 'datatype_map' option - set last_query in _execute() to prepared statement (Bug #7856) - adding random function emulation to generate a float between 0 and 1 - explicitly fetch row id = 1 in LOB tests - cosmetic fix to prepare() (Bug #7883) - bumped PHP dependency to 4.3.2 because of LOB stream support open todo items: - handle autoincrement fields in alterTable() - add support for ADODB style "smart transactions": http://phplens.com/lens/adodb/docs-adodb.htm#ex11 - add length handling to LOB reverse engineering 2.0.3 2.0.3 stable stable 2006-05-22 BSD License - fix float/decimal handling (Request #3021) - default to decimal for double (instead of float) - serialize arrays when no type is explicitly given - phpdoc fixes - expanded FLOAT test - added support for identifier quoting (Request #7671) - added test class for the Extended module - added support for DELETE in auto*() methods (Request #5345) - added "emulate_prepared" option to force prepared statement emulation open todo items: - handle autoincrement fields in alterTable() - add support for ADODB style "smart transactions": http://phplens.com/lens/adodb/docs-adodb.htm#ex11 - add length handling to LOB reverse engineering 2.0.2 2.0.2 stable stable 2006-05-14 BSD License - phpdoc and folding mark fixes (thx Laurent and Stoyan) - added getTriggerDefinition() in the Reverse module - added listTableViews() in the Manager module - explicitly set is_manip parameter to false for transaction debug calls - various minor tweaks to error messages, phpdoc and adding stub methods to the common driver - added row seeking support to fetchOne() - added ability to hint that a constraint is a primary key in dropConstraint() - since we no longer complain about primary keys not being called primary we can remove the necessary hacks in the test suite - improved LOB tests in the test suite - do not require Manager module for core API tests - added support for fixed and variable types for 'text' in declarations, as well as in reverse engineering (Request #1523) - updated MAINTAINERS to current status - readded STATUS document, still needs to be filled with content - tweaked handling of error objects inside raiseError() - made _doQuery() return a reference - added userinfo's to all raiseError calls that previously had none - added bindValueArray() - use bindValueArray() instead of bindParamArray() in all internal calls - removed the skeleton drivers, since its too much work to maintain them and there are plenty of sample drivers to look at - fixed example due to API change in MDB2_Schema (Bug #7575) - added 'prepared_statements' supported meta data setting - do not retrieve lob in the stream constructor and streams_eof() - strip of file:// prefix in writeLOBToFile() - typo fix ressource/resource in LOB array - removed lob property from the LOB streams wrapper (references are always shaky business in PHP so lets use them as little as possible) - fixed _destroyLOB() API to match other private LOB methods - fixed phpdoc comments of all private LOB methods - typo fix in autoincrement test - reworked index/constraint creation to not affected unnecessary reverse tests Note: Due to changes in generation of declaration statements you may need to update your test databases (for example by rerunning the MDB2_Schema installation using the CVS version or a release greater than 0.5.0) open todo items: - handle autoincrement fields in alterTable() - add support for ADODB style "smart transactions": http://phplens.com/lens/adodb/docs-adodb.htm#ex11 2.0.1 2.0.1 stable stable 2006-04-16 BSD License - added new comprehensive tests for the Reverse module - fixed testcases to pass for mysql[i] (needs pk's to be called "primary") .. sqlite is probably severely broken for these tests - added ability to specify port number when using unix sockets in MDB2::parseDSN() (bug #5982) - added test for multi_query option - typo fix in get constraint test - use ugly fopen() hack in fileExists() http://marc.theaimsgroup.com/?l=pear-dev&m=114148949106207&w=2 - allow "." and "$" in sequence name (bug #7081) - aligned _modifyQuery() signature and phpdoc - added inTransaction() to determine if a transaction is currently open - added support for tabe options in createTable() (bug ##7079) - make it possible to overwrite the error code-message map - added sample sqlite in memory dsn to php5 example - added 'result_introspection' supported metadata support - added bindValue() method - use MDB2_PREPARE_MANIP where we previously were using false - fixed default values for date and timestamp - if MDB2_PORTABILITY_EMPTY_TO_NULL is set change '' to ' ' in _getDeclaration() - refactored class loading into MDB2::loadClass() - properly quote CURRENT_* for temporal types (bug #6416) - added connected_server_info to cache server info in getServerInfo() - reset all connection related properties in disconnect() - separated result_buffering and prefetching by adding the new result_prefetching option - set error code in all raiseError() calls - added support for length in reverse engineering of integer fields - improve test suite documentation open todo items: - handle autoincremement fields in alterTable() 2.0.0 2.0.0 stable stable 2006-02-09 BSD License - handle null as resource when disable_query option is enabled in result object 2.0.0RC5 2.0.0RC5 beta beta 2006-02-05 BSD License - expanded testing of prepared queries (out of order binding, escape characters inside the string, lobs without named parameters that match the field name) - removed ugly hack for quote parameter in quote() since it was insufficient (escaping also needs to be prevented) - added support for out of order parameter binding in prepared queries - expanded testing of prepared queries (out of order binding, escape characters inside the string, lobs without named parameters that match the field name) - reset row_limit and row_offset after calling prepare() just like we do for query() and exec() - cosmetic fix (removed "row_" prefix from "row_limit" and "row_offset") - now using INT/TINYINT/SMALLINT by default instead of CHAR(1) for the boolean datatype (BC BREAK!) - added MDB2_datatype_testcase to test suite - support an arbitrary number of arguments in concat() - add property phpdoc comments to LOB.php 2.0.0RC4 2.0.0RC4 beta beta 2006-01-13 BSD License - explicitly pass if the module is phptype specific in all loadModule calls (bug #6226) - some cleanups in loadModule() - eliminate possible warnings in execute() and _assignBindColumns() - do not silence includes when debug option is enabled - fixed serious bug in autoincrement test - added dbsyntax to getDSN() string output (feature request #6463) - fixed signature of executeStoredProc() - nextResult() returns false if there are no more result sets to read - renamed _isIndexName() to _fixIndexName() - _fixIndexName() now just attempts to remove possible formatting - renamed _isSequenceName() to _fixSequenceName() - _fixSequenceName() now just attempts to remove possible formatting, and only returns a boolean if no formatting was applied when the new "check" parameter is set to true 2.0.0RC3 2.0.0RC3 beta beta 2005-12-30 BSD License - added error handling when result set introspection is not supported in _wrapResult() - fixed example - removed peardb wrapper (its broken, unmaintained and probably unused) - added new example using php5 only features - MDB2_OK is now a boolean true, instead of integer 1 - types can now always be keyed by name or by order - renamed setResultTypes() in the datatype module to checkResultTypes() and modified the signature accordingly - removed no longer used MDB2::isManip() 2.0.0RC2 2.0.0RC2 beta beta 2005-12-28 BSD License - fixed testNow() to use the datatype abstraction - fixed testGetTableFieldDefinition() to use a blob column instead of a clob since we default to blob when we cannot differntiate between blob and clob - split up alterTable() testing into two separate test methods - removed errorNative() was never implemented, use errorInfo() instead - fixed major bug in _fixResultArrayValues() that would lead to performance or incorrect application of portability features - phpdoc fixes in LOB.php, Iterator.php, Date.php and Extended.php - removed not required prev() and hasPrev() from the SeekableIterator implementation 2.0.0RC1 2.0.0RC1 beta beta 2005-12-21 BSD License - added numerous testcases in the manager and reverse module - unified case fixing in the list*() methods - case-insensitive comparison in _isSequenceName() - added getConnection() to fetch a native connection resource - split index and constraint handling - quote identifiers where possible inside the manager methods depending on the new 'quote_identifier' option (defaults to off) - refactored get*Declaration() methods to use getTypeDeclaration() - setting in_transaction to false on disconnect - store if type has changed in compareDefinition() - added new Function modules to handle difference in SQL functions - added verious new test cases - refactored test cases to use an MDB2_testcase base class - allow empty field parameter in get*ID() methods (bug #5791) - tweaked error messages for file loads - split off manipulation queries into exec() method from the query() method *BC BREAK* - only if result_types is set to false in prepare() method the query will be handled as a DML statement *BC BREAK* - use a proper default value if a field is set to not null in _getDeclaration*() (bug #5930) - added getServerVersion() - renamed defaultOutput() to getDefaultOutput() *BC BREAK* - use tableInfo() to automatically determine the result types if type is set to true - reworked file loading to work around issues in safe_mode with MDB2::fileExists() (bug #6226) - no need to return by reference in getConnection() (it even seems to work for mysqli that has objects and not resource connections) - added "idxname_format" as option similar to "seqname_format" - fixed bug in API calls inside autoExecute() (bug #6286) 2.0.0beta6 2.0.0beta6 beta beta 2005-10-16 BSD License Warning: this release features numerous BC breaks! There have been considerable improvements to the datatype, manager and reverse modules. Furthermore preliminary support for auto increment and primary keys has been added. Please note that making a field auto increment implies a single column primary key on this field. - increased php dependency to 4.3.0 due to the usage of the streams API since beta5 - moved logic from MDB2::connect() to MDB2::factory(), the only difference is that MDB2::connect will immediatly try to connect to the database - MDB2::singleton now uses MDB2::factory() - added support for auto increment and primary key in schema. (mysql[i]) - alterTable now needs the full definition to work (use getTableFieldDefinition from Reverse module if you do not have a definition at hand) this eliminates the need of the declaration part in the alterTable array. - nicer test chooser. Added some js magic to [un]select all the tests in a group - fixed typo in _getTextDeclaration() - fix PHP4.4 breakage - ensure that types and result_types property in the statement class is an array (bug #4695) - added support for fetchmode in the iterator class and for any other result wrapper class (bug #4685) - moved getInsertID() into core as lastInsertID() - moved getBeforeID() and getAfterID() from core into the extended module - added base class for all modules (which provides getDBInstance()) - added free() method to remove an instance from the global instance array - removed schema manager related error codes from MDB2::errorMessage() - dont set the include path in test suite (people can do that in test_setup.php) - added missing default numRows() method - added hack into stream_eof() to handle the BC break in 5.0.x - removed uncessary duplicate quoting in quote() in the peardb wrapper (bug #5195) - warning fix in BC hack of connect() in the peardb wrapper - tweaked error message in setResultTypes() - removed PDO compatibility code in bindParam and bindCol, now using 0-index numeric keys again - expect keys in type arrays the same way as they are passed for the values in execute() and bindParamArray() - add s pattern modifier to preg_replace() call for parameter searches in prepare() (bug #5362) - moved all private fetch mode fix methods into _fixResultArrayValues() for performance reasons - added new portability fetch mode MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES (to remove database/table qualifiers from assoc indexes) - renamed MDB2_PORTABILITY_LOWERCASE to MDB2_PORTABILITY_FIX_CASE and use 'field_case' option to determine if to upper- or lowercase (CASE_LOWER/CASE_UPPER) - ensure that fetchAll always returns an array() even if the result set was empty - use array_key_exists() instead of isset() where possible - changed structure of field add/remove/change in alterTable() to match MDB2_Schema - added default values for supported property - reworked supports() to return the given value and also return errors for non existant support feature - reworked subSelect() to use the 'emulated' supports() return value - removed implementation of createIndex() (now every driver needs to implement it themselves) - sync fileExists with the LiveUser one, explode instead of split and is_readable instead of file_exists. - tweaked compare method family to better deal with optional properties open todo items: - add test cases for the various module methods - add getServerVersion() 2.0.0beta5 2.0.0beta5 beta beta 2005-06-08 BSD License Warning: this release features numerous BC breaks to make the MDB2 API be as similar as possible as the ext/pdo API! The next release is likely to also break BC for the same reason. Check php.net/pdo for information on the pdo API. - refactored LOB support (BC breaks) - moved all drivers into separate packages MDB2_Driver_* (BC break) - bindParam() and bindColumn() are now 1-indexed (BC break) - removed special handling for day light saving time (bug #4341) (BC break) - ensure SQL injection protection in all _quote() methods (was missing in some decimal, float, time, date and timestamp implementations) - renamed getRowCount() to rowCount() for PDO compliance (BC break) (doesnt take into account the offset anymore) - added new quote() parameter to remove quotes (ugly hack will get cleaned up) - renamed execute() to _execute() since common provides some common functionality via execute() - fixed some issues regarding limit/offset in prepared statements - fixed bug in _assignBindColumns() when using associative fetches - support numeric and string keys in types array for prepared queries - call trigger error if __call() is unable to find a method in any of the modules - work around php5 bugs in the test suite 2.0.0beta4 2.0.0beta4 beta beta 2005-04-29 BSD License Warning: this release features numerous BC breaks to make the MDB2 API be as similar as possible as the ext/pdo API! The next release is likely to also break BC for the same reason. Check php.net/pdo for information on the pdo API. - fixed bugs in MDB2_Extended::buildManipSQL() introduced in latest tweaks (bug #3725) - mysqli has connection objects instead of resources - fix mssql tableInfo() so flags are returned (bug #3691) - fixed bug in handling of force_array when 2 or less columns are fetched in fetchAll() - added map error message for sqlite multi-column unique constraints. - added listUsers(), listViews(), listFunctions() to oracle manager - added listFunctions() to pgsql manager - updated listViews() in pgsql manager - added __call() support for module handling - mysql driver now uses mysqli implementations where feasible - ensure that internal calls to query dont wrap the result - for some reason mysqli didnt like SELECT LAST_INSERT_ID() - fixed bug in table alteration when only an index was added - updated pgsql API calls to 4.2.0 recommended names (bug #3904) - moved logic to compareDefinitions from the Manager into the Datatype module to increase flexibility - extended MDB2::isError() to be able to handle an array or codes - added error handling into autoPrepare() and autoExecute() - migrade all MDB2::isError calls that dont check for specific errors codes to PEAR::isError - don't pass new_link to mysql_pconnect() (bug #3993) - use MDB2::raiseError() instead of MDB2_Driver_Common::raiseError() - do not disable result wrapping when doing internal calls to query() (bug #3997) - _wrapResult() now ensures that the result class is an instance of MDB2_Result_Common - unbundled the MDB2_Tools_Manager into a separate package PEAR::MDB2_Schema - improved getTableFieldDefinition() and moved native type mapping to the datatype module mapNativeDatatype() method (mysql, sqlite, pgsql and ibase drivers) - fixes for listTables() in sqlite and pgsql driver - ensure that mysql drivers use the dummy_primary_key property - severely reworked how data is fetched and buffered and freed in the iterator - added mapNativeDatatype() to ibase driver - getTypeDeclaration() => _getTypeDeclaration() in ibase driver - cosmetic fixes and tweaks (replace(). fetchOne() ..) - renamed 'seqname_col_name' option to 'seqcol_name' - moved schema documentation, xml_reverse_engineering.php, MDB.dtd and MDB.xls to MDB_Schema package - Mysqli: implicit sequence is named as table by default - Mysqli: text types now map to clob first - ensure that types are numerically keyed in setResultTypes() - added caching to getColumnNames() - added bindColumn() support - use MDB2_Schema::factory() - phpdoc fixes in regards to flipped fetchmode - remove renegate mysql code in sqlite driver 2.0.0beta3 2.0.0beta3 beta beta 2005-03-06 BSD License Warning: this release features numerous BC breaks to make the MDB2 API be as similar as possible as the ext/pdo API! The next release is likely to also break BC for the same reason. Check php.net/pdo for information on the pdo API. Oracle NULL in LOB fields is broken. The fbsql and mssql drivers are likely to be broken as they are largely untested. MDB2 static class: - "xxx" out password on connect error in MDB2::connect() - MDB2::isError now also optionally accepts and error code to check for - added LOAD DATA (port from DB) and SET to MDB2::isManip() All drivers: - use __construct() (PHP4 BC hacks are provided) - allow null values to be set for options - ensure we are returning a reference in all relevant places - allow errorInfo() to be called when no connection has been established yet - use MDB2_ERROR_UNSUPPORTED instead of MDB2_ERROR_NOT_CAPABLE in common implementations - readded MDB2_Error as the baseclass for all MDB2 error objects - updated error mappings from DB - added MDB2_Driver_Common::getDatabase(); - reworked dsn default handling - added ability to "xxx" out password in getDSN() - use _close() method in several places where they previously were not used - removed redundant code in _close() that dealt with transaction closing already done in disconnect() - if the dbsyntax is set in the dsn it will be set in the dbsyntax property - only disconnect persistant connections if disconnect() has been explicitly called by the user - instead of having a generic implemention of disconnect() we will rename _close() to disconnect() to overwrite the generic implementation - added support for 'new_link' dsn option for all supported drivers (mysql, oci8, pgsql) - transaction API moved over to PDO: removed autoCommit(), added beginTransaction() and refactored commit() (it doesn't start a new transaction automatically anymore) - reworked handling of uncommited transaction for persistant connections when a given connection is no longer in use - added 'disable_query' option to be able to disable the execution of all queries (this might be useful in conjuntion with a custom debug handler to be able to dump all queries into a file instead of executing them) - removed affectedRows() method in favor of returning affectedRows() on query if relevant - added generic implementation of query() and moved driver specific code into _doQuery() - added _modifyQuery() to any driver that did not yet have it yet - standaloneQuery() now also supports SELECT querys - remove redundant call to commit() since setting autoCommit() already commits in MDB2::replace() - refactored standaloneQuery(), query(), _doQuery(), _wrapResult(); the most important change are: result are only wrapped if it is explicitly requested standaloneQuery() now works just as query() does but with its own connection - allowing limits of 0 in setLimit() - explicitly specify colum name in sequence emulation queries - added getBeforeId() and getAfterId() - added new supported feature 'auto_increment' - added default implementation for quoteCLOB() and quoteBLOB() - reworked quote handling: moved all implementation details into the extension, made all quote methods private except for quote() itself, honor portability MDB2_PORTABILITY_EMPTY_TO_NULL in quote(), removed MDB2_TYPE_* constants - reworked get*Declaration handling: moved all implementation details into the extension, made all quote methods private except for quote() itself - placed convert methods after the portability conversions to ensure that the proper type is maintained after the conversion methods - dont convert fetched null values in the Datatype module - removed executeParams() and moved executeMultiple() from extended module - updated tableInfo() code from DB - made LIMIT handling more robust by taking some code from DB All drivers result: - performance tweak in fetchCol() - added MDB2_FETCHMODE_OBJECT - added MDB2_Driver_Result_Common::getRowCounter() - added rownum handling to fetchRow() - removed fetch() and resultIsNull() All drivers prepared statements - moved prepare/execute API towards PDO - setParamsArray() can now handle non ordered arrays - removed requirement for LOB inserts to pass the parameters as an array - placeholders are now numbered starting from 0 (BC break in setParam() !) - queries inside the prepared_queries property now start counting at 1 (performance tweak) - refactored handling of filename LOB values (prefix with 'file://') - removed _executePrepared(), drivers need to overwrite execute() for now on - add support for oracle style named parameters and modified test suite accordingly MySQL driver: - improved handling of MDB2_PORTABILITY_LOWERCASE in all the reverse methods inside the mysql driver to work coherently - fixed several issues in the listTablefields() method of manager drivers MSSQL driver: - added code in MDB2_Driver_mssql::connect() to better handle date values independant of ini and locale settings inside the server - use comma, rather than colon, to delimit port in MDB2_driver_mssql::connect(). Bug 2140. (danielc) - unified mssql standalone query with sqlite, mysql and others (not tested on mssql yet, but since mssql automatically reuses connections per dsn the old way could gurantee anything different from happening) PgSQL driver: - use track_errors to capture error messages in MDB2_driver_pgsql::connect(). Bug 2011. (danielc) - add port to connect string when protocol is unix in MDB2_driver_pgsql::connect(). Bug 1919. (danielc) - accommodate changes made to PostgreSQL so "no such field" errors get properly indicated rather than being mislabeled as "no such table." (danielc) - added "permission denied" to error regex in pgsql driver. Bug 2417. (stewart_linux-org-au) OCI8 driver: - fixed typo in MDB2_Driver_Manager_oci8::listTables() (fix for bug #2434) - added emulate_database option (default true) to the Oracle driver that handles if the database_name should be used for connections of the username - oci8 driver now uses native bind support for all types in prepare()/execute() Interbase driver: - completely revised ibase driver, now passing all tests under php5 Frontbase driver: - fbsql: use correct error codes. Was using MySQL's codes by mistake. MySQLi driver: - added mysqli driver (passes all tests, but doesnt use native prepare yet) DB wrapper - fixed a large number of compatibility issues in the PEAR::DB wrapper Iterator - fixed several bugs and updated the interface to match the final php5 iterator API - buffered result sets now implements seekable - removed unnecessary returns - throw pear error on rewind in unbuffered result set - renamed size() to count() to match the upcoming Countable interface Extended module: - modified the signature of the auto*() methods to be compatible with DB (bug #3720) - tweaked buildManipSQL() to not use loops (bug #3721) MDB_Tools_Manager - updated raiseError method in the Manager to be compatible with XML_Parser 1.1.x and return useful error message (fix bug #2055) - major refactoring of MDB2_Manager resulting in several new methods being available - fixed error in MDB2_Manager::_escapeSpecialCharacter() that would lead to incorrect handling of integer values (this needs to be explored in more detail) - several typo fixes and minor logic errors (among others a fix for bug #2057) - moved xml dumping in MDB2_Tools_Manager into separate Writer class - fixed bugs in start value handling in create sequence (bug #3077) 2.0.0beta2 2.0.0beta2 beta beta 2004-04-25 BSD License The core of MDB2 is now fairly stable API-wise. The modules, especially the manager and reverse module, might see some API refinement before the first stable release. - added listTables() and listTableFields() methods to MDB2_Driver_Manager_mssql and MDB2_Driver_Manager_oci8 - reversed parameter order of getValue(), type parameter is now optional and will then be autodetected (BC break!) - renamed get*Value() to quote*() (BC break!) - fixed LOB management in MDB2_Driver_ibase - moved getOne, getRow, getCol, getAll back into the exteneded module (most users should be able to move to the queryOne, queryRow, queryCol and queryAll equivalent) (BC break!) - added getAssoc to the extended module - fixed bug in MDB2_Driver_Datatype_Common::implodeArray() - added sequence_col_name option to make the column name inside sequence emulation tables configurable - fixed a bug in the MDB2_Driver_oci8 and MDB2_Driver_ibase buffering emulation when using limit queries - removed MDB2_PORTABILITY_NULL_TO_EMPTY in favor of MDB2_PORTABILITY_EMPTY_TO_NULL this means that DB and MDB2 work exactly the opposite now, but it seems more efficient to do things the way Oracle does since this is the RDBMS which creates the original issue to begin with (BC break!) - fixed a typos in getAll, getAssoc and getCol - test suite: moved set_time_limit() call to the setup script to be easier to customize - renamed hasMore() to valid() due to changes in the PHP5 iterator API (BC break!) - renamed toString() to __toString() in order to take advantage of new PHP5 goodness and made it public - MDB2_Driver_Datatype_Common::setResultTypes() can now handle missing elements inside type arrays: array(2 => 'boolean', 4 => 'timestamp') - fixed potential warning due to manipulation query detection in the query*() and the get*() query+fetch methods - added tests for fetchAll() and fetchCol() - performance tweaks for fetchAll() and fetchCol() - fixed MDB2_Driver_Manager_mysql::listTableIndexes() - fixed MDB2_Driver_Common::debug() - renamed MDB2::isResult() to MDB2::isResultCommon() - added base result class MDB2_Result from which all result sets should be inherited and added MDB2::isResult() which checks if a given object extends from it - added 'result_wrap_class' option and optional parameter to query() to enable wrapping of result classes into an arbitrary class - added $result_class param to all drivers where it was missing from the query() and _executePrepared() methods - applied several fixes to the PEAR::DB wrapper - fixed a typo in MDB2_Driver_Reverse_pgsql::tableInfo() 2.0.0beta1 2.0.0beta1 alpha alpha 2004-03-12 BSD License - fixed bug in MDB2::singleton - fixed minor bugs in prepare/execute - added PEAR::DB wrapper (not working yet) - fixed several bugs in the ibase driver - fixed several PHP5 related issues - fixed bug in sequence creation on MySQL - fixed issues with nextid() ondemand handling in conjunction with currId() - added native currId() implementation for the Oracle driver - fixed sqlite driver (passes all but the REPLACE test due to a conformance issue in sqlite itself) - removed decimal_factor property to allow changing of decimal_places option - using native escape string methods in sqlite and mysql driver - fixed minor conformance issues in tableInfo() in the oci8 and mysql driver - removed optimize option and added portability option instead (ported from DB) - added quoteIdentifier() method (ported from DB) - added STATUS document to make the status of the drivers more transparent - fixed a few bugs in querysim driver - fixed issue in mysql reverse engineering: ensuring the correct case is used when doing assoc fetches based on portability flag setting - updated reverse engineering script to the new MDB2 API - removed broken implementations of currId() in the mssql and fbsql driver - fixed a few instances of MDB_Common to the new class name of MDB_Driver_Common 2.0.0alpha1 2.0.0alpha1 alpha alpha 2004-01-05 BSD License This is the first alpha release of MDB2 2.0. MDB2 2.x breaks backwards compatibility in many ways in order to simplify the API for both users and drivers developers. Please note that currently only the MySQL, the PostGreSQL and the Oracle driver have been tested to pass the test suite. Here follows a short list of the most important changes: - all code that is not necessary for basic operation is now separateed into separate modules which can be loaded with the loadModule() method - all datatype related methods have been moved to a dataype module with the notable exception of getValue() and the newly introduced getDeclaration() - added extended module for highlevel methods - all manager method are no longer available in the core class and or now only available in the manager module - all reverse engineering methods have been taken from the manager class and are now available through the reverse module - a new module has been added to allow the addition of methods with RDBMS specific functionality (like getting the last autoincrement ID) - LOB handling has been greatly simplified - several methods names have been shortend - the fetch.+() methods do not free the result set anymore - the Manager and the reverse_engineer_xml_schema have been moved into a Tools directory - all parameters are now lowercased with underscores as separators - all drivers now support all of the dsn options that PEAR DB supports - several methods have been removed because they offered redundant functionality - changed prepare API type is now passed to prepare and not to setParam*() - results are now wrapped inside objects and all methods which operate on resultsets have been moved into respecitive classes - there are two types of result object: buffered (default) and unbuffered - totally rewrote buffering and limit emulation