cvs: pear /MDB2 MDB2.php package.php package_ibase.php package_mssql.php package_mysql.php package_mysqli.php package_oci8.php package_pgsql.php
package_sqlite.php /MDB2/MDB2/Driver/Datatype Common.php ibase.php mssql.php mysql.php mysqli.php oci8.php pgsql.php sqlite.php
| From: | Lorenzo Alberton | Date: | Wed, 28 Feb 2007 16:05:45 +0000 |
| Subject: | cvs: pear /MDB2 MDB2.php package.php package_ibase.php package_mssql.php package_mysql.php package_mysqli.php package_oci8.php package_pgsql.php package_sqlite.php /MDB2/MDB2/Driver/Datatype Common.php ibase.php mssql.php mysql.php mysqli.php oci8.php pgsql.php sqlite.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44914@lists.php.net to get a copy of this message | ||
quipo Wed Feb 28 16:05:45 2007 UTC
Modified files:
/pear/MDB2 MDB2.php package.php package_ibase.php package_mssql.php
package_mysql.php package_mysqli.php package_oci8.php
package_pgsql.php package_sqlite.php
/pear/MDB2/MDB2/Driver/Datatype Common.php ibase.php mssql.php
mysql.php mysqli.php oci8.php
pgsql.php sqlite.php
Log:
added a 'nativetype_map_callback' option to map native data declarations back to custom
data types (thanks to Andrew Hill).
http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2.php?r1=1.283&r2=1.284&diff_format=u Index: pear/MDB2/MDB2.php diff -u pear/MDB2/MDB2.php:1.283 pear/MDB2/MDB2.php:1.284 --- pear/MDB2/MDB2.php:1.283 Fri Feb 16 17:09:11 2007 +++ pear/MDB2/MDB2.php Wed Feb 28 16:05:45 2007 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: MDB2.php,v 1.283 2007/02/16 17:09:11 quipo Exp $ +// $Id: MDB2.php,v 1.284 2007/02/28 16:05:45 quipo Exp $ // /** @@ -1150,6 +1150,7 @@ 'emulate_prepared' => false, 'datatype_map' => array(), 'datatype_map_callback' => array(), + 'nativetype_map_callback' => array(), ); /** http://cvs.php.net/viewvc.cgi/pear/MDB2/package.php?r1=1.236&r2=1.237&diff_format=u Index: pear/MDB2/package.php diff -u pear/MDB2/package.php:1.236 pear/MDB2/package.php:1.237 --- pear/MDB2/package.php:1.236 Wed Feb 28 13:02:21 2007 +++ pear/MDB2/package.php Wed Feb 28 16:05:45 2007 @@ -24,6 +24,8 @@ 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). - phpdoc fixes - fixed tests to be compatible with PHP4 - added tests http://cvs.php.net/viewvc.cgi/pear/MDB2/package_ibase.php?r1=1.113&r2=1.114&diff_format=u Index: pear/MDB2/package_ibase.php diff -u pear/MDB2/package_ibase.php:1.113 pear/MDB2/package_ibase.php:1.114 --- pear/MDB2/package_ibase.php:1.113 Sun Feb 25 11:15:03 2007 +++ pear/MDB2/package_ibase.php Wed Feb 28 16:05:45 2007 @@ -17,6 +17,8 @@ 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). - phpdoc fixes EOT; http://cvs.php.net/viewvc.cgi/pear/MDB2/package_mssql.php?r1=1.75&r2=1.76&diff_format=u Index: pear/MDB2/package_mssql.php diff -u pear/MDB2/package_mssql.php:1.75 pear/MDB2/package_mssql.php:1.76 --- pear/MDB2/package_mssql.php:1.75 Sun Feb 25 11:15:03 2007 +++ pear/MDB2/package_mssql.php Wed Feb 28 16:05:45 2007 @@ -45,6 +45,8 @@ - implemented a fallback mechanism within getTableIndexDefinition() 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). - phpdoc fixes open todo items: http://cvs.php.net/viewvc.cgi/pear/MDB2/package_mysql.php?r1=1.99&r2=1.100&diff_format=u Index: pear/MDB2/package_mysql.php diff -u pear/MDB2/package_mysql.php:1.99 pear/MDB2/package_mysql.php:1.100 --- pear/MDB2/package_mysql.php:1.99 Mon Feb 26 21:47:06 2007 +++ pear/MDB2/package_mysql.php Wed Feb 28 16:05:45 2007 @@ -22,6 +22,8 @@ option and use the index name as provided in case of failure before returning an error - fixed bug #10181: propagate error when an invalid type is passed to prepare() +- added a 'nativetype_map_callback' option to map native data declarations back to + custom data types (thanks to Andrew Hill). - phpdoc fixes note: http://cvs.php.net/viewvc.cgi/pear/MDB2/package_mysqli.php?r1=1.102&r2=1.103&diff_format=u Index: pear/MDB2/package_mysqli.php diff -u pear/MDB2/package_mysqli.php:1.102 pear/MDB2/package_mysqli.php:1.103 --- pear/MDB2/package_mysqli.php:1.102 Mon Feb 26 21:47:06 2007 +++ pear/MDB2/package_mysqli.php Wed Feb 28 16:05:45 2007 @@ -22,6 +22,8 @@ option and use the index name as provided in case of failure before returning an error - fixed bug #10181: propagate error when an invalid type is passed to prepare() +- added a 'nativetype_map_callback' option to map native data declarations back to + custom data types (thanks to Andrew Hill). - phpdoc fixes open todo items: http://cvs.php.net/viewvc.cgi/pear/MDB2/package_oci8.php?r1=1.102&r2=1.103&diff_format=u Index: pear/MDB2/package_oci8.php diff -u pear/MDB2/package_oci8.php:1.102 pear/MDB2/package_oci8.php:1.103 --- pear/MDB2/package_oci8.php:1.102 Sun Feb 25 11:15:03 2007 +++ pear/MDB2/package_oci8.php Wed Feb 28 16:05:45 2007 @@ -16,6 +16,10 @@ 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 +- fixed bug #4854: Oracle Easy Connect syntax only works with array DSN +- added a 'nativetype_map_callback' option to map native data declarations back to + custom data types (thanks to Andrew Hill). +- phpdoc fixes note: - please use the latest ext/oci8 version from pecl.php.net/oci8 @@ -25,8 +29,6 @@ behaviour can be disabled by setting the "emulate_database" option to false. - the multi_query test failes because this is not supported by ext/oci8 - the null LOB test failes because this is not supported by Oracle -- fixed bug #4854: Oracle Easy Connect syntax only works with array DSN -- phpdoc fixes open todo items: - enable use of read() for LOBs to read a LOB in chunks http://cvs.php.net/viewvc.cgi/pear/MDB2/package_pgsql.php?r1=1.100&r2=1.101&diff_format=u Index: pear/MDB2/package_pgsql.php diff -u pear/MDB2/package_pgsql.php:1.100 pear/MDB2/package_pgsql.php:1.101 --- pear/MDB2/package_pgsql.php:1.100 Sun Feb 25 11:15:03 2007 +++ pear/MDB2/package_pgsql.php Wed Feb 28 16:05:45 2007 @@ -14,6 +14,8 @@ 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). - phpdoc fixes open todo items: http://cvs.php.net/viewvc.cgi/pear/MDB2/package_sqlite.php?r1=1.80&r2=1.81&diff_format=u Index: pear/MDB2/package_sqlite.php diff -u pear/MDB2/package_sqlite.php:1.80 pear/MDB2/package_sqlite.php:1.81 --- pear/MDB2/package_sqlite.php:1.80 Sun Feb 25 11:15:03 2007 +++ pear/MDB2/package_sqlite.php Wed Feb 28 16:05:45 2007 @@ -12,6 +12,8 @@ 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). - phpdoc fixes note: http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/Common.php?r1=1.118&r2=1.119&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/Common.php diff -u pear/MDB2/MDB2/Driver/Datatype/Common.php:1.118 pear/MDB2/MDB2/Driver/Datatype/Common.php:1.119 --- pear/MDB2/MDB2/Driver/Datatype/Common.php:1.118 Wed Feb 28 12:42:59 2007 +++ pear/MDB2/MDB2/Driver/Datatype/Common.php Wed Feb 28 16:05:45 2007 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.118 2007/02/28 12:42:59 quipo Exp $ +// $Id: Common.php,v 1.119 2007/02/28 16:05:45 quipo Exp $ require_once 'MDB2/LOB.php'; @@ -1724,6 +1724,34 @@ return $db; } + // If the user has specified an option to map the native field + // type to a custom MDB2 datatype... + if (!empty($db->options['nativetype_map_callback'][$field['type']])) { + return call_user_func_array($db->options['nativetype_map_callback'][$field['type']], $field); + } + + // Otherwise perform the built-in (i.e. normal) MDB2 native type to + // MDB2 datatype conversion + return $this->_mapNativeDatatype($field); + } + + // }}} + // {{{ _mapNativeDatatype() + + /** + * Maps a native array description of a field to a MDB2 datatype and length + * + * @param array $field native field description + * @return array containing the various possible types, length, sign, fixed + * @access public + */ + function _mapNativeDatatype($field) + { + $db =& $this->getDBInstance(); + if (PEAR::isError($db)) { + return $db; + } + return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'method not implemented', __FUNCTION__); } http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/ibase.php?r1=1.85&r2=1.86&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/ibase.php diff -u pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.85 pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.86 --- pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.85 Sat Oct 14 13:42:01 2006 +++ pear/MDB2/MDB2/Driver/Datatype/ibase.php Wed Feb 28 16:05:45 2007 @@ -44,7 +44,7 @@ // | Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: ibase.php,v 1.85 2006/10/14 13:42:01 lsmith Exp $ +// $Id: ibase.php,v 1.86 2007/02/28 16:05:45 quipo Exp $ require_once 'MDB2/Driver/Datatype/Common.php'; @@ -324,7 +324,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -333,7 +333,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { $length = $field['length']; if ((int)$length <= 0) { http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/mssql.php?r1=1.48&r2=1.49&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/mssql.php diff -u pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.48 pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.49 --- pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.48 Fri Oct 27 09:39:52 2006 +++ pear/MDB2/MDB2/Driver/Datatype/mssql.php Wed Feb 28 16:05:45 2007 @@ -44,7 +44,7 @@ // | Daniel Convissor <danielc@php.net> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.48 2006/10/27 09:39:52 lsmith Exp $ +// $Id: mssql.php,v 1.49 2007/02/28 16:05:45 quipo Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -373,7 +373,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -382,7 +382,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { // todo: handle length of various int variations $db_type = preg_replace('/\d/','', strtolower($field['type'])); http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/mysql.php?r1=1.57&r2=1.58&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/mysql.php diff -u pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.57 pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.58 --- pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.57 Fri Nov 17 15:15:08 2006 +++ pear/MDB2/MDB2/Driver/Datatype/mysql.php Wed Feb 28 16:05:45 2007 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.57 2006/11/17 15:15:08 quipo Exp $ +// $Id: mysql.php,v 1.58 2007/02/28 16:05:45 quipo Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -301,7 +301,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -310,7 +310,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { $db_type = strtolower($field['type']); $db_type = strtok($db_type, '(), '); http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/mysqli.php?r1=1.56&r2=1.57&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/mysqli.php diff -u pear/MDB2/MDB2/Driver/Datatype/mysqli.php:1.56 pear/MDB2/MDB2/Driver/Datatype/mysqli.php:1.57 --- pear/MDB2/MDB2/Driver/Datatype/mysqli.php:1.56 Fri Nov 17 15:15:08 2006 +++ pear/MDB2/MDB2/Driver/Datatype/mysqli.php Wed Feb 28 16:05:45 2007 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysqli.php,v 1.56 2006/11/17 15:15:08 quipo Exp $ +// $Id: mysqli.php,v 1.57 2007/02/28 16:05:45 quipo Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -301,7 +301,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -310,7 +310,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { $db_type = strtolower($field['type']); $db_type = strtok($db_type, '(), '); http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/oci8.php?r1=1.68&r2=1.69&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/oci8.php diff -u pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.68 pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.69 --- pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.68 Sun Feb 4 00:00:50 2007 +++ pear/MDB2/MDB2/Driver/Datatype/oci8.php Wed Feb 28 16:05:45 2007 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ -// $Id: oci8.php,v 1.68 2007/02/04 00:00:50 quipo Exp $ +// $Id: oci8.php,v 1.69 2007/02/28 16:05:45 quipo Exp $ require_once 'MDB2/Driver/Datatype/Common.php'; @@ -378,7 +378,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -387,7 +387,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { $db_type = strtolower($field['type']); $type = array(); http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/pgsql.php?r1=1.79&r2=1.80&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/pgsql.php diff -u pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.79 pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.80 --- pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.79 Fri Oct 27 09:39:52 2006 +++ pear/MDB2/MDB2/Driver/Datatype/pgsql.php Wed Feb 28 16:05:45 2007 @@ -42,7 +42,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.79 2006/10/27 09:39:52 lsmith Exp $ +// $Id: pgsql.php,v 1.80 2007/02/28 16:05:45 quipo Exp $ require_once 'MDB2/Driver/Datatype/Common.php'; @@ -382,7 +382,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -391,7 +391,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { $db_type = strtolower($field['type']); $length = $field['length']; http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/sqlite.php?r1=1.60&r2=1.61&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/sqlite.php diff -u pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.60 pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.61 --- pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.60 Sat Oct 14 13:42:02 2006 +++ pear/MDB2/MDB2/Driver/Datatype/sqlite.php Wed Feb 28 16:05:45 2007 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.60 2006/10/14 13:42:02 lsmith Exp $ +// $Id: sqlite.php,v 1.61 2007/02/28 16:05:45 quipo Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -265,7 +265,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -274,7 +274,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { $db_type = strtolower($field['type']); $length = !empty($field['length']) ? $field['length'] : null;
http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2.php?r1=1.283&r2=1.284&diff_format=u Index: pear/MDB2/MDB2.php diff -u pear/MDB2/MDB2.php:1.283 pear/MDB2/MDB2.php:1.284 --- pear/MDB2/MDB2.php:1.283 Fri Feb 16 17:09:11 2007 +++ pear/MDB2/MDB2.php Wed Feb 28 16:05:45 2007 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: MDB2.php,v 1.283 2007/02/16 17:09:11 quipo Exp $ +// $Id: MDB2.php,v 1.284 2007/02/28 16:05:45 quipo Exp $ // /** @@ -1150,6 +1150,7 @@ 'emulate_prepared' => false, 'datatype_map' => array(), 'datatype_map_callback' => array(), + 'nativetype_map_callback' => array(), ); /** http://cvs.php.net/viewvc.cgi/pear/MDB2/package.php?r1=1.236&r2=1.237&diff_format=u Index: pear/MDB2/package.php diff -u pear/MDB2/package.php:1.236 pear/MDB2/package.php:1.237 --- pear/MDB2/package.php:1.236 Wed Feb 28 13:02:21 2007 +++ pear/MDB2/package.php Wed Feb 28 16:05:45 2007 @@ -24,6 +24,8 @@ 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). - phpdoc fixes - fixed tests to be compatible with PHP4 - added tests http://cvs.php.net/viewvc.cgi/pear/MDB2/package_ibase.php?r1=1.113&r2=1.114&diff_format=u Index: pear/MDB2/package_ibase.php diff -u pear/MDB2/package_ibase.php:1.113 pear/MDB2/package_ibase.php:1.114 --- pear/MDB2/package_ibase.php:1.113 Sun Feb 25 11:15:03 2007 +++ pear/MDB2/package_ibase.php Wed Feb 28 16:05:45 2007 @@ -17,6 +17,8 @@ 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). - phpdoc fixes EOT; http://cvs.php.net/viewvc.cgi/pear/MDB2/package_mssql.php?r1=1.75&r2=1.76&diff_format=u Index: pear/MDB2/package_mssql.php diff -u pear/MDB2/package_mssql.php:1.75 pear/MDB2/package_mssql.php:1.76 --- pear/MDB2/package_mssql.php:1.75 Sun Feb 25 11:15:03 2007 +++ pear/MDB2/package_mssql.php Wed Feb 28 16:05:45 2007 @@ -45,6 +45,8 @@ - implemented a fallback mechanism within getTableIndexDefinition() 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). - phpdoc fixes open todo items: http://cvs.php.net/viewvc.cgi/pear/MDB2/package_mysql.php?r1=1.99&r2=1.100&diff_format=u Index: pear/MDB2/package_mysql.php diff -u pear/MDB2/package_mysql.php:1.99 pear/MDB2/package_mysql.php:1.100 --- pear/MDB2/package_mysql.php:1.99 Mon Feb 26 21:47:06 2007 +++ pear/MDB2/package_mysql.php Wed Feb 28 16:05:45 2007 @@ -22,6 +22,8 @@ option and use the index name as provided in case of failure before returning an error - fixed bug #10181: propagate error when an invalid type is passed to prepare() +- added a 'nativetype_map_callback' option to map native data declarations back to + custom data types (thanks to Andrew Hill). - phpdoc fixes note: http://cvs.php.net/viewvc.cgi/pear/MDB2/package_mysqli.php?r1=1.102&r2=1.103&diff_format=u Index: pear/MDB2/package_mysqli.php diff -u pear/MDB2/package_mysqli.php:1.102 pear/MDB2/package_mysqli.php:1.103 --- pear/MDB2/package_mysqli.php:1.102 Mon Feb 26 21:47:06 2007 +++ pear/MDB2/package_mysqli.php Wed Feb 28 16:05:45 2007 @@ -22,6 +22,8 @@ option and use the index name as provided in case of failure before returning an error - fixed bug #10181: propagate error when an invalid type is passed to prepare() +- added a 'nativetype_map_callback' option to map native data declarations back to + custom data types (thanks to Andrew Hill). - phpdoc fixes open todo items: http://cvs.php.net/viewvc.cgi/pear/MDB2/package_oci8.php?r1=1.102&r2=1.103&diff_format=u Index: pear/MDB2/package_oci8.php diff -u pear/MDB2/package_oci8.php:1.102 pear/MDB2/package_oci8.php:1.103 --- pear/MDB2/package_oci8.php:1.102 Sun Feb 25 11:15:03 2007 +++ pear/MDB2/package_oci8.php Wed Feb 28 16:05:45 2007 @@ -16,6 +16,10 @@ 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 +- fixed bug #4854: Oracle Easy Connect syntax only works with array DSN +- added a 'nativetype_map_callback' option to map native data declarations back to + custom data types (thanks to Andrew Hill). +- phpdoc fixes note: - please use the latest ext/oci8 version from pecl.php.net/oci8 @@ -25,8 +29,6 @@ behaviour can be disabled by setting the "emulate_database" option to false. - the multi_query test failes because this is not supported by ext/oci8 - the null LOB test failes because this is not supported by Oracle -- fixed bug #4854: Oracle Easy Connect syntax only works with array DSN -- phpdoc fixes open todo items: - enable use of read() for LOBs to read a LOB in chunks http://cvs.php.net/viewvc.cgi/pear/MDB2/package_pgsql.php?r1=1.100&r2=1.101&diff_format=u Index: pear/MDB2/package_pgsql.php diff -u pear/MDB2/package_pgsql.php:1.100 pear/MDB2/package_pgsql.php:1.101 --- pear/MDB2/package_pgsql.php:1.100 Sun Feb 25 11:15:03 2007 +++ pear/MDB2/package_pgsql.php Wed Feb 28 16:05:45 2007 @@ -14,6 +14,8 @@ 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). - phpdoc fixes open todo items: http://cvs.php.net/viewvc.cgi/pear/MDB2/package_sqlite.php?r1=1.80&r2=1.81&diff_format=u Index: pear/MDB2/package_sqlite.php diff -u pear/MDB2/package_sqlite.php:1.80 pear/MDB2/package_sqlite.php:1.81 --- pear/MDB2/package_sqlite.php:1.80 Sun Feb 25 11:15:03 2007 +++ pear/MDB2/package_sqlite.php Wed Feb 28 16:05:45 2007 @@ -12,6 +12,8 @@ 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). - phpdoc fixes note: http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/Common.php?r1=1.118&r2=1.119&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/Common.php diff -u pear/MDB2/MDB2/Driver/Datatype/Common.php:1.118 pear/MDB2/MDB2/Driver/Datatype/Common.php:1.119 --- pear/MDB2/MDB2/Driver/Datatype/Common.php:1.118 Wed Feb 28 12:42:59 2007 +++ pear/MDB2/MDB2/Driver/Datatype/Common.php Wed Feb 28 16:05:45 2007 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.118 2007/02/28 12:42:59 quipo Exp $ +// $Id: Common.php,v 1.119 2007/02/28 16:05:45 quipo Exp $ require_once 'MDB2/LOB.php'; @@ -1724,6 +1724,34 @@ return $db; } + // If the user has specified an option to map the native field + // type to a custom MDB2 datatype... + if (!empty($db->options['nativetype_map_callback'][$field['type']])) { + return call_user_func_array($db->options['nativetype_map_callback'][$field['type']], $field); + } + + // Otherwise perform the built-in (i.e. normal) MDB2 native type to + // MDB2 datatype conversion + return $this->_mapNativeDatatype($field); + } + + // }}} + // {{{ _mapNativeDatatype() + + /** + * Maps a native array description of a field to a MDB2 datatype and length + * + * @param array $field native field description + * @return array containing the various possible types, length, sign, fixed + * @access public + */ + function _mapNativeDatatype($field) + { + $db =& $this->getDBInstance(); + if (PEAR::isError($db)) { + return $db; + } + return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'method not implemented', __FUNCTION__); } http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/ibase.php?r1=1.85&r2=1.86&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/ibase.php diff -u pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.85 pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.86 --- pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.85 Sat Oct 14 13:42:01 2006 +++ pear/MDB2/MDB2/Driver/Datatype/ibase.php Wed Feb 28 16:05:45 2007 @@ -44,7 +44,7 @@ // | Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: ibase.php,v 1.85 2006/10/14 13:42:01 lsmith Exp $ +// $Id: ibase.php,v 1.86 2007/02/28 16:05:45 quipo Exp $ require_once 'MDB2/Driver/Datatype/Common.php'; @@ -324,7 +324,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -333,7 +333,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { $length = $field['length']; if ((int)$length <= 0) { http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/mssql.php?r1=1.48&r2=1.49&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/mssql.php diff -u pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.48 pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.49 --- pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.48 Fri Oct 27 09:39:52 2006 +++ pear/MDB2/MDB2/Driver/Datatype/mssql.php Wed Feb 28 16:05:45 2007 @@ -44,7 +44,7 @@ // | Daniel Convissor <danielc@php.net> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.48 2006/10/27 09:39:52 lsmith Exp $ +// $Id: mssql.php,v 1.49 2007/02/28 16:05:45 quipo Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -373,7 +373,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -382,7 +382,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { // todo: handle length of various int variations $db_type = preg_replace('/\d/','', strtolower($field['type'])); http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/mysql.php?r1=1.57&r2=1.58&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/mysql.php diff -u pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.57 pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.58 --- pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.57 Fri Nov 17 15:15:08 2006 +++ pear/MDB2/MDB2/Driver/Datatype/mysql.php Wed Feb 28 16:05:45 2007 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.57 2006/11/17 15:15:08 quipo Exp $ +// $Id: mysql.php,v 1.58 2007/02/28 16:05:45 quipo Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -301,7 +301,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -310,7 +310,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { $db_type = strtolower($field['type']); $db_type = strtok($db_type, '(), '); http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/mysqli.php?r1=1.56&r2=1.57&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/mysqli.php diff -u pear/MDB2/MDB2/Driver/Datatype/mysqli.php:1.56 pear/MDB2/MDB2/Driver/Datatype/mysqli.php:1.57 --- pear/MDB2/MDB2/Driver/Datatype/mysqli.php:1.56 Fri Nov 17 15:15:08 2006 +++ pear/MDB2/MDB2/Driver/Datatype/mysqli.php Wed Feb 28 16:05:45 2007 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysqli.php,v 1.56 2006/11/17 15:15:08 quipo Exp $ +// $Id: mysqli.php,v 1.57 2007/02/28 16:05:45 quipo Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -301,7 +301,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -310,7 +310,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { $db_type = strtolower($field['type']); $db_type = strtok($db_type, '(), '); http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/oci8.php?r1=1.68&r2=1.69&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/oci8.php diff -u pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.68 pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.69 --- pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.68 Sun Feb 4 00:00:50 2007 +++ pear/MDB2/MDB2/Driver/Datatype/oci8.php Wed Feb 28 16:05:45 2007 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ -// $Id: oci8.php,v 1.68 2007/02/04 00:00:50 quipo Exp $ +// $Id: oci8.php,v 1.69 2007/02/28 16:05:45 quipo Exp $ require_once 'MDB2/Driver/Datatype/Common.php'; @@ -378,7 +378,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -387,7 +387,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { $db_type = strtolower($field['type']); $type = array(); http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/pgsql.php?r1=1.79&r2=1.80&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/pgsql.php diff -u pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.79 pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.80 --- pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.79 Fri Oct 27 09:39:52 2006 +++ pear/MDB2/MDB2/Driver/Datatype/pgsql.php Wed Feb 28 16:05:45 2007 @@ -42,7 +42,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.79 2006/10/27 09:39:52 lsmith Exp $ +// $Id: pgsql.php,v 1.80 2007/02/28 16:05:45 quipo Exp $ require_once 'MDB2/Driver/Datatype/Common.php'; @@ -382,7 +382,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -391,7 +391,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { $db_type = strtolower($field['type']); $length = $field['length']; http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/Datatype/sqlite.php?r1=1.60&r2=1.61&diff_format=u Index: pear/MDB2/MDB2/Driver/Datatype/sqlite.php diff -u pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.60 pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.61 --- pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.60 Sat Oct 14 13:42:02 2006 +++ pear/MDB2/MDB2/Driver/Datatype/sqlite.php Wed Feb 28 16:05:45 2007 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.60 2006/10/14 13:42:02 lsmith Exp $ +// $Id: sqlite.php,v 1.61 2007/02/28 16:05:45 quipo Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -265,7 +265,7 @@ } // }}} - // {{{ mapNativeDatatype() + // {{{ _mapNativeDatatype() /** * Maps a native array description of a field to a MDB2 datatype and length @@ -274,7 +274,7 @@ * @return array containing the various possible types, length, sign, fixed * @access public */ - function mapNativeDatatype($field) + function _mapNativeDatatype($field) { $db_type = strtolower($field['type']); $length = !empty($field['length']) ? $field['length'] : null;